On Thu, Aug 22, 2013 at 1:36 PM, Phil Ashworth <[email protected]> wrote:
> Thanks Joshua Very helpful
> I saw the the code from 3 weeks ago.
> I thought that was neat.
> But I'm presuming that won't work for parameterisedsparqlstring. And I need
> to use this for a sparql service clause.
>
> So I guess I willI have to just iterate over the bindings I want to happen,
> rather than put them in a values block.

ParameterizedSparqlString has `append` methods, so while you can't
simply add a values block, you can use the same kind of iteration over
the values that you need and construct a values block with something
like:

pss.append( "VALUES (" );
// ... figure out what vars to append
pss.append( "?v1 ?v2 ..." );
pss.append( ") {" );
for ( ... ) {
  pss.append( "(" );
  pss.appendNode( <value for v1> );
  pss.append( " " );
  pss.appendNode( <value for v2> );
  // ...
  pss.append( ")" );
}
pss.append( "}" );

If you want more than one set of specified bindings for one or more
variables, I don't see that you can get around using a VALUES block,
regardless of how you construct it.

//JT
-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to