An implementation of SPARQL Property Paths[1] for grafter
/rdf4j
.
[1] https://www.w3.org/TR/sparql11-query/#propertypaths
iri | PredicatePath | An IRI. A path of length one.
^elt | InversePath | Inverse path (object to subject).
elt1 / elt2 | SequencePath | A sequence path of elt1 followed by elt2.
elt1 | elt2 | AlternativePath | A alternative path of elt1 or elt2 (all possibilities are tried).
elt* | ZeroOrMorePath | A path that connects the subject and object of the path by zero or more matches of elt.
elt+ | OneOrMorePath | A path that connects the subject and object of the path by one or more matches of elt.
elt? | ZeroOrOnePath | A path that connects the subject and object of the path by zero or one matches of elt.
!expression | NegatedPropertySet | Negated property set. An IRI which is not one of expression
. !iri is short for !(iri).
(elt) | | A group path elt, brackets control precedence.A zero occurrence of a path element always matches.
The order of IRIs, and reverse IRIs, in a negated property set is not significant and they can occur in a mixed order.
The precedence of the syntax forms is, from highest to lowest:
Precedence is left-to-right within groups.
An implementation of SPARQL Property Paths[1] for `grafter`/`rdf4j`. [1] https://www.w3.org/TR/sparql11-query/#propertypaths Syntax Form | Property Path Expression Name | Matches ===================================================== iri | PredicatePath | An IRI. A path of length one. ^elt | InversePath | Inverse path (object to subject). elt1 / elt2 | SequencePath | A sequence path of elt1 followed by elt2. elt1 | elt2 | AlternativePath | A alternative path of elt1 or elt2 (all possibilities are tried). elt* | ZeroOrMorePath | A path that connects the subject and object of the path by zero or more matches of elt. elt+ | OneOrMorePath | A path that connects the subject and object of the path by one or more matches of elt. elt? | ZeroOrOnePath | A path that connects the subject and object of the path by zero or one matches of elt. !expression | NegatedPropertySet | Negated property set. An IRI which is not one of `expression`. !iri is short for !(iri). (elt) | | A group path elt, brackets control precedence.A zero occurrence of a path element always matches. The order of IRIs, and reverse IRIs, in a negated property set is not significant and they can occur in a mixed order. The precedence of the syntax forms is, from highest to lowest: * IRI, prefixed names * Negated property sets * Groups * Unary operators *, ? and + * Unary ^ inverse links * Binary operator / * Binary operator | Precedence is left-to-right within groups.
(! x)
Translates to !x : NegatedPropertySet
Translates to !x : NegatedPropertySet
(* x)
A path of zero or more occurrences of x
A path of zero or more occurrences of x
(+ x)
A path of one or more occurrences of x
A path of one or more occurrences of x
(/ x y & zs)
A sequence path of x, followed by y, followed by zs
A sequence path of x, followed by y, followed by zs
(path & path)
Build a path with syntax similar to SPARQL property path syntax.
iri | iri | PredicatePath ^elt | -elt - or - (- elt) | InversePath elt1 / elt2 | elt1 / elt2 | SequencePath elt1 | elt2 | elt1 | elt2 | AlternativePath elt* | elt* - or - (elt *) | ZeroOrMorePath elt+ | elt+ - or - (elt +) | OneOrMorePath elt? | elt? - or - (elt ?) | ZeroOrOnePath !expression | !expression | NegatedPropertySet (elt) | (elt) | Group
E.G.,
(path -a / b* / !c | d? | !(java.net.URI. (str "http://www.grafter.org/example#" p)))
Where bindings a, b, c, d are URIs, and binding p is a String.
Build a path with syntax similar to SPARQL property path syntax. SPARQL Form | Clojure Form | Expression Name ==================================================== iri | iri | PredicatePath ^elt | -elt - or - (- elt) | InversePath elt1 / elt2 | elt1 / elt2 | SequencePath elt1 | elt2 | elt1 | elt2 | AlternativePath elt* | elt* - or - (elt *) | ZeroOrMorePath elt+ | elt+ - or - (elt +) | OneOrMorePath elt? | elt? - or - (elt ?) | ZeroOrOnePath !expression | !expression | NegatedPropertySet (elt) | (elt) | Group E.G., (path -a / b* / !c | d? | !(java.net.URI. (str "http://www.grafter.org/example#" p))) Where bindings a, b, c, d are URIs, and binding p is a String.
(| x y & zs)
A alternative path of x, or y, or zs (all possibilities are tried).
A alternative path of x, or y, or zs (all possibilities are tried).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close