http://franz.com/ns/allegrograph/4.11/sna/depthFirstSearch
Compute Depth-first Search paths.
This magic property can be used in several ways:
The first is:
?start sna:depthFirstSearch ( ex:namedGenerator ?end )
?start sna:depthFirstSearch ( ex:namedGenerator ?end ?depth )
which will succeed when there is a path between ?start
and ?end
(both of which must be bound) using generator ex:namedGenerator
and the optional ?depth
to limit the search.
The second is
(?start ?node) sna:depthFirstSearch ( ex:namedGenerator ?end )
(?start ?node) sna:depthFirstSearch ( ex:namedGenerator ?end ?depth )
which is like the above but also returns one binding to ?node
for each node along the path between ?start
and ?end
. Note that although they will tend to appear in sequence there is no guaranteed order between the bindings. The third form provides a way to capture the order in the path. It is:
(?start ?node ?nodeId) sna:depthFirstSearch ( ex:namedGenerator ?end )
(?start ?node ?nodeId) sna:depthFirstSearch ( ex:namedGenerator ?end ?depth )
which is like the above but also returns one binding to ?node
for each node along the path and a sequential numeric binding to ?nodeId
that represents the path element.
The final form is:
(?start ?node ?nodeId ?pathId) sna:depthFirstSearch ( ex:namedGenerator ?end )
(?start ?node ?nodeId ?pathId) sna:depthFirstSearch ( ex:namedGenerator ?end ?depth )
It is like the above but also binds ?pathId
to a sequential count of the number of the path. I.e., the first path will have ?pathId
bound to 0; the second to 1 and so on.
Notes
The following namespace abbreviations are used:
- fti - <http://franz.com/ns/allegrograph/2.2/textindex/>
- geo - <http://franz.com/ns/allegrograph/3.0/geospatial/>
- geofn - <http://franz.com/ns/allegrograph/3.0/geospatial/fn/>
- nd - <http://franz.com/ns/allegrograph/5.0/geo/nd#>
- ndfn - <http://franz.com/ns/allegrograph/5.0/geo/nd/fn#>
- sna - <http://franz.com/ns/allegrograph/4.11/sna/>
The SPARQL magic properties reference has additional information on using AllegroGraph magic properties and functions.