query-958111e9af90107c395d0ea02152049a
SPARQL query
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT (STRAFTER(STR(?item), STR(wd:)) AS ?id) (STRBEFORE(STR(?startDate), "T") AS ?start_date) (STRBEFORE(STR(?endDate), "T") AS ?end_date) WHERE {
?item p:P39 ?mem .
?mem ps:P39 wd:Q30580545 .
OPTIONAL { ?mem pq:P580 ?startDate }
OPTIONAL { ?mem pq:P582 ?endDate }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} ORDER by ?id
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?endDate"):::projected
v7("?end_date")
v6("?id")
v2("?item"):::projected
v3("?mem")
v4("?startDate"):::projected
v6("?start_date")
c3(["wd:Q30580545"]):::iri
c7(["bd:serviceParam"]):::iri
c9(["en"]):::literal
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind0[/"substring-after(str(?item),str('wd:'))"/]
v2 --o bind0
bind0 --as--o v6
bind1[/"substring-before(str(?startDate),'T')"/]
v4 --o bind1
bind1 --as--o v6
bind2[/"substring-before(str(?endDate),'T')"/]
v5 --o bind2
bind2 --as--o v7