You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Rob Stewart <ro...@googlemail.com> on 2011/10/22 14:37:30 UTC

tdb: sparql update into graphs?

Hi,

I have a joseki sparql endpoint set up. I am testing SPARQL Update.
The following works:

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ns: <http://example.org/ns#>
INSERT DATA
{ <http://example/book1>  ns:price  42 }

----

However, this does not work:

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ns: <http://example.org/ns#>
INSERT DATA
{ GRAPH <http://example/bookStore> { <http://example/book1>  ns:price  42 } }

----

The error is:

18:05:36 INFO  Servlet              :: Service URI = <update/service>
18:05:36 INFO  SPARQLUpdate         :: SPARQL/Update Operation
null graph
18:05:36 WARN  SPARQLUpdate         :: Update failed
java.lang.NullPointerException
       at com.hp.hpl.jena.sparql.core.DatasetGraphCollection.add(DatasetGraphCollection.java:27)
       at com.hp.hpl.jena.sparql.core.DatasetGraphWrapper.add(DatasetGraphWrapper.java:57)
       at com.hp.hpl.jena.sparql.modify.UpdateEngineWorker.visit(UpdateEngineWorker.java:215)
       at com.hp.hpl.jena.sparql.modify.request.UpdateDataInsert.visit(UpdateDataInsert.java:15)
       at com.hp.hpl.jena.sparql.modify.UpdateEngineMain.execute(UpdateEngineMain.java:39)
       at com.hp.hpl.jena.sparql.modify.UpdateProcessorBase.execute(UpdateProcessorBase.java:48)
       at org.joseki.processors.SPARQLUpdate.execOperation(SPARQLUpdate.java:82)

----

Is there support in Joseki for writing into graphs in this way? I have
taken the example from the w3c page on sparql update [1].

1- http://www.w3.org/TR/sparql11-update/

thanks,

--
Rob Stewart

Re: tdb: sparql update into graphs?

Posted by Paolo Castagna <ca...@googlemail.com>.
Rob Stewart wrote:
> Is there support in Joseki for writing into graphs in this way? I have
> taken the example from the w3c page on sparql update [1].

Rob, why don't you try Fuseki instead of Joseki?
http://openjena.org/wiki/Fuseki

Do you have same problems?

Paolo

Re: tdb: sparql update into graphs?

Posted by Andy Seaborne <an...@apache.org>.
On 22/10/11 14:47, Bill Roberts wrote:
>
> On 22 Oct 2011, at 14:37, Rob Stewart wrote:
>
>> Hi,
>>
>> I have a joseki sparql endpoint set up. I am testing SPARQL Update.
>> The following works:
>>
>> PREFIX dc:<http://purl.org/dc/elements/1.1/>
>> PREFIX ns:<http://example.org/ns#>
>> INSERT DATA
>> {<http://example/book1>   ns:price  42 }
>>
>> ----
>>
>> However, this does not work:
>>
>> PREFIX dc:<http://purl.org/dc/elements/1.1/>
>> PREFIX ns:<http://example.org/ns#>
>> INSERT DATA
>> { GRAPH<http://example/bookStore>  {<http://example/book1>   ns:price  42 } }
>>
> This works fine for me on Joseki 3.4.4.  (I'm using the 'UnionDefaultGraph' option - not sure if that makes any difference).  I can't see anything wrong with it so not sure why you are getting an error.
>
> For me, the first example (where no graph is specified) executes without error, but the triple is not retrieved when I do a SELECT for it - I presume this is because my default graph is the union of named graphs, so stuff in un-named graphs is somehow 'lost'.
>

There was a bug in this area which is now fixed (the bug was in ARQ).

It seems 3.4.4.has it fixed but if not then the development build should 
have it (I'm doing offline email so I can't check - sorry).

	Andy

Re: tdb: sparql update into graphs?

Posted by Bill Roberts <bi...@swirrl.com>.
>> 
>> For me, the first example (where no graph is specified) executes without error, but the triple is not retrieved when I do a SELECT for it - I presume this is because my default graph is the union of named graphs, so stuff in un-named graphs is somehow 'lost'.
>> 
> 
> Bill - not so much "lost" as "hidden". Updates do go to the real default graph but that is masked by the union default graph in the query.
> 
>    Andy


OK thanks!  

Re: tdb: sparql update into graphs?

Posted by Andy Seaborne <an...@apache.org>.
On 22/10/11 14:47, Bill Roberts wrote:
>
> On 22 Oct 2011, at 14:37, Rob Stewart wrote:
>
>> Hi,
>>
>> I have a joseki sparql endpoint set up. I am testing SPARQL Update.
>> The following works:
>>
>> PREFIX dc:<http://purl.org/dc/elements/1.1/>
>> PREFIX ns:<http://example.org/ns#>
>> INSERT DATA
>> {<http://example/book1>   ns:price  42 }
>>
>> ----
>>
>> However, this does not work:
>>
>> PREFIX dc:<http://purl.org/dc/elements/1.1/>
>> PREFIX ns:<http://example.org/ns#>
>> INSERT DATA
>> { GRAPH<http://example/bookStore>  {<http://example/book1>   ns:price  42 } }
>>
> This works fine for me on Joseki 3.4.4.  (I'm using the 'UnionDefaultGraph' option - not sure if that makes any difference).  I can't see anything wrong with it so not sure why you are getting an error.
>
> For me, the first example (where no graph is specified) executes without error, but the triple is not retrieved when I do a SELECT for it - I presume this is because my default graph is the union of named graphs, so stuff in un-named graphs is somehow 'lost'.
>

Bill - not so much "lost" as "hidden". Updates do go to the real default 
graph but that is masked by the union default graph in the query.

     Andy

Re: tdb: sparql update into graphs?

Posted by Bill Roberts <bi...@swirrl.com>.
On 22 Oct 2011, at 14:37, Rob Stewart wrote:

> Hi,
> 
> I have a joseki sparql endpoint set up. I am testing SPARQL Update.
> The following works:
> 
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> PREFIX ns: <http://example.org/ns#>
> INSERT DATA
> { <http://example/book1>  ns:price  42 }
> 
> ----
> 
> However, this does not work:
> 
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> PREFIX ns: <http://example.org/ns#>
> INSERT DATA
> { GRAPH <http://example/bookStore> { <http://example/book1>  ns:price  42 } }
> 
This works fine for me on Joseki 3.4.4.  (I'm using the 'UnionDefaultGraph' option - not sure if that makes any difference).  I can't see anything wrong with it so not sure why you are getting an error.

For me, the first example (where no graph is specified) executes without error, but the triple is not retrieved when I do a SELECT for it - I presume this is because my default graph is the union of named graphs, so stuff in un-named graphs is somehow 'lost'.