query-a74504aba975cc98f3ae79aa94a3e25c
Should instances of legislative term (Q15238777) use start time (P580) or inception (P571)?Wikidata talk:WikiProject British Politicians#Start and End of TermsAs part of trying to see how common each were, I ended up with:
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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?v ?vLabel (COUNT(DISTINCT ?term) AS ?count) WHERE {
?term p:P31/ps:P31/wdt:P279* wd:Q15238777 ; ?v ?o . # need 'wd:' to specify value
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
GROUP BY ?v ?vLabel
ORDER BY DESC (?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?count")
v4("?o")
v2("?term"):::projected
v3("?v"):::projected
a1((" "))
a2((" "))
c4(["wd:Q15238777"]):::iri
c6(["bd:serviceParam"]):::iri
c8(["en"]):::literal
v2 --"p:P31"--> a1
a1 --"p:statement/P31"--> a2
a2 --"p:direct/P279"--> c4
v2 -->v3--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end
bind1[/"count(?term)"/]
v2 --o bind1
bind1 --as--o v5