0

I want to get all military operations that are part of (P361) WW2, I don't get, e.g., Case Blue, because it is only a part of the Soviet German War but not part of WW2, but the Soviet German War itself is part of WW2. So what do I need to do to the statement to get also all "children" of all ww2 campaigns like Case Blue and ideally also the subsequent battles of those campaigns?

Query:

SELECT ?label WHERE {
  ?subj wdt:P361 wd:Q362.
  ?subj (wdt:P31/wdt:P279*) wd:Q831663.
  ?subj rdfs:label ?label.
  FILTER((LANG(?label)) = "en")
}

EDIT - I think I found an improvement, but not really sure if is correct and it also feels a bit like a "hack", especially the distinct.

SELECT DISTINCT ?label WHERE {
  ?campaign wdt:P361 wd:Q362.
  ?campaign (wdt:P31/wdt:P279*) wd:Q198.
  ?battle wdt:P361*/wdt:P279* ?campaign.
  ?battle rdfs:label ?label.
  FILTER((LANG(?label)) = "en")
}

Case Blue: https://www.wikidata.org/wiki/Q158287

German-Sovetic War: https://www.wikidata.org/wiki/Q189266

datorum
  • 47
  • 5
  • 1
    Why is it a hack? If you assume that "part of" is a transitive relation in your context, then property paths via `*` is indeed the correct way. – UninformedUser Mar 20 '17 at 19:53
  • 1
    I can't imagine why `DISTINCT` would make it a hack, either. – TallTed Mar 20 '17 at 20:22
  • guess I consider it a "hack", because it was more of an empirical/trial-and-error result than "yeah, I got it". – datorum Mar 22 '17 at 12:02

0 Answers0