query-7db48f40b7d3d3aff54deb1c42e686fd

rq turtle/ttl

title:Comparison of Christian hymns and bhajans SELECT ?type ?typeLabel (COUNT(DISTINCT ?item) AS ?count) (SUM(?links) AS ?sites) WHERE { { BIND(wd:Q856713 AS ?type) . ?item wdt:P31/wdt:P279? wd:Q856713 . ?item wikibase:sitelinks ?links } UNION { BIND(wd:Q854775 AS ?type) . ?item wdt:P31/wdt:P279? wd:Q854775 . ?item wikibase:sitelinks ?links } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?type ?typeLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Comparison of Christian hymns and bhajans
SELECT ?type ?typeLabel (COUNT(DISTINCT ?item) AS ?count) (SUM(?links) AS ?sites) WHERE {
{ BIND(wd:Q856713 AS ?type) .
  ?item wdt:P31/wdt:P279? wd:Q856713 .
?item wikibase:sitelinks ?links }
UNION {
  BIND(wd:Q854775 AS ?type) .
  ?item wdt:P31/wdt:P279? wd:Q854775 .
  ?item wikibase:sitelinks ?links 
} 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?type ?typeLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?count") v2("?item"):::projected v3("?links"):::projected v5("?sites") v4("?type"):::projected a1((" ")) a2((" ")) c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q854775"]):::iri c2(["wd:Q856713"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; bind0[/"'wd:Q854775'"/] bind0 --as--o v4 v2 --"wdt:P31"--> a2 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; a2 --"wdt:P279"--> c5 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; end union1r <== or ==> union1l end v2 --"wikibase:sitelinks"--> v3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; bind1[/"'wd:Q856713'"/] bind1 --as--o v4 v2 --"wdt:P31"--> a1 subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; a1 --"wdt:P279"--> c2 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; end union2r <== or ==> union2l end v2 --"wikibase:sitelinks"--> v3 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind4[/"count(?item)"/] v2 --o bind4 bind4 --as--o v4 bind5[/"sum(?links)"/] v3 --o bind5 bind5 --as--o v5