query-da391c7d38f4138173a38bc335a182b3

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)part of the series (P179)

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 ?item ?itemLabel ?series ?seriesLabel (GROUP_CONCAT(DISTINCT ?type; SEPARATOR = ", ") AS ?types) WHERE {
  ?item (wdt:P31/(wdt:P279*)) wd:Q7889;
    wdt:P179 ?series.
  OPTIONAL {
    ?series wdt:P31 ?_type.
    ?_type rdfs:label ?type.
    FILTER((LANG(?type)) = "en")
  }
  FILTER(NOT EXISTS { ?series wdt:P31/wdt:P279* wd:Q7058673. })
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel ?series ?seriesLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?_type") v3("?item"):::projected v1("?series"):::projected v2("?type"):::projected v5("?types") a2((" ")) a1((" ")) c3(["wd:Q7058673"]):::iri c9(["bd:serviceParam"]):::iri c5(["wd:Q7889"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0a1 e0a1 --"wdt:P279"--> e0c3 e0v1("?series"):::projected e0a1((" ")):::projected e0c3(["wd:Q7058673"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 f0 --> c2 f0 --> c3 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v3 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c5 v3 --"wdt:P179"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> v4 v4 --"rdfs:label"--> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind2[/"?type"/] v2 --o bind2 bind2 --as--o v5