query-6d72fac4b246e42dbc1691f47915b087

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)

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#>
#defaultView:Tree
SELECT ?top ?topLabel ?grandparent ?grandparentLabel ?parent ?parentLabel ?child ?childLabel ?grandchild ?grandchildLabel ?property ?propertyLabel
WHERE
{
  BIND(wd:Q27525351 AS ?top).
  {
    ?property wdt:P31 ?top.
  } UNION {
    ?grandparent wdt:P279 ?top.
    ?property wdt:P31 ?grandparent.
  } UNION {
    ?grandparent wdt:P279 ?top.
    ?parent wdt:P279 ?grandparent.
    ?property wdt:P31 ?parent.
  } UNION {
    ?grandparent wdt:P279 ?top.
    ?parent wdt:P279 ?grandparent.
    ?child wdt:P279 ?parent.
    ?property wdt:P31 ?child.
  } UNION {
    ?grandparent wdt:P279 ?top.
    ?parent wdt:P279 ?grandparent.
    ?child wdt:P279 ?parent.
    ?grandchild wdt:P279 ?child.
    ?property wdt:P31 ?grandchild.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr". } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?child"):::projected v6("?grandchild"):::projected v3("?grandparent"):::projected v4("?parent"):::projected v2("?property"):::projected v1("?top"):::projected c4(["bd:serviceParam"]):::iri c6(["#91;AUTO_LANGUAGE#93;,en,fr"]):::literal bind0[/"'wd:Q27525351'"/] bind0 --as--o v1 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; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> v1 v4 --"wdt:P279"--> v3 v5 --"wdt:P279"--> v4 v6 --"wdt:P279"--> v5 v2 --"wdt:P31"--> v6 end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> v1 v4 --"wdt:P279"--> v3 v5 --"wdt:P279"--> v4 v2 --"wdt:P31"--> v5 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> v1 v4 --"wdt:P279"--> v3 v2 --"wdt:P31"--> v4 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> v1 v2 --"wdt:P31"--> v3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> v1 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end