query-7781a74e1ddca097f53967c313d74ff6

rq turtle/ttl

Recupera todos los universos de ficción con el número de ítems y obras

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?universe ?universeLabel ?num_universe (count(?work) as ?num_works) WHERE {
    {
   SELECT DISTINCT ?universe (count(?item) as ?num_universe) WHERE {
      ?item wdt:P1080 ?universe .
   } GROUP BY ?universe
}   OPTIONAL {?work wdt:P1434 ?universe .}
   OPTIONAL {?universe wdt:P1445 ?work .}
   SERVICE wikibase:label {bd:serviceParam wikibase:language "es","en" .}
} GROUP BY ?universe ?universeLabel ?num_universe

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item") v3("?num_universe"):::projected v5("?num_works") v2("?universe"):::projected v4("?work"):::projected c5(["bd:serviceParam"]):::iri c8(["en"]):::literal c7(["es"]):::literal v1 --"wdt:P1080"--> v2 bind1[/"count(?item)"/] v1 --o bind1 bind1 --as--o v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P1434".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P1445".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 c5 --"wikibase:language"--> c8 end bind3[/"count(?work)"/] v4 --o bind3 bind3 --as--o v5