query-b39f956fcc35b784c907d3dc7a370b93
Popperipopp
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?hos ?hosLabel ?roleStatementLabel ?countryLabel ?startYear ?endYear
WHERE {
?hos wdt:P31 wd:Q5 .
?hos p:P39 ?roleNode .
?roleNode ps:P39 ?roleStatement .
?roleStatement wdt:P31?/wdt:P279* wd:Q48352 .
OPTIONAL { ?roleNode pq:P580 ?startYear . }
OPTIONAL { ?roleNode pq:P582 ?endYear . }
?roleStatement wdt:P17 ?country .
OPTIONAL { ?country wdt:P576 ?dissolved . }
FILTER (! BOUND(?dissolved))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?country")
v1("?dissolved")
v6("?endYear"):::projected
v2("?hos"):::projected
v3("?roleNode")
v4("?roleStatement")
v5("?startYear"):::projected
a1((" "))
c6(["wd:Q48352"]):::iri
c12(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not bound(?dissolved)"]]
f0 --> v1
v2 --"p:direct/P31"--> c2
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> v4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"p:direct/P31"--> a1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
end
union0r <== or ==> union0l
end
a1 --"p:direct/P279"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v6
end
v4 --"p:direct/P17"--> v7
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P576".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end