W3C home > Mailing lists > Public > semantic-web@w3.org > June 2012

Re: Template language for SPARQL?

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Fri, 01 Jun 2012 15:47:05 +0100
Message-ID: <4FC8D5E9.2010905@epimorphics.com>
To: semantic-web@w3.org


On 01/06/12 15:33, Gunnar Aastrand Grimnes wrote:
> Not quite what you want, but in python RDFLib you can pass in bindings
> for variables to the query execution mechanism, for example:
>
> graph.query('SELECT ?s WHERE { ?s a ?class } .' ,
> initBindings={ 'class': RDFS.Class } )
>
> Would bind ?class to always be RDFS.Class.
>
> I seem to remember I convinved Jena to do something similar, but I
> forget how.
>
> - Gunnar

The Jena query API to query execution has an option to pass in some 
bindings for variables.

SPARQL 1.1 has a recent, related addition which is to provide a table of 
data in the query itself with VALUES.

http://lists.w3.org/Archives/Public/public-sparql-dev/2012AprJun/0018.html

	Andy

>
>
>
> On 01/06/12 03:45, David Booth wrote:
>> [Resending, as my previous message never showed up.]
>>
>> I would like to be able to write something like this:
>>
>> SELECT ?s
>> WHERE { ?s a ${CLASS} . }
>>
>> and have ${CLASS} substituted in from an environment variable or other
>> parameter, but SPARQL does not currently provide anything like this, and
>> it's clearly beyond what the working group could put in SPARQL 1.1.
>> So I'm wondering . . .
>>
>> What have others been using as a template language for SPARQL?
>>
>> I know TopQuadrant uses an RDF representation for SPARQL CONSTRUCT
>> queries in conjunction with SPIN,
>> http://www.w3.org/Submission/2011/02/
>> but it shreds the SPARQL query into tiny RDF pieces, which is rather
>> unfriendly for a human to read. It would be much nicer to have
>> something like the above.
>>
>> How are others handling the need to parameterize their SPARQL queries
>> like this?
>>
>>
>>
>
>
Received on Friday, 1 June 2012 14:47:37 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 21:45:49 GMT