query-a75188d077ca49ac1f3cdc902b8f3cd6

rq turtle/ttl

TODO

Use at

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#>
SELECT ?item ?itemLabel ?inst_subp_dc ?classLabel 
WHERE {
  # Subclasses or equivalent subproperty up to 1. order
  {
    bind (wd:Q11446 as ?class)
  } # 0. order subclasses
  union
  {
    _:sp1 wdt:P1647? wd:P279 . 
    _:sp1 wikibase:directClaim ?class_subp_dc . 
    ?class ?class_subp_dc wd:Q11446 . 
  } # 1. order subclasses
  #union
  #{
  #  _:sp2 wdt:P1647? wd:P279 . 
  #  _:sp2 wikibase:directClaim ?class_subp_dc . 
  #  _:c1 ?class_subp_dc wd:Q11446 . 
  #  ?class ?class_subp_dc _:c1 . 
  #} # 2. order subclasses 

  # Instance of or equivalent subproperty predicates
  _:sp3 wdt:P1647? wd:P31 .
  _:sp3 wikibase:directClaim ?inst_subp_dc .

  # Derived items
  ?item ?inst_subp_dc ?class .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?class") v2("?class_subp_dc") v3("?inst_subp_dc"):::projected v4("?item"):::projected a1((" ")) a2((" ")) c1(["wd:P279"]):::iri c7(["bd:serviceParam"]):::iri c5(["wd:P31"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal c4(["wd:Q11446"]):::iri 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; a1 --"wdt:P1647"--> c1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; end union1r <== or ==> union1l end a1 --"wikibase:directClaim"--> v2 v1 -->v2--> c4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; bind0[/"'wd:Q11446'"/] bind0 --as--o v1 end union0r <== or ==> union0l end subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; a2 --"wdt:P1647"--> c5 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; end union2r <== or ==> union2l end a2 --"wikibase:directClaim"--> v3 v4 -->v3--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end