query-a047f8672e624689398a10ca454deb9a

rq turtle/ttl

Nodes

Use at

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#>
SELECT DISTINCT (?node AS ?Id) ?Label ?Weight
WHERE 
{
  { 
    ?node wdt:P31 wd:Q98270496 .
  } UNION { 
    ?p wdt:P31 wd:Q98270496 .
    ?p wdt:P101 ?node . 
  }
  FILTER(?node != wd:Q96678462)
  ?node rdfs:label ?Label .
  OPTIONAL { FILTER (EXISTS { ?node wdt:P31 wd:Q98270496 })
      BIND("2" AS ?Weight)
  } 
  OPTIONAL { FILTER (NOT EXISTS { ?node wdt:P31 wd:Q98270496 })
      BIND("1" AS ?Weight)
  } 
  FILTER (lang(?Label) = 'de')
} ORDER BY ASC(?nodeLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?Id") v2("?Label"):::projected v6("?Weight"):::projected v3("?node"):::projected v1("?nodeLabel") v4("?p") c3(["wd:Q98270496"]):::iri f0[["?Label = 'de'"]] f0 --> v2 f1[["?node != 'wd:Q96678462'"]] f1 --> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P31"--> c3 v4 --"wdt:P101"--> v3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P31"--> c3 end union0r <== or ==> union0l end v3 --"rdfs:label"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; bind2[/"'2'"/] bind2 --as--o v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; bind3[/"'1'"/] bind3 --as--o v6 end bind4[/"?node"/] v3 --o bind4 bind4 --as--o v6