query-5fe5aa4875a6347f7efcd02d234d9b38
...only those that are companies (show as tree)!
Use at
- https://query.wikidata.org/sparql
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 DISTINCT ?item ?itemLabel ?itemPic ?linkTo ?linkToLabel ?linkToPic
{
?item wdt:P463 wd:Q105757481 .
?item ^wdt:P463 ?linkTo .
{?linkTo wdt:P31/wdt:P279* wd:Q4830453 } UNION {?linkTo wdt:P31/wdt:P279* wd:Q6881511}
FILTER NOT EXISTS {?linkTo wdt:P31 wd:Q5}
FILTER NOT EXISTS {?linkTo wdt:P31/wdt:P279* wd:Q2085381}
OPTIONAL { ?item wdt:P154 ?itemPic }
OPTIONAL { ?linkTo wdt:P154 ?linkToPic }
SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en" }
} ORDER BY ASC(?itemLabel) ASC(?linkToLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?item"):::projected
v1("?itemLabel"):::projected
v5("?itemPic"):::projected
v3("?linkTo"):::projected
v2("?linkToLabel"):::projected
v6("?linkToPic"):::projected
a2((" "))
a3((" "))
a1((" "))
c6(["wd:Q105757481"]):::iri
c3(["wd:Q2085381"]):::iri
c7(["wd:Q4830453"]):::iri
c8(["wd:Q6881511"]):::iri
c11(["bd:serviceParam"]):::iri
c4(["wd:Q5"]):::iri
c13(["de,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0a1
e0a1 --"wdt:P279"--> e0c3
e0v1("?linkTo"):::projected
e0a1((" ")):::projected
e0c3(["wd:Q2085381"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v3
f0 --> c1
f0 --> a1
f0 --> c2
f0 --> c3
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
f1[["not "]]
subgraph f1e1["Exists Clause"]
e1v1 --"wdt:P31"--> e1c2
e1v1("?linkTo"):::projected
e1c2(["wd:Q5"]):::iri
end
f1--EXISTS--> f1e1
f1 --> v3
f1 --> c1
f1 --> c4
v3 --"wdt:P31"--> c4
v4 --"wdt:P463"--> c6
v3 --"wdt:P463"--> v4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> a3
a3 --"wdt:P279"--> c8
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c7
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P154".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P154".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end