query-62fa2891724896454d5f64871de022c4
Blank nodes Relative clauses. Properties of the object.children. grandSuppose we’re not actually interested in Bach’s children, but in his , which points from parent to child and is gender-independent. Possible solution below: (P40)child For this task we would use
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#>
SELECT ?grandChild ?grandChildLabel
WHERE
{
wd:Q1339 wdt:P40 ?child. # Bach has a child ?child.
?child wdt:P40 ?grandChild. # ?child has a child ?grandChild.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?child")
v2("?grandChild"):::projected
c1(["wd:Q1339"]):::iri
c4(["bd:serviceParam"]):::iri
c6(["en"]):::literal
c1 --"wdt:P40"--> v1
v1 --"wdt:P40"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end