All Paths
The All Paths algorithm finds all of the paths that exist between a source node and destination node in a graph.
All Paths Syntax
Graph algorithms are accessed from an internal SPARQL service endpoint. To incorporate the All Paths algorithm in a query, include a SERVICE statement in the WHERE clause. The service call specifies the name of the algorithm and defines the required and optional property values for that algorithm.
Use the following syntax to find all of the paths between two nodes in a graph. The table below describes each property.
SERVICE <csi:all_paths> { [] <csi:binding-vertex> ?vertex_variable_name ; <csi:binding-edge> ?edge_variable_name ; <csi:binding-successor> ?successor_variable_name ; <csi:source> <source_node_uri> ; <csi:destination> <destination_node_uri> ; [ <csi:graph> <graph_uri> ; ] [ <csi:edge-label> "<edge_uri>" ; ] [ <csi:binding-path-index> ?path_index_variable_name ; ] [ <csi:binding-path> ?path_variable_name ; ] [ <csi:min-length> min_length_number ; ] [ <csi:max-length> max_length_number ; ] [ <csi:undirected> undirected_boolean_value ; ] [ <csi:binding-orientation> ?orientation_variable_name . ] }
Property | Description | Range & Default Value |
---|---|---|
<csi:binding-vertex> | Required property that defines the name to use for the result column that lists the nodes that are reachable by the source node. | Range: Must be a variable name Default: none |
<csi:binding-edge> | Required property that defines the name to use for the result column that lists the edges that exist between the nodes. | Range: Must be a variable name Default: none |
<csi:binding-successor> | Required property that defines the name to use for the result column that lists the destination nodes. | Range: Must be a variable name Default: none |
<csi:source> | Required property that specifies the URI of the source node. | Range: Must be a URI Default: none |
<csi:destination> | Required property that specifies the URI for the destination node. | Range: Must be a URI Default: none |
<csi:graph> | Optional property that specifies the graph to query. | Range: Must be a URI Default: none |
<csi:edge-label> | Optional property that further defines the path to operate on. This property accepts complex path specifications such as W3C Property Paths. When specifying edge URIs, prefix notation is not supported. Include the full URI. | Range: Must be a string Default: none |
<csi:binding-path-index> | Optional property that defines the name to use for the result column that lists the unique identifiers for the edges found in the path. The identifier represents the order for edges. | Range: Must be a variable name Default: none |
<csi:binding-path> | Optional property that defines the name to use for the result column that lists the unique identifiers for the paths that are found. | Range: Must be a variable name Default: none |
<csi:min-length> | Optional property that specifies the minimum number of paths to evaluate. | Range: Must in an integer Default: none |
<csi:max-length> | Optional property that specifies the maximum number of paths to evaluate. | Range: Must in an integer Default: unlimited |
<csi:undirected> | Optional property that specifies whether to treat edges as undirected. When true, the algorithm assumes that paths can be traversed in both directions. | Range: true or false Default: false |
<csi:binding-orientation> | Optional property to be used in conjunction with csi:undirected. If csi:undirected is true, you can include this property to add a result column that lists the orientation of each path. In the results, csi:binding-orientation returns t (true) when the direction of the edge goes from the source node to the successor. csi:binding-orientation returns f (false) when the direction of the edge goes from the successor to the source node. | Range: Must be a variable name Default: none |