query-7b0fceac754a242f5ccc0c9df838859d
All battles with time and date
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#>
#defaultView:Map
SELECT DISTINCT
?item
(SAMPLE(?item_label) AS ?battle)
(SAMPLE(?place_label) AS ?place_label)
(SAMPLE(?partOf_label) AS ?partOf_label)
(SAMPLE(?year) AS ?year)
(SAMPLE(?image) AS ?image)
(SAMPLE(?layer) AS ?layer)
(SAMPLE(?coords) AS ?coords)
(SAMPLE(?rgb) AS ?rgb)
WHERE {
{
?item wdt:P31/wdt:P279* wd:Q178561 .
} UNION {
?item wdt:P31/wdt:P279* wd:Q188055 .
}
OPTIONAL {
?item rdfs:label ?item_label .
FILTER(LANG(?item_label) IN ('fr', 'en')) .
}
OPTIONAL {
?item wdt:P361 ?partOf .
?partOf rdfs:label ?partOf_label .
FILTER(LANG(?partOf_label) IN ('fr', 'en')) .
}
OPTIONAL { ?item wdt:P18 ?image . }
# Place
?item wdt:P276 ?place .
OPTIONAL {
?place rdfs:label ?place_label .
FILTER(LANG(?place_label) IN ('fr', 'en')) .
}
# Coords
OPTIONAL { ?item wdt:P625 ?coordsItem . }
OPTIONAL { ?place wdt:P625 ?coordsPlace . }
BIND(COALESCE(?coordsItem, ?coordsPlace) AS ?coords)
# Date
?item (wdt:P585|wdt:P580|wdt:P582) ?date .
BIND(YEAR(?date) AS ?year) .
# Layer
VALUES (?layer ?min ?max ?rgb) {
("Prehistory" -100000 -3500 "0078BF")
("Ancien History -3500 → 500" -3500 500 "DDD700")
("Middle Ages 500 → 1500" -500 1500 "5BD500")
("Early Modern Period 1500 → 1750" 1500 1750 "00CE23")
("Mid Modern Period 1750 → 1914" 1750 1914 "00C699")
("Contemporary Period 1914 → present" 1914 3500 "0078BF")
}
FILTER (?min <= ?year && ?year < ?max)
} GROUP BY ?item ORDER BY ?year ?battle
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v18("?battle")
v18("?coords"):::projected
v12("?coordsItem")
v13("?coordsPlace")
v15("?date")
v18("?image"):::projected
v8("?item"):::projected
v7("?item_label"):::projected
v18("?layer"):::projected
v17("?max")
v17("?min")
v9("?partOf")
v18("?partOf_label"):::projected
v11("?place")
v18("?place_label"):::projected
v18("?rgb"):::projected
v18("?year"):::projected
a1((" "))
a2((" "))
c6(["wd:Q188055"]):::iri
c5(["wd:Q178561"]):::iri
f0[["?min <= ?year?year < ?max"]]
f0 --> v17
f0 --> v18
f0 --> v17
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v8 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c6
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v8 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v8 -."rdfs:label".-> v7
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v8 -."wdt:P361".-> v9
v9 --"rdfs:label"--> v18
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v8 -."wdt:P18".-> v18
end
v8 --"wdt:P276"--> v11
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v11 -."rdfs:label".-> v18
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v8 -."wdt:P625".-> v12
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v11 -."wdt:P625".-> v13
end
bind1[/"?coordsItem?coordsPlace"/]
v12 --o bind1
v13 --o bind1
bind1 --as--o v18
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v8 --"wdt:P582"--> v15
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v8 --"wdt:P580"--> v15
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v8 --"wdt:P585"--> v15
end
union1r <== or ==> union1l
end
bind2[/"year-from-dateTime(?date)"/]
v15 --o bind2
bind2 --as--o v18
bind3[/VALUES ?layer ?max ?min ?rgb/]
bind3-->v18
bind3-->v17
bind3-->v17
bind3-->v18
bind30(["Prehistory"])
bind30 --> bind3
bind31(["-100000^^xsd:integer"])
bind31 --> bind3
bind32(["-3500^^xsd:integer"])
bind32 --> bind3
bind33(["0078BF"])
bind33 --> bind3
bind34(["Ancien History -3500 → 500"])
bind34 --> bind3
bind35(["-3500^^xsd:integer"])
bind35 --> bind3
bind36(["500^^xsd:integer"])
bind36 --> bind3
bind37(["DDD700"])
bind37 --> bind3
bind38(["Middle Ages 500 → 1500"])
bind38 --> bind3
bind39(["-500^^xsd:integer"])
bind39 --> bind3
bind310(["1500^^xsd:integer"])
bind310 --> bind3
bind311(["5BD500"])
bind311 --> bind3
bind312(["Early Modern Period 1500 → 1750"])
bind312 --> bind3
bind313(["1500^^xsd:integer"])
bind313 --> bind3
bind314(["1750^^xsd:integer"])
bind314 --> bind3
bind315(["00CE23"])
bind315 --> bind3
bind316(["Mid Modern Period 1750 → 1914"])
bind316 --> bind3
bind317(["1750^^xsd:integer"])
bind317 --> bind3
bind318(["1914^^xsd:integer"])
bind318 --> bind3
bind319(["00C699"])
bind319 --> bind3
bind320(["Contemporary Period 1914 → present"])
bind320 --> bind3
bind321(["1914^^xsd:integer"])
bind321 --> bind3
bind322(["3500^^xsd:integer"])
bind322 --> bind3
bind323(["0078BF"])
bind323 --> bind3
bind12[/"sample(?item_label)"/]
v7 --o bind12
bind12 --as--o v18
bind13[/"sample(?place_label)"/]
v18 --o bind13
bind13 --as--o v18
bind14[/"sample(?partOf_label)"/]
v18 --o bind14
bind14 --as--o v18
bind15[/"sample(?year)"/]
v18 --o bind15
bind15 --as--o v18
bind16[/"sample(?image)"/]
v18 --o bind16
bind16 --as--o v18
bind17[/"sample(?layer)"/]
v18 --o bind17
bind17 --as--o v18
bind18[/"sample(?coords)"/]
v18 --o bind18
bind18 --as--o v18
bind19[/"sample(?rgb)"/]
v18 --o bind19
bind19 --as--o v18