This code gives the descendants of Genghis Kahn up to a certain depth (as a graph which can be changed to a table) :
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#defaultView:Graph
PREFIX gas: <http://www.bigdata.com/rdf/gas#>
SELECT DISTINCT ?depth ?item ?itemLabel ?pic #?linkTo
WHERE {
SERVICE gas:service {
gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.SSSP" ;
gas:in wd:Q720 ;
gas:traversalDirection "Forward" ;
gas:out ?item ;
gas:out1 ?depth ;
gas:maxIterations 4 ;
gas:linkType wdt:P40 .
}
# OPTIONAL { ?item wdt:P40 ?linkTo }
OPTIONAL { ?item wdt:P18 ?pic }
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY ?depth
Is it possible to modify this code in order to obtain the shortest path between Genghis Khan and a particular descendant (e.g. Baltu, Q7070636), including the persons in between and the kinds of relationship (linkType) between them? Generally: How to obtain the shortest path between two certain nodes and as the result a table with the nodes between these nodes and the kinds of relationship between all these nodes (limited to a certain depth)?