query-a5c4c70f28c588d96376c4eb82e8d24e

rq turtle/ttl

SPARQL query

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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 ?member ?memberLabel ?constituency ?party WHERE { 
    ?member p:P39 ?mem .
    ?mem ps:P39 wd:Q654291 ; pq:P2937 wd:Q28976095 . 
    OPTIONAL { ?mem pq:P768  ?constituency }
    OPTIONAL { ?mem pq:P4100 ?party }
    FILTER NOT EXISTS { ?mem pq:P582 ?end_date }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  }
  ORDER BY ?memberLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?constituency"):::projected v3("?end_date") v2("?mem") v4("?member"):::projected v1("?memberLabel"):::projected v6("?party"):::projected c10(["bd:serviceParam"]):::iri c12(["en"]):::literal c4(["wd:Q654291"]):::iri c6(["wd:Q28976095"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:qualifier/P582"--> e0v2 e0v2("?end_date"):::projected e0v1("?mem"):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> v3 v2 --"p:qualifier/P582"--> v3 v4 --"p:P39"--> v2 v2 --"p:statement/P39"--> c4 v2 --"p:qualifier/P2937"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P768".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P4100".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end