query-4de6f5777674b7cac8e65af28e2d6767
That returns about 55,000 memberships, which seems plausible (though I'm certainly open to suggestions as to how to improve that query). " approach, that times out: Statements without qualifiersHowever, when I then tried combining that with the "
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/>
SELECT (COUNT(DISTINCT ?position_statement) AS ?count)
WHERE {
?person p:P39 ?position_statement . # an item has a position
?position_statement ps:P39 ?mem .
?person wdt:P31 wd:Q5 . # (and that item is a human)
?mem wdt:P279 wd:Q486839 . # as some subclass of Member of Parliament
?mem wdt:P1001 ?jurisdiction . # with a jurisdiction
?jurisdiction wdt:P31 wd:Q6256 . # where the jurisdiction is a country (i.e. National Legislature)
FILTER NOT EXISTS {
?position_statement ?pq_pred ?pq_obj .
?prop wikibase:qualifier ?pq_pred .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?count")
v7("?jurisdiction")
v6("?mem")
v5("?person")
v1("?position_statement"):::projected
v3("?pq_obj")
v2("?pq_pred")
v4("?prop")
c5(["wd:Q5"]):::iri
c7(["wd:Q486839"]):::iri
c9(["wd:Q6256"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 -->e0v2--> e0v3
e0v4 --"wikibase:qualifier"--> e0v2
e0v1("?position_statement"):::projected
e0v3("?pq_obj"):::projected
e0v2("?pq_pred"):::projected
e0v4("?prop"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> v3
f0 --> v4
f0 --> c1
v1 -->v2--> v3
v4 --"wikibase:qualifier"--> v2
v5 --"p:P39"--> v1
v1 --"p:statement/P39"--> v6
v5 --"p:direct/P31"--> c5
v6 --"p:direct/P279"--> c7
v6 --"p:direct/P1001"--> v7
v7 --"p:direct/P31"--> c9
bind2[/"count(?position_statement)"/]
v1 --o bind2
bind2 --as--o v8