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.
| Operator | Example | Description | Additional Notes |
|---|---|---|---|
*
|
?s <urn:a>* ?o | Finds paths of zero or more steps between two nodes in the graph |
|
+ |
?s <urn:a>+ ?o | Finds paths of one or more steps between two nodes in the graph |
|
? |
?s <urn:a>? ?o | Finds paths of zero or one steps between two nodes in the graph |
|
| |
?s <urn:a> | <urn:b> ?o | Finds paths between two nodes that use any of the alternative paths given |
|
! (property) |
?s ! <urn:a> ?o | Find paths between two nodes that do not pass through a given predicate |
|
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.rqThe 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.