query-7a30a576759e3f317f078662cc0324bd
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
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 ?item ?itemLabel ?positionLabel ?start ?end WHERE {
{
SELECT ?item ?position ?start ?end WHERE {
BIND(420 AS ?year)
BIND(STRDT(CONCAT(STR(?year), "-01-01"), xsd:dateTime) AS ?yearStart)
BIND(STRDT(CONCAT(STR(?year + 1), "-01-01"), xsd:dateTime) AS ?nextYearStart)
?item p:P39 [
ps:P39 ?position;
pq:P580 ?start;
pq:P582 ?end
].
FILTER(?start < ?yearStart)
FILTER(?end >= ?nextYearStart)
}
}
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;
v1("?end"):::projected
v7("?item"):::projected
v6("?nextYearStart")
v6("?position")
v3("?start"):::projected
v5("?year")
v6("?yearStart")
a1((" "))
c6(["bd:serviceParam"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?end >= ?nextYearStart"]]
f0 --> v1
f0 --> v6
f1[["?start < ?yearStart"]]
f1 --> v3
f1 --> v6
bind2[/"'420^^xsd:integer'"/]
bind2 --as--o v5
bind3[/"STRDT(concat(str(?year),'-01-01'),'xsd:dateTime')"/]
v5 --o bind3
bind3 --as--o v6
bind4[/"STRDT(concat(str(?year + '1^^xsd:integer'),'-01-01'),'xsd:dateTime')"/]
v5 --o bind4
bind4 --as--o v6
a1 --"p:statement/P39"--> v6
a1 --"p:qualifier/P580"--> v3
a1 --"p:qualifier/P582"--> v1
v7 --"p:P39"--> a1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end