query-a63f8c5b58c035d68ab8daad2a7a8b75

rq turtle/ttl

SPARQL query

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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/>
SELECT ?wikidata ?faction_wikidata WHERE {
  ?wikidata p:P39 ?position_statement .
  ?position_statement ps:P39 wd:Q1939555; pq:P2937 wd:Q30579723
  OPTIONAL { ?position_statement pq:P768 ?constituency_wikidata }
  OPTIONAL { ?position_statement pq:P4100 ?faction_wikidata }
  OPTIONAL { ?position_statement pq:P582 ?mandate_end }
  BIND(COALESCE(?mandate_end, "3001-01-01T00:00:00Z"^^xsd:dateTime) as ?enddate)
  FILTER (?enddate > NOW())
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?constituency_wikidata") v7("?enddate") v5("?faction_wikidata"):::projected v6("?mandate_end") v3("?position_statement") v2("?wikidata"):::projected c3(["wd:Q1939555"]):::iri c5(["wd:Q30579723"]):::iri f0[["?enddate > NOW()"]] f0 --> v7 v2 --"p:P39"--> v3 v3 --"p:statement/P39"--> c3 v3 --"p:qualifier/P2937"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P768".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P4100".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P582".-> v6 end bind1[/"?mandate_end'3001-01-01T00:00:00Z^^xsd:dateTime'"/] v6 --o bind1 bind1 --as--o v7