query-4b790138d6141174608dc3cdd10bc91e

rq turtle/ttl

WSJ articles' main subjects order by count

and the winner is... OPEC!

SELECT DISTINCT (COUNT(?item) AS ?count) ?subject $subjectLabel WHERE {
?item wdt:P1433 wd:Q164746. hint:Prior hint:runFirst "true"^^xsd:boolean. ?item (wdt:P31/(wdt:P279*)) wd:Q191067; wdt:P921 ?subject. SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr". } } GROUP BY ?subject $subjectLabel ORDER BY DESC (?count)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
# WSJ articles' main subjects order by count
# and the winner is... OPEC!
SELECT DISTINCT (COUNT(?item) AS ?count) ?subject $subjectLabel
WHERE {  
  ?item wdt:P1433 wd:Q164746.

  ?item (wdt:P31/(wdt:P279*)) wd:Q191067;
    wdt:P921 ?subject.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr". }
}
GROUP BY ?subject $subjectLabel
ORDER BY DESC (?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?count") v2("?item"):::projected v3("?subject"):::projected a1((" ")) c8(["bd:serviceParam"]):::iri c2(["wd:Q164746"]):::iri c5(["wd:Q191067"]):::iri c10(["en,fr"]):::literal v2 --"wdt:P1433"--> c2 v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c5 v2 --"wdt:P921"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind1[/"count(?item)"/] v2 --o bind1 bind1 --as--o v4