query-36bec9d2bef564f9ebbf9ae1c63f576a
Things semantically related to a given topic
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?related ?relatedLabel ?relatedDescription WHERE {
VALUES ?target {wd:Q42}
{ ?target ?prop ?related } UNION { ?related ?prop ?target }
filter (CONTAINS(STR(?related),'/entity/Q') ).
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} ORDER BY UCASE(?relatedLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?prop")
v2("?related"):::projected
v1("?relatedLabel"):::projected
v3("?target")
c3(["bd:serviceParam"]):::iri
c5(["en"]):::literal
f0[["contains(str(?related),'/entity/Q')"]]
f0 --> v2
bind1[/VALUES ?target/]
bind1-->v3
bind10(["wd:Q42"])
bind10 --> bind1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 -->v4--> v3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 -->v4--> v2
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end