query-a79e6414c01ed1b6fabe5f7d8b612ab2
SPARQL query
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?url ?honorific_id ?name ?district_id ?party_id
WHERE
{
?item p:P39 ?statement .
?statement ps:P39/wdt:P279* wd:Q16744266 ; pq:P580 ?start .
OPTIONAL { ?statement pq:P582 ?end }
OPTIONAL { ?statement pq:P768 ?district_id }
OPTIONAL { ?district_id rdfs:label ?district . FILTER(lang(?en_label)="en") }
OPTIONAL { ?statement pq:P4100 ?party_id }
OPTIONAL {
?item p:P973 ?describedAtOfficial .
?describedAtOfficial ps:P973 ?url .
OPTIONAL {
?describedAtOfficial pq:P1810 ?name .
}
FILTER(CONTAINS(LCASE(STR(?url)), "parliament.gov.za/"))
}
FILTER(!BOUND(?end) || ?end > NOW())
}
ORDER BY ?start ?end
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?describedAtOfficial")
v8("?district")
v7("?district_id"):::projected
v4("?en_label")
v2("?end")
v5("?item"):::projected
v11("?name"):::projected
v9("?party_id"):::projected
v1("?start")
v6("?statement")
v3("?url"):::projected
a1((" "))
c6(["wd:Q16744266"]):::iri
f0[["(not bound(?end) || ?end > NOW())"]]
f0 --> v2
v5 --"p:P39"--> v6
v6 --"p:statement/P39"--> a1
a1 --"p:direct/P279"--> c6
v6 --"p:qualifier/P580"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P582".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P768".-> v7
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v7 -."rdfs:label".-> v8
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P4100".-> v9
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:P973".-> v10
v10 --"p:statement/P973"--> v3
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v10 -."p:qualifier/P1810".-> v11
end
end