You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Carina Haupt <ca...@scai-extern.fraunhofer.de> on 2013/01/11 10:53:10 UTC
Jena modifying given DELETE statement
Hi,
when I try to perform an delete against my external endpoint (Virtuoso),
the query gets modified by Jena.
Original
DELETE FROM <http://test> { ?s <http://purl.org/dc/terms/identifier>
"21818744"^^<http://www.w3.org/2001/XMLSchema#string> . } WHERE { GRAPH
<http://test> {?s <http://purl.org/dc/terms/identifier>
"21818744"^^<http://www.w3.org/2001/XMLSchema#string> . }}
Modified by Jena
DELETE {
GRAPH <http://test> {
?s <http://purl.org/dc/terms/identifier>
"21818744"^^<http://www.w3.org/2001/XMLSchema#string> .
}
}
WHERE
{ GRAPH <http://test>
{ ?s <http://purl.org/dc/terms/identifier>
"21818744"^^<http://www.w3.org/2001/XMLSchema#string> }
}
Virtuoso cannot handle the second syntax. I also tried all given syntax
formats provided by Jena, but only ARQ does not throws an exception, but
does this modification instead.
Code I use:
UpdateRequest update = UpdateFactory.create(deleteString);
UpdateProcessor uExec = UpdateExecutionFactory.createRemote(update,
endpoint) ;
uExec.execute();
On 10.01.2013 19:44, Andy Seaborne wrote:
> On 10/01/13 16:52, Carina Haupt wrote:
>> Hi,
>>
>> is it possible to delete triples from an external triple store like
>> Virtuoso using the Jena API?
>>
>> I found examples to use SPARQL/UPDATE statements for in memory stores,
>> but not external hosted ones.
>>
>> Regards,
>> Carina
>>
>
> You can create executions on remote endpoints by:
>
> UpdateExecution uExec =
> UpdateExecutionFactory.createRemote(Update, remoteEndpoint) ;
> uExec.execute() ;
>
> Andy
>
--
Carina Haupt
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Schloss Birlinghoven
D-53754 Sankt Augustin
Tel.: +49 - 2241 - 14 - 3480
E-mail: carina.haupt@scai-extern.fraunhofer.de
Internet: http://www.scai.fraunhofer.de
and
Bonn-Aachen International Center for Information Technology (B-IT)
Dahlmannstrasse 2
D-53113 Bonn
E-mail: hauptc@informatik.uni-bonn.de
Internet: http://www.b-it-center.de
Re: Jena modifying given DELETE statement
Posted by Andy Seaborne <an...@apache.org>.
On 11/01/13 09:53, Carina Haupt wrote:
> Hi,
>
> when I try to perform an delete against my external endpoint (Virtuoso),
> the query gets modified by Jena.
>
> Original
>
> DELETE FROM <http://test> { ?s <http://purl.org/dc/terms/identifier>
> "21818744"^^<http://www.w3.org/2001/XMLSchema#string> . } WHERE { GRAPH
> <http://test> {?s <http://purl.org/dc/terms/identifier>
> "21818744"^^<http://www.w3.org/2001/XMLSchema#string> . }}
Not legal SPARQL 1.1.
It parses in ARQ only because there is some compatibility with the old
SPARQL/Update submission. It is incomplete compatibility - it is a
burden to support both and the standard is their to be a common syntax
for all.
Compatibility helps people migrate apps progressively because other
remote systems are only going to support SPARQL 1.1 syntax.
> Modified by Jena
>
> DELETE {
> GRAPH <http://test> {
> ?s <http://purl.org/dc/terms/identifier>
> "21818744"^^<http://www.w3.org/2001/XMLSchema#string> .
> }
> }
> WHERE
> { GRAPH <http://test>
> { ?s <http://purl.org/dc/terms/identifier>
> "21818744"^^<http://www.w3.org/2001/XMLSchema#string> }
> }
The internal form is output converted to a standard form - legal SPARQL
1.1 syntax.
http://www.sparql.org/update-validator.html
The first example only works if you check "extended syntax".
This is going to be removed from ARQ at the next release. SPARQL 1.1 is
the standard. The submission syntax has significant design problems
which have been corrected by the working group.
> Virtuoso cannot handle the second syntax. I also tried all given syntax
> formats provided by Jena, but only ARQ does not throws an exception, but
> does this modification instead.
While Virtuoso claims SPARQL 1.1 support, it seems patchy and
incomplete. I don't know what Virtuoso supports - some varient of the
SPARQL/Update submission I guess. OpenLink did not summit any
conformance reports when the working group gathered them from as many
implementations as possible.
You should contact OpenLink and ask them what their plans and timescales
are. Their erratic support for SPARQL 1.1 (Update and to a lesser
extent query) is a cost on open source projects providing
application/client environments.
>
> Code I use:
>
> UpdateRequest update = UpdateFactory.create(deleteString);
> UpdateProcessor uExec = UpdateExecutionFactory.createRemote(update,
> endpoint) ;
> uExec.execute();
The SPARQL protocol is very simple for sending SPARQL Update requests -
set the Content-type: and send the request as the body.
You can send the operation directly using the packaged up use of HTTP:
HttpOp.execHttpPost(endpoint,
WebContent.contentTypeSPARQLUpdate,
reqStr) ;
which is the core of what .execute does.
For query, there is a hack cut-through path (create a remote query
execution based on the string without parsing). It could be added for
update but the point of parsing and emitting strictly legal SPARQL 1.1
syntax is to maximise interoperability helping people migrate
applications using old, deprecated style update.
(exasperation at the lack of standards compliance over :-)
Andy
>
>
> On 10.01.2013 19:44, Andy Seaborne wrote:
>> On 10/01/13 16:52, Carina Haupt wrote:
>>> Hi,
>>>
>>> is it possible to delete triples from an external triple store like
>>> Virtuoso using the Jena API?
>>>
>>> I found examples to use SPARQL/UPDATE statements for in memory stores,
>>> but not external hosted ones.
>>>
>>> Regards,
>>> Carina
>>>
>>
>> You can create executions on remote endpoints by:
>>
>> UpdateExecution uExec =
>> UpdateExecutionFactory.createRemote(Update, remoteEndpoint) ;
>> uExec.execute() ;
>>
>> Andy
>>
>