- From: Lee Feigenbaum <lee@thefigtrees.net>
- Date: Mon, 06 Dec 2010 13:13:00 -0500
- To: Danny Ayers <danny.ayers@gmail.com>
- CC: public-sparql-dev@w3.org
Hi Danny, You may be interested in the property paths feature which is in the SPARQL 1.1 Query drafts. Please take a look at: http://www.w3.org/TR/sparql11-query/#propertypaths Lee On 12/6/2010 11:43 AM, Danny Ayers wrote: > Seems like it's often desirable to query over synonyms or near > synonyms, e.g. where resourceA owl:sameAs resourceB, leading to > something like: > > SELECT ... WHERE { > > OPTIONAL { pattern(<resourceA>) } > OPTIONAL { pattern(<resourceB>) } > > } > > - where each pattern block is the same except for the different resource(s). > > So (with apologies if I've overlooked a really obvious alternative) > why not sugar this up a bit and shorten it to something like: > > SELECT ... WHERE { > > pattern(<resourceA> ||<resourceB>) > > } > > Ok, a proper example - > > SELECT ?label > WHERE { > ?x (rdfs:label || dc:title) ?label . > } > > would produce exactly the same results as: > > SELECT ?label > WHERE { > OPTIONAL { ?x rdfs:label ?label } > OPTIONAL { ?x dc:title ?label } > } > > This example only saves a few characters, but with richer queries it > may not only reduce the typing but also make them easier to read& > maintain. > > I've included (braces) above, but it looks pretty unambiguous and I > suspect wouldn't add much to a parser's complexity with or without > braces - it's a kinda macro, as the song goes. > > I've not had chance to play with this, but at first glance at least it > seems like the&& and ! operators could be used in a similar fashion > (abbreviating unions and a certain shape of filter, I think...). > > Cheers, > Danny. > >
Received on Monday, 6 December 2010 18:13:40 UTC