- From: Eric Prud'hommeaux <eric@w3.org>
- Date: Sat, 8 Nov 2014 14:47:19 -0500
- To: "Neubert, Joachim" <J.Neubert@zbw.eu>
- Cc: public-sparql-dev@w3.org
- Message-ID: <CANfjZH3SuKKughR6io=Po2Sr+7PD5Bf7jLaxS_Gqo+ksm4QRhQ@mail.gmail.com>
On Nov 8, 2014 5:52 PM, "Neubert, Joachim" <J.Neubert@zbw.eu> wrote: > > I’ve started to experimentally use VALUES clauses as a simple mechanism for SPARQL templating. A VALUES table may provide a location where less tech-savvy people can find hints where to tweak the query. E.g. > > > > # parameters > > VALUES ( ?versionHistoryGraph ?language ) { > > ( <http://zbw.eu/stw/version> "en" ) > > } > > > > Is much easier to recognize than the same values spread over and literally inserted into the query. Also, programs could parse this clause, and perhaps, by variable replacement, offer choices, or run queries with different pre-defined values. > > > > At the same time, this provides reasonable defaults and leaves the query in a valid and executable state. In my eyes, that’s a big advantage over arbitrary placeholders in the query string. > > > > I wonder what you think of the approach? It makes sense to me. I use a similar mechanism to inject protocol information such the authenticated user or client SSL client cert into variable bindings a SPARQL query. > Cheers, Joachim > > > > Query example: > > http://zbw.eu/beta/sparql-gui/?queryRef=https://api.github.com/repos/jneubert/skos-history/contents/sparql/count_added_labels.rq > > > > Exploiting the VALUES clause of that query in a still sketchy program: > > https://github.com/jneubert/skos-history/blob/master/bin/create_change_statistics.pl > >
Received on Saturday, 8 November 2014 19:47:47 UTC