I recently wrote about trying SPARQL 1.1 new query features with ARQ, and one thing I briefly tried was the new property paths feature. At the time, the query spec only had a placeholder for property paths, but the new version of it released yesterday has a detailed section on property paths with plenty of examples.

I had seen the separate document where this material was first drafted and tried out its examples, (except for the “Subproperty” and “Elements in an RDF collection” ones) and they all worked fine with ARQ 2.8.5. If you want to try themselves, this zip file has the sample data file that I mocked up and the 12 query files. (Thanks to Andy Seaborne for helping me to straighten out my data and some of my tests.)

They gave me more and more ideas for interesting queries that I can do with very little SPARQL codeā€”for example, how to get a subtree of a hierarchy, or how to find nodes that have the same connection to the same nodes that a particular node has (for example, who likes the same bands that John likes, or who has the same friends that Jane has).

If you didn’t see the separate property paths draft document and you’re interested in SPARQL, it’s definitely worth skimming section 9 of the new query spec draft. There’s a lot of neat stuff there.


By Dan Brickley on October 15, 2010 1:12 PM

Re hierarchies, I’ve not looked into this yet properly,… but perhaps it is then a good fit for SKOS data, which builds hierarchies with skos:broader links?

By Bob DuCharmeAuthor Profile Page{.commenter-profile} on October 15, 2010 1:17 PM


Hell yeah! I’ve already used it for that on work-related projects, where I’ve been getting much deeper into SKOS.

By Hrvoje Simic on October 27, 2010 11:39 AM

When you say “how to get a subtree of a hierarchy”, do you mean something like in the example:

?ancestor (ex:motherOf|ex:fatherOf)+

or did have something more complex in mind, like extracting a subgraph (CONSTRUCT form)?


By Bob DuCharmeAuthor Profile Page{.commenter-profile} on October 27, 2010 12:27 PM

Something in between, I suppose, but I don’t think that a CONSTRUCT form would be that complex. See http://lists.w3.org/Archives/Public/public-esw-thes/2010Oct/0015.html for a few SKOS examples that I wrote out. A CONSTRUCT version of example 1 there would be something like

CONSTRUCT { ?c ?p ?o }
   ?c skos:broader* i:VariableStars .
   ?c ?p ?o .