- From: Danny Ayers <danny.ayers@gmail.com>
- Date: Mon, 6 Dec 2010 17:43:37 +0100
- To: public-sparql-dev@w3.org
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 16:44:13 UTC