query-6d4980a17eba0be861ccb219ac0b5bb8
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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item1 ?item1Label ?nation1Label ?item2 ?item2Label ?nation2Label ?year ?placeLabel {
?item1 wdt:P1412 wd:Q143;
p:P26 ?statement .
?statement ps:P26 ?item2 .
?item2 wdt:P1412 wd:Q143 .
FILTER( STR( ?item1 ) < STR( ?item2 ) ) .
OPTIONAL {
?statement pq:P580 ?date .
BIND( YEAR( ?date ) AS ?year ) .
} .
OPTIONAL { ?statement pq:P2842 ?place } .
OPTIONAL { ?item1 wdt:P27 ?nation1 } .
OPTIONAL { ?item2 wdt:P27 ?nation2 } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "eo,en" } .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?date")
v1("?item1"):::projected
v2("?item2"):::projected
v7("?nation1")
v8("?nation2")
v6("?place")
v3("?statement")
v5("?year"):::projected
c9(["bd:serviceParam"]):::iri
c11(["eo,en"]):::literal
c2(["wd:Q143"]):::iri
f0[["str(?item1) < str(?item2)"]]
f0 --> v1
f0 --> v2
v1 --"p:direct/P1412"--> c2
v1 --"p:P26"--> v3
v3 --"p:statement/P26"--> v2
v2 --"p:direct/P1412"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v4
bind1[/"year-from-dateTime(?date)"/]
v4 --o bind1
bind1 --as--o v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P2842".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P27".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P27".-> v8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end