Property Path

Created on Feb. 23, 2013, 12:33 p.m. by Hevok & updated by Hevok on May 2, 2013, 5:20 p.m.

With the Property Path one is able to navigate within the RDF Graph and to formulate Property Paths expression for matching on that Graph that would be otherwise very complicated.

For example one can define a Graph Pattern or a Property Graph of different Length. In the trivial case if the path length of the property path that connect Property with Property is 1, one has a basic Triple Pattern. On the other hand one can define possibilities, i.e. select things that fulfill either this or that conditions. One can even define Sequences of Properties, e.g. where one starts with resource x and follows foaf:knows and than again one follows the property foaf:knows and this resources that match the first Triple also match the next foaf:knows and the next foaf:name so one will have in the end People that are known to People that one knows. So one goes one step further in the graph and so what one had to do with several separate connected SPARQL Query can be done with a single one, the so called Property Graph. So one connects one property with another property and even more and so on to the Property Path greater or bigger than one.

One can also put in these Path Reverse Properties, where one reverses the direction of a Property, i.e. exchanges the subject on the Object.

In the end one can connect Sequences and reverse Properties, so one has inverse path sequences where one starts with a Resource and look at all things that are connected via a foaf:knows and then one is looking backwards, i.e. the reverse foaf:knows and look which people are known by which people that one knows and one filters this expression to exclude oneself. In such one gets a List of people who know people that are known by them and one follows as many foaf:knows as there are available.

If one does not know how long the graph will be one can define something like a Transitive Graph Pattern of arbitrary length. With the simple Plus Sing + one says that at least one foaf:knows or many foaf:knows. Thus, one can make a short matching expression that transverses the whole graph by the foaf:knows Property.

On the other hand one has also the possibility to negate a Property Graph and one says in the answer one wants only those results that do not contain Properties of certain types or connected Properties of this type.

SPARQL 1.1 gives a lot of more opportunity and things that can be computed with it.


Tags: query, coding, programming, paths
Categories: Tutorial
Parent: SPARQL 1.1

Update entry (Admin) | See changes

Comment on This Data Unit