query-e2b1b677e8cb01e8d0013aca7d9f2b11

rq turtle/ttl

(P355)has subsidiary (Q152081)concentration camp (Q328468)Nazi concentration camp

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?camp ?campLabel (GROUP_CONCAT(DISTINCT ?instance_ofLabel ; SEPARATOR=", ") AS ?type)
WHERE 
{
  {
    ?camp wdt:P31 ?instance_of.
    ?instance_of wdt:P279* wd:Q328468. # Nazi concentration camp
  }
  UNION
  {
    ?camp wdt:P31 ?instance_of.
    ?instance_of wdt:P279* wd:Q1719244. # Subcamp
  }
  UNION
  {
    ?mother_camp wdt:P31 ?mc_instance_of.
    ?mc_instance_of wdt:P279* wd:Q328468. # Nazi concentration camp
    ?mother_camp wdt:P355 ?camp. # camp is a subsidiary of mother_camp 
    ?camp wdt:P31 ?instance_of.
  }
  SERVICE wikibase:label
  {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de". 
    ?camp rdfs:label ?campLabel.
    ?instance_of rdfs:label ?instance_ofLabel.
  }
}
GROUP BY ?camp ?campLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?camp"):::projected v5("?campLabel"):::projected v2("?instance_of") v6("?instance_ofLabel"):::projected v4("?mc_instance_of") v3("?mother_camp") v7("?type") c7(["bd:serviceParam"]):::iri c4(["wd:Q1719244"]):::iri c3(["wd:Q328468"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en,de"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P31"--> v4 v4 --"wdt:P279"--> c3 v3 --"wdt:P355"--> v1 v1 --"wdt:P31"--> v2 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> v2 v2 --"wdt:P279"--> c4 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> v2 v2 --"wdt:P279"--> c3 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 v1 --"rdfs:label"--> v5 v2 --"rdfs:label"--> v6 end bind1[/"?instance_ofLabel"/] v6 --o bind1 bind1 --as--o v7