Hi David, Yes this would work for me in this case -- I do know the variables so I could use UNDEF as placeholders.
Maybe you have a code snippet for this logic? :) Martynas On Mon, Nov 25, 2024 at 1:03 AM David Habgood <dcchabg...@gmail.com> wrote: > > Hi Martynas, > > Do you know ahead of time which variable(s) you're going to be injecting > the VALUES clause for? > > I've been using a pattern where I add VALUES ?this { UNDEF } in "template" > queries, then at runtime parse the query and replace "UNDEF" (where all of > the DataBlockValue <https://www.w3.org/TR/sparql11-query/#rDataBlockValue>s > in a binding within a InlineDataFull are "UNDEF") with a set of bindings > supplied at runtime. This has the benefit that if you do not supply a > binding for ?this, UNDEF means it is left unbound. > > Thanks, > > On Mon, Nov 25, 2024 at 9:40 AM Martynas Jusevičius <marty...@atomgraph.com> > wrote: > > > Hi, > > > > What would be the simplest way to safely (i.e. using query builder or > > algebra) to inject a VALUES block at the beginning of a query? > > > > For example > > > > SELECT * > > { > > ?this ?p ?o > > } > > > > should become > > > > SELECT * > > { > > VALUES ?this <http://localhost> > > ?this ?p ?o > > } > > > > after the injection. > > > > Thanks, > > > > Martynas > >