query-cc38921576cc3b1d5ba54e17edce4792
Or with a count of members for each term:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?term ?termLabel ?start (COUNT(DISTINCT ?who) AS ?members) {
?who p:P39 [ ps:P39 wd:Q16707842 ; pq:P2937 ?term ] .
OPTIONAL { ?term wdt:P571 ?start }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
GROUP BY ?term ?termLabel ?start
ORDER BY DESC(?start) DESC(?termLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?members")
v1("?start"):::projected
v3("?term"):::projected
v2("?termLabel"):::projected
v4("?who"):::projected
a1((" "))
c7(["bd:serviceParam"]):::iri
c2(["wd:Q16707842"]):::iri
c9(["en"]):::literal
a1 --"p:statement/P39"--> c2
a1 --"p:qualifier/P2937"--> v3
v4 --"p:P39"--> a1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P571".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind1[/"count(?who)"/]
v4 --o bind1
bind1 --as--o v5