Multiple BINDING clauses in SPARQL queries

Dear SPARQL-WG,

<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:

CONSTRUCT WHERE {
  ?thing ?labelProperty ?label
} BINDINGS ?thing {
  (<http://id.example.com/thing/one>)
  (<http://id.example.com/thing/two>)
  (<http://id.example.com/goldfish>)
} BINDINGS ?labelProperty {
  (skos:prefLabel)
  (skos:altLabel)
  (skos:hiddenLabel)
  (dc:title)
  (dcterms:title)
  (rdfs:label)
  (foaf:name)
  (gr:name)
}

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

--
Alexander Dutton
Developer, InfoDev; data.ox.ac.uk, OxPoints
Oxford University Computing Services

Received on Tuesday, 13 March 2012 09:14:13 UTC