Cray Graph Engine (CGE) Property Path Support

Information about the CGE property path feature.

CGE does not natively support all the SPARQL 1.1 property paths features, however it does support certain types of property paths.
Note: CGE’s property path support should be used with care. This support is disabled by default and must be explicitly enabled by the user. Contact Cray Support for additional information.
  • Simple Property Paths - By default, simple property paths that are equivalent to simple fixed length Basic Graph Patterns (BGPs) are supported. This means that property paths consisting of only the sequence / and inverse ^ operators are permitted, since these can be written out as a simple BGP using blank node variables. For example:
    SELECT * WHERE
    {
    ?s <urn:a>/<urn:b> ?o
    }
    Can be rewritten as follows:
    SELECT * WHERE
    {
    ?s <urn:a> _:p0 .
    _:p0 <urn:b> ?o .
    }
    
  • Complex Property Paths Emulation - Some more complex property paths can be emulated through query rewriting, which expands the property paths into an equivalent query form.
    Note: It is important to be aware that this support is only emulation, and may not provide complete answers that a SPARQL engine with native property path support would produce.
The following table details the additional operators, which may be emulated and the restrictions and limitations on that emulation.
Table 1. Additional Operators that May be Emulated
OperatorExampleDescriptionAdditional Notes
*
?s <urn:a>*
?o
Finds paths of zero or more steps between two nodes in the graph
  • Path to which the * operator applied must be either a predicate or inverse predicate
  • Evaluating the zero length portion of the path may be very expensive particularly if both variables are unbound
  • Paths are evaluated only up to a maximum length (default 5) which may be user configured on a per-query basis
  • Expands into a UNION that looks for paths of each length up to the specified maximum
+
?s <urn:a>+
?o
Finds paths of one or more steps between two nodes in the graph
  • Path to which the + operator applied must be either a predicate or inverse predicate
  • Paths are evaluated only up to a maximum length (default being 5) which may be user configured on a per-query basis
  • Expands into a UNION that looks for paths of each length up to the specified maximum
?
?s <urn:a>?
?o
Finds paths of zero or one steps between two nodes in the graph
  • Path to which the ? operator applied must be either a predicate or inverse predicate
  • Evaluating the zero length portion of the path may be very expensive particularly if both variables are unbound
  • Expands into a UNION that looks for paths of length zero and one
|
?s <urn:a> |
<urn:b> ?o
Finds paths between two nodes that use any of the alternative paths given
  • Paths to which the | operator applied may themselves be complex but only paths that are predicates or inverse predicates are guaranteed to expand into a valid query
  • Expands into a UNION that considers each alternative, where the alternative is itself a property path it may be further expanded as necessary
! (property)
?s ! <urn:a> 
?o
Find paths between two nodes that do not pass through a given predicate
  • The negated property set operator only applies to predicates or inverse predicates and thus can always be expanded
  • Expands into a MINUS that considers all paths and then eliminates the undesirable paths

Enabling Emulation

CGE also provides the option to change the maximum length of paths (for the expansion of the * and + operators), as shown in the following example:
% cge-cli query --opt-on optPathExpand --path-expansion 3 paths.rq
The above query would run the query with property path expansion enabled and a maximum path length of 3.
Note: This value can be set to any desired value, however it is important to note that the higher this value is set to, the more complex the query that will be generated. This will result in slower performance because the database server will need to search for longer paths. Therefore, it is recommended to set the length of paths to the minimum possible value for optimal emulation performance. It is also important to note that setting a maximum length of zero or less will result in disabling the expansion.