-
Notifications
You must be signed in to change notification settings - Fork 17
Property paths
Kevin Livingston edited this page Nov 5, 2013
·
1 revision
With KR version 1.4.11 basic support for SPARQL 1.1 property paths was added to the pattern-based query language. As of writing this has been tested on sesame 2.6.8 and 2.6.10 in-memory triple stores. And only the * + and ? and sequential operators have been verified. More tests to come.
Standard SPARQL property path syntax is the following:
SPARQL clj definition
-------------------------------------------
uri symbol A URI or a prefixed name. A path of length one.
^elt (:inverse elt) Inverse path (object to subject).
(elt) A group path elt, brackets control precedence.
elt1 / elt2 (elt1 elt2 ...) A sequence path of elt1, followed by elt2
elt1 ^ elt2 Shorthand for elt1 / ^elt2, that is elt1 followed by the inverse of elt2.
elt1 | elt2 (:or elt1 elt2 ...) A alternative path of elt1, or elt2 (all possibilities are tried).
elt* [elt *] A path of zero or more occurrences of elt.
elt+ [elt +] A path of one or more occurrences of elt.
elt? [elt ?] A path of zero or one elt.
elt{n,m} [elt n m] A path between n and m occurrences of elt.
elt{n} [elt n] Exactly n occurrences of elt. A fixed length path.
elt{n,} [elt n nil] n or more occurrences of elt.
elt{,n} [elt nil n] Between 0 and n occurrences of elt.
(elt)
is implicit
(elt1 ^ elt2)
shorthand is unsupported use (elt1 (:inverse elt2))
examples:
[rdfs:subClassOf *]
([rdf:rest *] rdf:first)