query-9f53d2008f0ef42d3fc3ab7fe4bb368d
.on Mastodon and on TwitterOriginally posted
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?state ?string (COUNT(*) AS ?count) WHERE {
{
SELECT DISTINCT ?state WHERE {
?state wdt:P31/wdt:P279* wd:Q3624078;
p:P463 ?memberOfStatement.
?memberOfStatement a wikibase:BestRank;
ps:P463 wd:Q1065.
MINUS { ?memberOfStatement pq:P582 ?endTime. }
MINUS { ?state wdt:P576|wdt:P582 ?end. }
}
}
?state rdfs:label ?label.
BIND(STR(?label) AS ?string)
}
GROUP BY ?state ?string
HAVING(?count >= 50)
ORDER BY DESC(?count)
LIMIT 100
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?count")
v5("?end")
v4("?endTime")
v6("?label")
v3("?memberOfStatement")
v2("?state"):::projected
v7("?string"):::projected
a1((" "))
c7(["wikibase:BestRank"]):::iri
c4(["wd:Q3624078"]):::iri
c9(["wd:Q1065"]):::iri
f0[["?count >= '50^^xsd:integer'"]]
f0 --> v8
v2 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c4
v2 --"p:P463"--> v3
v3 --"a"--> c7
v3 --"p:statement/P463"--> c9
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:qualifier/P582"--> v4
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P582"--> v5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P576"--> v5
end
union0r <== or ==> union0l
end
end
v2 --"rdfs:label"--> v6
bind3[/"str(?label)"/]
v6 --o bind3
bind3 --as--o v7
bind5[/"count(*)"/]
bind5 --as--o v8