query-44842474fbf6227fa078ad3522ea984e

rq turtle/ttl

SPARQL query

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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/>
SELECT DISTINCT ?wikidata ?wikidata_area ?wikidata_group WHERE {
    ?wikidata p:P39 ?statement .
    ?statement ps:P39 [ wdt:P279* wd:Q18711738 ] ; pq:P580 ?start .
    OPTIONAL { ?statement pq:P768 ?wikidata_area }
    OPTIONAL { ?statement pq:P4100 ?wikidata_group }
    OPTIONAL { ?statement pq:P582 ?mem_end } 
    BIND(COALESCE(?mem_end, "3001-01-01T00:00:00Z"^^xsd:dateTime) as ?end)
    FILTER (?end > NOW())
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?end") v7("?mem_end") v4("?start") v3("?statement") v2("?wikidata"):::projected v5("?wikidata_area"):::projected v6("?wikidata_group"):::projected a1((" ")) c3(["wd:Q18711738"]):::iri f0[["?end > NOW()"]] f0 --> v8 v2 --"p:P39"--> v3 a1 --"p:direct/P279"--> c3 v3 --"p:statement/P39"--> a1 v3 --"p:qualifier/P580"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P768".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P4100".-> v6 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P582".-> v7 end bind1[/"?mem_end'3001-01-01T00:00:00Z^^xsd:dateTime'"/] v7 --o bind1 bind1 --as--o v8