query-ae49f78e7a2d6e29b82fef05af81e218
SPARQL query
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 DISTINCT (STRAFTER(STRAFTER(?parlID,"/"),"/") AS ?id) ?nameLabel ?partyLabel ?constituencyLabel WHERE {
?name p:P39 ?ps .
?ps ps:P39 wd:Q30524710 .
FILTER NOT EXISTS { ?ps pq:P582 [] }
OPTIONAL { ?name wdt:P1996 ?parlID }
OPTIONAL { ?ps pq:P768 ?constituency}
OPTIONAL { ?ps pq:P4100 ?party}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?constituency")
v6("?id")
v2("?name")
v3("?parlID"):::projected
v5("?party")
v1("?ps")
a1((" "))
c9(["bd:serviceParam"]):::iri
c4(["wd:Q30524710"]):::iri
c11(["en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:qualifier/P582"--> e0a1
e0v1("?ps"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
v1 --"p:qualifier/P582"--> a1
v2 --"p:P39"--> v1
v1 --"p:statement/P39"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P1996".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:qualifier/P768".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:qualifier/P4100".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind1[/"substring-after(substring-after(?parlID,'/'),'/')"/]
v3 --o bind1
bind1 --as--o v6