query-e20d3306abd79a815baea7f035f08f5c

rq turtle/ttl

SPARQL query

Use at

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 ?identifier__wikidata ?name ?source ?term (REPLACE(STR(?start),"T00:00:00Z","") AS ?start_date) WHERE {
  ?identifier__wikidata p:P39 ?statement.
  ?statement ps:P39 wd:Q16744266; pq:P580 ?start .
  OPTIONAL { ?statement pq:P582 ?end }
  OPTIONAL {
    ?statement pq:P2937 ?termStatement .
    OPTIONAL { ?termStatement p:P31/pq:P1545 ?term . }
  }
  OPTIONAL {
    ?identifier__wikidata p:P973 ?describedAtPA .
    ?describedAtPA ps:P973 ?source .
    OPTIONAL {
      ?describedAtPA pq:P1810 ?name .
    }
    FILTER(CONTAINS(LCASE(STR(?source)), "pa.org.za/"))
  }
  FILTER(!BOUND(?end) || ?end > NOW())
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?describedAtPA") v1("?end") v3("?identifier__wikidata"):::projected v9("?name"):::projected v2("?source"):::projected v5("?start"):::projected v10("?start_date") v4("?statement") v7("?term"):::projected v6("?termStatement") a1((" ")) c4(["wd:Q16744266"]):::iri f0[["(not bound(?end) || ?end > NOW())"]] f0 --> v1 v3 --"p:P39"--> v4 v4 --"p:statement/P39"--> c4 v4 --"p:qualifier/P580"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P582".-> v1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P2937".-> v6 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:P31".-> a1 a1 --"p:qualifier/P1545"--> v7 end end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:P973".-> v8 v8 --"p:statement/P973"--> v2 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:qualifier/P1810".-> v9 end end bind1[/"replace(str(?start),'T00:00:00Z','')"/] v5 --o bind1 bind1 --as--o v10