query-8c989d18eb546245320ad467c11075c3
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?start_time ?end_time WHERE {
?item wdt:P31 wd:Q5;
p:P463 ?statement.
?statement ps:P463 wd:Q202479.
OPTIONAL {
?statement pqv:P580 [
wikibase:timePrecision ?start_precision;
wikibase:timeValue ?start ;
];
}
OPTIONAL {
?statement pqv:P582 [
wikibase:timePrecision ?end_precision;
wikibase:timeValue ?end ;
];
}
BIND(IF((?start_precision = 9), YEAR(?start), ?start) AS ?start_time)
BIND(IF((?end_precision = 9), YEAR(?end), ?end) AS ?end_time)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?end")
v5("?end_precision")
v8("?end_time"):::projected
v1("?item"):::projected
v4("?start")
v3("?start_precision")
v7("?start_time"):::projected
v2("?statement")
a1((" "))
a2((" "))
c2(["wd:Q5"]):::iri
c5(["wd:Q202479"]):::iri
v1 --"p:direct/P31"--> c2
v1 --"p:P463"--> v2
v2 --"p:statement/P463"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a1 -."wikibase:timePrecision".-> v3
a1 --"wikibase:timeValue"--> v4
v2 --"p:qualifier/value/P580"--> a1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a2 -."wikibase:timePrecision".-> v5
a2 --"wikibase:timeValue"--> v6
v2 --"p:qualifier/value/P582"--> a2
end
bind0[/"if(?start_precision = '9^^xsd:integer',year-from-dateTime(?start),?start)"/]
v3 --o bind0
v4 --o bind0
bind0 --as--o v7
bind1[/"if(?end_precision = '9^^xsd:integer',year-from-dateTime(?end),?end)"/]
v5 --o bind1
v6 --o bind1
bind1 --as--o v8