Re: Template language for SPARQL?

We've used a very simple approach as well.  We typically have just used 
positional parameters, numbered %1, %2, etc.

E.g., a query template would be defined like this:

    PREFIX foaf: <http://xmlns.com/foaf/0.1/>
    select ?a ?b
    where {
    <%1>  foaf:name ?name  .
    <%1>  foaf:workplaceHomepage <%2> .
    }

and we string replace the %1 and %2 with URLs at run time to tailor the 
query.


On 6/1/2012 4:10 AM, Bill Roberts wrote:
> Hi David
>
> Thanks to Paul for mentioning our blog post from a few weeks ago. We felt the same need as you and set up a simple approach to substitute URL parameters into a sparql query. We've found it very handy.
>
> If something like this was included in the standards then we'd be happy to adapt to follow that standard.
>
> Bill
>
> Sent from my iPhone
>
> On 1 Jun 2012, at 07:57, Paul Hermans<paul@proxml.be>  wrote:
>
>> David,
>>
>> See
>> http://blog.swirrl.com/articles/new-publishmydata-feature-named-queries
>>
>> Paul
>>
>> On 01 Jun 2012, at 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?
>>>
>>>
>>>
>>> -- 
>>> David Booth, Ph.D.
>>> http://dbooth.org/
>>>
>>> Opinions expressed herein are those of the author and do not necessarily
>>> reflect those of his employer.
>>>
>>>
>>
>> Kind Regards,
>> Paul Hermans
>>
>> -------------------------
>> ProXML bvba
>> XML and OWL/RDF services
>> (w) www.proxml.be
>> (b) experiences and opinions
>> (e) paul@proxml.be
>> (t)  +32 15 23 00 76
>> (m) +32 473 66 03 20
>>
>> Narcisweg 17
>> 3140 Keerbergen
>> Belgium
>>
>>
>>
>>
>>
>>
>>
>>

-- 
Mark Wallace
Principal Engineer, Semantic Applications
Modus Operandi, Inc.
709 S. Harbor City Blvd., Suite 400
Melbourne, FL 32901-1936, USA
(321) 473-1400 ext 1442
mwallace@modusoperandi.com
www.modusoperandi.com
	
	I'm speaking at SemTech 2012! 
<http://semtechbizsf2012.semanticweb.com/?c=stspk>


CONFIDENTIALITY NOTICE: The information transmitted (including 
attachments) is covered by the Electronic Communications Privacy Act, 18 
U.S.C. 2510-2521. This transmission is intended only for the person(s) 
or entity/entities to which it is addressed and may contain confidential 
and/or proprietary material. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient or 
have received this transmission in error, please contact the sender by 
reply e-mail and destroy all copies of the original message.

Received on Saturday, 2 June 2012 02:51:32 UTC