query-317771cc2303162c455cb467475c93f2
Battles between 476 and 1492 with a date but no place SELECT DISTINCT ?item ?itemLabel ?placeLabel ?date ?coords WHERE { ?item wdt:P31/wdt:P279* wd:Q178561 . # A battle or a subclass of it MINUS { ?item wdt:P31 wd:Q26913948 . } # but not a legendary one
# OPTIONAL { ?item (wdt:P585|wdt:P580|wdt:P582) ?date . } OPTIONAL { ?item wdt:P585 ?basicDate . } OPTIONAL { ?item wdt:P580 ?startDate . } OPTIONAL { ?item wdt:P582 ?endDate . } BIND(COALESCE(?basicDate, ?startDate, ?endDate) AS ?date) FILTER(BOUND(?date))
FILTER (YEAR(?date) >= 476) . FILTER (YEAR(?date) <= 1492) .
FILTER NOT EXISTS { ?item wdt:P276 ?place . }
OPTIONAL { ?item wdt:P625 ?coords . } # OPTIONAL { ?place wdt:P625 ?coordsPlace . } # BIND(COALESCE(?coordsItem, ?coordsPlace) AS ?coords)
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" } } ORDER BY ?date
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 bd: <http://www.bigdata.com/rdf#>
# Battles between 476 and 1492 with a date but no place
SELECT DISTINCT ?item ?itemLabel ?placeLabel ?date ?coords WHERE {
?item wdt:P31/wdt:P279* wd:Q178561 . # A battle or a subclass of it
MINUS { ?item wdt:P31 wd:Q26913948 . } # but not a legendary one
# OPTIONAL { ?item (wdt:P585|wdt:P580|wdt:P582) ?date . }
OPTIONAL { ?item wdt:P585 ?basicDate . }
OPTIONAL { ?item wdt:P580 ?startDate . }
OPTIONAL { ?item wdt:P582 ?endDate . }
BIND(COALESCE(?basicDate, ?startDate, ?endDate) AS ?date)
FILTER(BOUND(?date))
FILTER (YEAR(?date) >= 476) . FILTER (YEAR(?date) <= 1492) .
FILTER NOT EXISTS { ?item wdt:P276 ?place . }
OPTIONAL { ?item wdt:P625 ?coords . }
# OPTIONAL { ?place wdt:P625 ?coordsPlace . }
# BIND(COALESCE(?coordsItem, ?coordsPlace) AS ?coords)
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" }
} ORDER BY ?date