According to wikidata, a battle is a subclass of a military operation. Yet, when I query for all instances of military operations I get 699 results, whereas for all battles I get 7399.
Query for Military Operations
SELECT ?label WHERE {
?subj wdt:P31* wd:Q645883.
?subj rdfs:label ?label.
FILTER((LANG(?label)) = "en")
}
Query for Battles
SELECT ?label WHERE {
?subj wdt:P31* wd:Q178561.
?subj rdfs:label ?label.
FILTER((LANG(?label)) = "en")
}
Military Operation: https://www.wikidata.org/wiki/Q645883
Because your SPARQL query, in particular, the property path, is wrong.
Types are connected by subClassOf (wdt:P279
), but you're asking for the closure of instance-of
relations when using wdt:P31*
It has to be wdt:P31/wdt:P279*
See https://www.wikidata.org/wiki/Property:P279 and https://www.wikidata.org/wiki/Property:P31 for the difference.