query-c1d5b054d476659dac6f540db330e8eb
TODO
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
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 ?position ?positionLabel ?p1_end ?p2_start
WHERE
{
?item p:P39 ?statement1 .
?statement1 ps:P39 ?position ; pqv:P582 [ wikibase:timePrecision "11"^^xsd:integer ; wikibase:timeValue ?p1_end ] .
?position wdt:P279* wd:Q2285706 ; wdt:P1001 [ wdt:P31 wd:Q6256; ] .
?item p:P39 ?statement2 .
?statement2 ps:P39 ?position ; pq:P580 ?p2_start .
FILTER (?statement1 != ?statement2 && ?p2_start >= ?p1_end)
BIND ((?p2_start - ?p1_end) AS ?gap)
FILTER (?gap < 2)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?p2_start)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?gap")
v6("?item"):::projected
v5("?p1_end"):::projected
v1("?p2_start"):::projected
v7("?position"):::projected
v3("?statement1")
v4("?statement2")
a1((" "))
a2((" "))
c5(["11^^xsd:integer"]):::literal
c15(["bd:serviceParam"]):::iri
c9(["wd:Q2285706"]):::iri
c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c11(["wd:Q6256"]):::iri
f0[["?gap < '2^^xsd:integer'"]]
f0 --> v8
f1[["?statement1 != ?statement2?p2_start >= ?p1_end"]]
f1 --> v3
f1 --> v4
f1 --> v1
f1 --> v5
v6 --"p:P39"--> v3
v3 --"p:statement/P39"--> v7
a1 --"wikibase:timePrecision"--> c5
a1 --"wikibase:timeValue"--> v5
v3 --"p:qualifier/value/P582"--> a1
v7 --"p:direct/P279"--> c9
a2 --"p:direct/P31"--> c11
v7 --"p:direct/P1001"--> a2
v6 --"p:P39"--> v4
v4 --"p:statement/P39"--> v7
v4 --"p:qualifier/P580"--> v1
bind2[/"?p2_start - ?p1_end"/]
v1 --o bind2
v5 --o bind2
bind2 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end