query-487e8e2a2af003ef4fa24ad0e2b1cfae
Query for compete dataIf the data was complete, something like the following could work (5 results currently):
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?when ?start ?end
WHERE
{
?item wdt:P31/wdt:P279* wd:Q1656682 .
?item wdt:P276/wdt:P131* wd:Q1490 .
{ ?item wdt:P585 ?when FILTER(YEAR(?when)=2002) }
UNION
{ ?item wdt:P580 ?start ; wdt:P582 ?end .
FILTER ( ?start < "2003-00-00T00:00:00Z"^^xsd:dateTime
&& ?end > "2001-12-32T00:00:00Z"^^xsd:dateTime )
}
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;
v4("?end"):::projected
v1("?item"):::projected
v3("?start"):::projected
v2("?when"):::projected
a1((" "))
a2((" "))
c3(["wd:Q1656682"]):::iri
c14(["bd:serviceParam"]):::iri
c6(["wd:Q1490"]):::iri
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v1 --"wdt:P276"--> a2
a2 --"wdt:P131"--> c6
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f0[["?start < '2003-00-00T00:00:00Z^^xsd:dateTime'?end > '2001-12-32T00:00:00Z^^xsd:dateTime'"]]
f0 --> v3
f0 --> v4
v1 --"wdt:P580"--> v3
v1 --"wdt:P582"--> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f1[["year-from-dateTime(?when) = '2002^^xsd:integer'"]]
f1 --> v2
v1 --"wdt:P585"--> v2
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end