query-61abf73ecedf421c51ca9e10aacc0f02
TODO
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?fdate ?ddate ?ID
where {
{SELECT ?item ?itemLabel ?fdate ?ddate ?ID
WHERE
{
?item wdt:P31 wd:Q5;
wdt:P27 wd:Q20.
?item wdt:P569 ?fdate.
optional {
?item wdt:P570 ?ddate.
}
filter (!bound(?ddate))
BIND(YEAR(?fdate) AS ?year)
FILTER(?year < 1900)
FILTER(?year > 1870)
OPTIONAL {?item wdt:P4574 ?ID .}
} limit 1000
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?ID"):::projected
v2("?ddate"):::projected
v4("?fdate"):::projected
v3("?item"):::projected
v5("?year")
c6(["wd:Q20"]):::iri
c11(["bd:serviceParam"]):::iri
c4(["wd:Q5"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?year > '1870^^xsd:integer'"]]
f0 --> v5
f1[["?year < '1900^^xsd:integer'"]]
f1 --> v5
f2[["not bound(?ddate)"]]
f2 --> v2
v3 --"wdt:P31"--> c4
v3 --"wdt:P27"--> c6
v3 --"wdt:P569"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P570".-> v2
end
bind3[/"year-from-dateTime(?fdate)"/]
v4 --o bind3
bind3 --as--o v5
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P4574".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end