On Mon, Feb 25, 2013 at 11:42 AM, Joshua TAYLOR <[email protected]> wrote:
> I'm looking at upgrading a project to use the new 2.10.0 release, and
> things are coming along nicely so far (some possible hitches in some
> writing code, but can't run tests until I can build...). I've got a
> bunch of cases of
>
> UpdateAction.execute(request, getModel(), binding);
>
> that don't compile, though; according to the release notes [1],
> "SPARQL Update execution no longer supports setting an initial
> binding". I'm going to keep looking for the new way to do this, but
> in case someone's got the quick answer prepared, and so that the list
> has a recorded answer, I figured I'd ask sooner rather than later:
> how can initial bindings be specified in Jena 2.10.0?
>
> [1] http://svn.apache.org/repos/asf/jena/trunk/jena-arq/ReleaseNotes.txt
After some lunch, and some searching, I've found discussion on the dev
list about removing initial bindings [1] and that the accepted way to
do this now is to use BIND or VALUES. In our project, we've
implemented a number of EnhancedResources that perform graph updates
using an idiom where some SPARQL text refers to a ?this variable, and
the execution uses a binding that binds ?this to the enhanced resource
(which might not have a URI). We'd much prefer to do the graph
modification via SPARQL because it involves a number of operations,
and we'd like to be able to use anonymous resources. Here's a typical
example:
static private final UpdateRequest setSomePropertyRequest =
UpdateFactory.create(
"DELETE {\n"+
.... SPARQL code that uses variable ?this ...
"} INSERT {\n"+
"} WHERE {"+
...
"}"
);
public Invocation setSomeProperty( Value value ) {
final QuerySolutionMap binding = new QuerySolutionMap();
binding.add("?this", this );
UpdateAction.execute( setSomePropertyRequest,
getModel(), binding);
}
return this;
}
Is there still a way to do something like this? If it will involve
using VALUES or BIND, is there a way to make it work with blank nodes?
Thanks in advance,
//JT
[1]
http://mail-archives.apache.org/mod_mbox/jena-dev/201302.mbox/%3CCAPTxtVNWT1HncCLom14cTF0WcjJ04pyP8ALes5Vb5yuSDv8DWw%40mail.gmail.com%3E
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/