Imagine I would like to query all descendants of Otto Bismarck until generation 3. How could I write the sparql code with regex? In this tutorial it says that we can use regex but I don't know how.
I tried to use "{3}":
SELECT ?descendant ?descendantLabel
WHERE
{
wd:Q8442 wdt:P40{3} ?descendant.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
However, this does not work. The output should be this: try here