query-f835abdf6681500851305ab087719bdd
SPARQL query
Use at
- https://query.wikidata.org/sparql
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 ?area_wikidata_id ?party_wikidata_id ?source ?term ?start ?end WHERE {
?identifier__wikidata p:P39 ?statement.
?statement ps:P39 wd:Q33512801; pq:P2937 wd:Q29068722 ; pq:P580 ?start .
OPTIONAL { ?statement pq:P582 ?end }
OPTIONAL { ?statement pq:P768 ?area_wikidata_id. }
OPTIONAL { ?statement pq:P4100 ?party_wikidata_id. }
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)), "www.na.gov.pk/"))
}
FILTER(!BOUND(?end) || ?end > NOW())
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?area_wikidata_id"):::projected
v10("?describedAtPA")
v1("?end"):::projected
v3("?identifier__wikidata"):::projected
v11("?name"):::projected
v7("?party_wikidata_id"):::projected
v2("?source"):::projected
v5("?start"):::projected
v4("?statement")
v9("?term"):::projected
v8("?termStatement")
a1((" "))
c6(["wd:Q29068722"]):::iri
c4(["wd:Q33512801"]):::iri
f0[["(not bound(?end) || ?end > NOW())"]]
f0 --> v1
v3 --"p:P39"--> v4
v4 --"p:statement/P39"--> c4
v4 --"p:qualifier/P2937"--> c6
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/P768".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P4100".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P2937".-> v8
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:P31".-> a1
a1 --"p:qualifier/P1545"--> v9
end
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P973".-> v10
v10 --"p:statement/P973"--> v2
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v10 -."p:qualifier/P1810".-> v11
end
end