W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > March 2012

Multiple BINDING clauses in SPARQL queries

From: Alexander Dutton <alexander.dutton@oucs.ox.ac.uk>
Date: Tue, 13 Mar 2012 09:13:43 +0000
Message-ID: <4F5F0FC7.20700@oucs.ox.ac.uk>
To: "public-rdf-dawg-comments@w3.org" <public-rdf-dawg-comments@w3.org>

<http://www.w3.org/TR/sparql11-query/#sparqlGrammar> (rule 28) restricts
a SPARQL query to having only one BINDINGS clause. For brevity one might
wish to include more than one BINDINGS clause and have each of them joined.

This would allow queries such as:

  ?thing ?labelProperty ?label
} BINDINGS ?thing {
} BINDINGS ?labelProperty {

i.e. dig out a name for more than one resource at once, without knowing
which name properties are used.

While the BINDINGs could be joined together by the client, this would
lead to a large number of bindings to send for something that can easily
be calculated by the query engine.

The SPARQL grammar also forbids BINDINGS clauses on sub-selects, which
(as far as I can tell) makes a solution using sub-selects impossible.

Another solution would be to use a "FILTER (?labelProperty IN
(skos:prefLabel, skos:altLabel, …))", but this seems less easy to
optimise for, and less clear.

Using a property path (e.g. "?thing skos:prefLabel|skos:altLabel|…
?label") loses the detail of which property term was matched.

With kind regards,


Alexander Dutton
Developer, InfoDev; data.ox.ac.uk, OxPoints
Oxford University Computing Services
Received on Tuesday, 13 March 2012 09:14:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:01:30 UTC