query-c985367a70f1fbc30a00125ac712a16b
Locations of battles Locations of battles Localisation des batailles Locations of battles Locations of battles Locaties van gevechten Stridsplatser Locations of battles Locations of battles Locations of battles
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
#added before 2016-10
#defaultView:Map
SELECT ?label ?coord ?subj ?year
WHERE
{
?subj wdt:P31 wd:Q178561 .
?subj wdt:P625 ?coord .
OPTIONAL {?subj wdt:P580 ?d1}
OPTIONAL {?subj wdt:P585 ?d2}
OPTIONAL {?subj wdt:P582 ?d3}
BIND(IF(!BOUND(?d1),(IF(!BOUND(?d2),?d3,?d2)),?d1) as ?date)
BIND(YEAR(?date) as ?year)
?subj rdfs:label ?label filter (lang(?label) = "en")
}
Query found at
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/zh
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?coord"):::projected
v4("?d1")
v5("?d2")
v6("?d3")
v7("?date")
v1("?label"):::projected
v2("?subj"):::projected
v8("?year"):::projected
c3(["wd:Q178561"]):::iri
f0[["?label = 'en'"]]
f0 --> v1
v2 --"wdt:P31"--> c3
v2 --"wdt:P625"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P580".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P585".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P582".-> v6
end
bind1[/"if(not bound(?d1),if(not bound(?d2),?d3,?d2),?d1)"/]
v4 --o bind1
v5 --o bind1
v6 --o bind1
bind1 --as--o v7
bind2[/"year-from-dateTime(?date)"/]
v7 --o bind2
bind2 --as--o v8
v2 --"rdfs:label"--> v1