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

Suggestion: Parameterised Queries

From: Leigh Dodds <leigh.dodds@talis.com>
Date: Fri, 6 Mar 2009 10:15:27 +0000
Message-ID: <f323a4470903060215n3b5b99fax46906e29e457b979@mail.gmail.com>
To: public-rdf-dawg-comments@w3.org
Hi,

I have the following featur esuggestion for the WG.

Feature: Parameterised Queries

Feature Description:

  Extend the SPARQL protocol such that additional URL parameters in
the query string (or a subset that match
  a specific naming convention) are reflected into the query as
initial variable bindings.

Example:

  E.g. for a query such as:

  PREFIX foaf: <http://xmlns.com/foaf/0.1/>
  SELECT ?name
  WHERE {
   ?x foaf:name ?name.
   ?x foaf:weblog ?blog.
  }

  A protocol request of the form:

  /sparql?query=...&blog=http://www.example.org/blog

  Would bind ?blog to the value in the URL parameter before it is
matched against the dataset.

Existing Implementations

 ARQ supports this usage in its core URL, and I have used this to
implement the above style of parameter passing in
 several apps and endpoints whilst at my previous employer.

Use Cases

Enable support SQL style parameterised query directly from the SPARQL
protocol. In conjunction with the proposed Query By Reference
feature it enables the creation of simple "web APIs" using only the
SPARQL protocol. E.g. I am able to publish a common
SPARQL query that does some useful data extraction, and then reuse
that query by altering the passed parameters.

Even without the Query By Reference feature it would simplify
interaction with an endpoint (change url parameter(s) not query) and
would allow the endpoint to cache and parse a query for repeated use,
thereby removing any query parsing overheads.

Cheers,

L.

-- 
Leigh Dodds
Programme Manager, Talis Platform
Talis
leigh.dodds@talis.com
http://www.talis.com
Received on Friday, 6 March 2009 10:16:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 6 March 2009 10:16:07 GMT