query-eab50f973491b613bd8ac4ecce030f14

rq turtle/ttl

follows (P155) & followed by (P156) : hundredsYep,

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
select distinct ?item ?item2 where {
?item wdt:P31 wd:Q482994 ;
      (wdt:P155|wdt:P156) ?item2 .
{{?item2 wdt:P31 wd:Q5.} union {?item2 wdt:P31/wdt:P279* wd:Q215380 .}}
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?item2"):::projected a1((" ")) c5(["wd:Q5"]):::iri c2(["wd:Q482994"]):::iri c7(["wd:Q215380"]):::iri v1 --"wdt:P31"--> c2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P156"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P155"--> v2 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c7 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> c5 end union1r <== or ==> union1l end