You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Eric Scott <er...@att.net> on 2012/01/14 21:32:14 UTC

fuseki update not persisting between sessions

I'm playing with Fuseki using a config file:

fuseki-server --config <config-file> --update dataset

Where <config-file> declares several services, all of which have 
associated tdb files.

When I use:

  s-update --file <sparql-file> --service 
http://localhost:3030/myService/update

The update works just fine, but update does not persist if I kill the 
fuseki-server and restart with the same arguments. I note that several 
files within the associated TDB directory have updated timestamps, but 
querying against the new inserts produces an empty result set.

Are there config options or something else one needs to provide in order 
to ensure such persistence?

Thanks,


Re: fuseki update not persisting between sessions

Posted by Andy Seaborne <an...@apache.org>.
On 16/01/12 18:14, Eric Scott wrote:
> On 01/15/2012 09:28 AM, Andy Seaborne wrote:
>>
>> That needs investigating - it should work. It looks like it might be
>> connected to Audun's report "Problem persisting N-Triples" as this
>> erroneous behaviour is characteristic of unflushed caches.
>>
>> Could you tell me what
>>
>> fuseki-server --version
>>
>> reports?
>  > fuseki-server --version
> Jena: VERSION: 2.6.4
> Jena: BUILD_DATE: 2010-12-12T16:56:15+0000
> ARQ: VERSION: 2.8.9-SNAPSHOT
> ARQ: BUILD_DATE: 2011-09-14T21:54:22+0100
> TDB: VERSION: 0.8.11-SNAPSHOT
> TDB: BUILD_DATE: 2011-09-04T18:10:31+0100
> Fuseki: VERSION: 0.2.1-SNAPSHOT
> Fuseki: BUILD_DATE: 2011-09-15T08:18:13+0100
>>
>> Could you also say what's in the configuration file?
>>
>>
> Here is what I think is the relevant excerpt:
>
> <#server> rdf:type fuseki:Server ;
> fuseki:services
> (...
> <#aboutCongressService>
> ...
> )
> .
>
> <#aboutCongressService>
> rdf:type fuseki:Service ;
> rdfs:label "Service for congressional data from rdfabout.com";
> fuseki:name "aboutCongress";
> fuseki:serviceQuery "query"; #enables <form
> action="[service]/query">...</form> in html
> fuseki:serviceUpdate "update"; #enables <form
> action="[service]/update">...<form> in html when fuseki-server is called
> with --update option.
> fuseki:serviceUpload "upload"; #Non-sparql upload service.
> fuseki:serviceReadWriteGraphStore "data"; # enables s-put
> fuseki:dataset <#aboutCongress_dataset>;
> .
>
> <#aboutCongress_dataset> rdf:type ja:RDFDataset;
> ja:defaultGraph <#aboutCongress_graph>
> .
>
> <#aboutCongress_graph> rdf:type tdb:GraphTDB;
> rdfs:label "Data about members of congress from aboutRdf.com";
> tdb:location "/home/escott/TDB/congress"

It is much better to directly connect the TDB dataset to the service. 
If the TDB-backed graph is inside a general (in-memory) dataset wrapper, 
not a TDB dataset, then update sync is not going to work reliably.

<#aboutCongress_dataset> rdf:type tdb:DatasetTDB ;
  tdb:location "/home/escott/TDB/congress" ;
  .

	Andy

> .
>
>> On 14/01/12 20:32, Eric Scott wrote:
>>> I'm playing with Fuseki using a config file:
>>>
>>> fuseki-server --config <config-file> --update dataset
>>>
>>> Where <config-file> declares several services, all of which have
>>> associated tdb files.
>>>
>>> When I use:
>>>
>>> s-update --file <sparql-file> --service
>>> http://localhost:3030/myService/update
>>>
>>> The update works just fine, but update does not persist if I kill the
>>> fuseki-server and restart with the same arguments. I note that several
>>> files within the associated TDB directory have updated timestamps, but
>>> querying against the new inserts produces an empty result set.
>>>
>>> Are there config options or something else one needs to provide in order
>>> to ensure such persistence?
>>>
>>
>>
>


Re: fuseki update not persisting between sessions

Posted by Eric Scott <er...@att.net>.
On 01/15/2012 09:28 AM, Andy Seaborne wrote:
>
> That needs investigating - it should work.  It looks like it might be 
> connected to Audun's report "Problem persisting N-Triples" as this 
> erroneous behaviour is characteristic of unflushed caches.
>
> Could you tell me what
>
>    fuseki-server --version
>
> reports?
 > fuseki-server --version
Jena:       VERSION: 2.6.4
Jena:       BUILD_DATE: 2010-12-12T16:56:15+0000
ARQ:        VERSION: 2.8.9-SNAPSHOT
ARQ:        BUILD_DATE: 2011-09-14T21:54:22+0100
TDB:        VERSION: 0.8.11-SNAPSHOT
TDB:        BUILD_DATE: 2011-09-04T18:10:31+0100
Fuseki:     VERSION: 0.2.1-SNAPSHOT
Fuseki:     BUILD_DATE: 2011-09-15T08:18:13+0100
>
> Could you also say what's in the configuration file?
>
>
Here is what I think is the relevant excerpt:

<#server>  rdf:type fuseki:Server ;
     fuseki:services
         (...
<#aboutCongressService>
      ...
         )
     .

<#aboutCongressService>
     rdf:type                            fuseki:Service ;
     rdfs:label                          "Service for congressional data 
from rdfabout.com";
     fuseki:name                         "aboutCongress";
     fuseki:serviceQuery                 "query";                
#enables <form action="[service]/query">...</form> in html
     fuseki:serviceUpdate                "update";               
#enables <form action="[service]/update">...<form> in html when 
fuseki-server is called with --update option.
     fuseki:serviceUpload                "upload";               
#Non-sparql upload service.
     fuseki:serviceReadWriteGraphStore   "data";                 # 
enables s-put
     fuseki:dataset <#aboutCongress_dataset>;
.

<#aboutCongress_dataset> rdf:type ja:RDFDataset;
             ja:defaultGraph <#aboutCongress_graph>
.

<#aboutCongress_graph>  rdf:type    tdb:GraphTDB;
     rdfs:label "Data about members of congress from aboutRdf.com";
     tdb:location "/home/escott/TDB/congress"
.

> On 14/01/12 20:32, Eric Scott wrote:
>> I'm playing with Fuseki using a config file:
>>
>> fuseki-server --config <config-file> --update dataset
>>
>> Where <config-file> declares several services, all of which have
>> associated tdb files.
>>
>> When I use:
>>
>> s-update --file <sparql-file> --service
>> http://localhost:3030/myService/update
>>
>> The update works just fine, but update does not persist if I kill the
>> fuseki-server and restart with the same arguments. I note that several
>> files within the associated TDB directory have updated timestamps, but
>> querying against the new inserts produces an empty result set.
>>
>> Are there config options or something else one needs to provide in order
>> to ensure such persistence?
>>
>
>


Re: fuseki update not persisting between sessions

Posted by Andy Seaborne <an...@apache.org>.
Hi Eric,

I think the problem comes down to this part of the config:

 > <#minimalDataset> rdf:type ja:RDFDataset;
 >     ja:defaultGraph <#minimalGraph>.
 >
 > <#minimalGraph> rdf:type tdb:GraphTDB;
 >     tdb:location "/home/escott/TDB/minimal/".

Can you use:

<#minimalDataset> rdf:type tdb:DatasetTDB ;
   tdb:location "/home/escott/TDB/minimal/".

instead?

The way to have it set up, the graph isn't transactional because it's in 
inside  ja:RDFDataset.

ja:RDFDataset means an in-memory general purpose dataset that can 
contain any sort of graph including a mixture of graphs from different 
storage systems or inference engines.  It does not support transactions.

tdb:DatasetTDB is a dataset directly backed by TDB and does support 
transactions.

I've found the cause of your specific problem aad applied a specific fix 
but other things will go wrong when using an in-memory dataset (e.g. if 
you add a new graph via SPARQL Update).

The best solution is to use a TDB dataset directly by using  tdb:DatasetTDB.

	Andy

(rebuilds may be delayed - the Apache Jenkins systems is having a bad day).

Re: fuseki update not persisting between sessions

Posted by Eric Scott <er...@att.net>.
Whoops! I left out this step:

 > s-update --file=./EG/test-insert.sparql --service 
http://localhost:3030/minimal/update

just before the second query.


On 01/31/2012 01:58 PM, Eric Scott wrote:
> Unfortunately, the most recent version of the snapshot 
> (apache-jena-fuseki-0.2.1-incubating-SNAPSHOT) has not fixed my problem.
>
> I've had a chance to pair this down to a set small enough to replicate 
> the problem, at least on my end.
>
> Starting with this file:
>
> ~/RDF/minimal.ttl:
> ------------------
> @prefix eg: <http://example.org/ontology#>.
>
> eg:dummySubject1 eg:dummyPredicate1 eg:dummyObject1.
>
> -----------------
>
> I call:
>
> > tdbloader2 --loc ./TDB/minimal/ ./RDF/minimal.ttl
>
> To index a TDB repo.
>
> Now given this configuration file:
>
> EG/services-config.ttl
> ----------------------
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
> @prefix eg: <http://example.org/ontology#>.
> <> rdfs:label "Fuseki Configuration File" .
> <#server>  rdf:type fuseki:Server ;
>     fuseki:services
>            (
> <#minimalService>
>         )
>     .
> <#minimalService>
>     rdf:type                            fuseki:Service ;
>     fuseki:name                         "minimal";
>     fuseki:serviceQuery                 "query";                
> #enables <form action="query">...</form> in html
>     fuseki:serviceUpdate                "update";               
> #enables <form action="update">...<form> in html when fuseki-server is 
> called with --update option.
>     fuseki:serviceUpload                "upload";               
> #Non-sparql upload service.
>     fuseki:serviceReadWriteGraphStore   "data";                 # 
> enables s-put
>     fuseki:dataset <#minimalDataset>;
>     .
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
> tdb:DatasetTDB  rdfs:subClassOf ja:RDFDataset .
> tdb:GraphTDB    rdfs:subClassOf  ja:Model .
>
> <#minimalDataset>  rdf:type ja:RDFDataset;
>             ja:defaultGraph <#minimalGraph>.
>
> <#minimalGraph>  rdf:type    tdb:GraphTDB;
>     tdb:location "/home/escott/TDB/minimal/".
>
> ---------------------- end services-config.ttl
>
> I call:
>
> > fuseki-server --config=./EG/services-config.ttl --update &
>
> Then:
>
> > s-query --service http://localhost:3030/minimal/query 'SELECT * {?s 
> ?p ?o}'
>
> gives:
>
> {
>   "head": {
>     "vars": [ "s" , "p" , "o" ]
>   } ,
>   "results": {
>     "bindings": [
>       {
>         "s": { "type": "uri" , "value": 
> "http://example.org/ontology#dummySubject1" } ,
>         "p": { "type": "uri" , "value": 
> "http://example.org/ontology#dummyPredicate1" } ,
>         "o": { "type": "uri" , "value": 
> "http://example.org/ontology#dummyObject1" }
>       }
>     ]
>   }
> }
>
> ... as expected.
>
> Then given a file EG/test-insert.sparql:
>
> -------------------
> PREFIX eg: <http://example.org/ontology#>
> INSERT DATA
> {
>   eg:dummySubject1 eg:dummyPredicate2 eg:dummyObject2.
> }
> -------------------
>
> Entering:
>
> >  s-query --service http://localhost:3030/minimal/query 'SELECT * {?s 
> ?p ?o}'
>
> gives:
>
> {
>   "head": {
>     "vars": [ "s" , "p" , "o" ]
>   } ,
>   "results": {
>     "bindings": [
>       {
>         "s": { "type": "uri" , "value": 
> "http://example.org/ontology#dummySubject1" } ,
>         "p": { "type": "uri" , "value": 
> "http://example.org/ontology#dummyPredicate1" } ,
>         "o": { "type": "uri" , "value": 
> "http://example.org/ontology#dummyObject1" }
>       } ,
>
>       {
>         "s": { "type": "uri" , "value": 
> "http://example.org/ontology#dummySubject1" } ,
>         "p": { "type": "uri" , "value": 
> "http://example.org/ontology#dummyPredicate2" } ,
>         "o": { "type": "uri" , "value": 
> "http://example.org/ontology#dummyObject2" }
>       } ,
>       {
>         "s": { "type": "uri" , "value": 
> "http://example.org/ontology#dummyPredicate2" }
>       }
>     ]
>   }
> }
> ...Huzzah!
>
> BUT -  killing the process and restarting with the same arguments does 
> *not* persist the results, and all I get is the one original triple.
>
> Is there something I'm doing wrong, or is this a bug? If so, I hope 
> this gives you enough of a basis to replicate the problem on your side.
>
> Thanks as always for your help.
>
>
>
> On 01/15/2012 09:28 AM, Andy Seaborne wrote:
>> Eric,
>>
>>
>> That needs investigating - it should work.  It looks like it might be 
>> connected to Audun's report "Problem persisting N-Triples" as this 
>> erroneous behaviour is characteristic of unflushed caches.
>>
>> Could you tell me what
>>
>>    fuseki-server --version
>>
>> reports?
>>
>> Could you also say what's in the configuration file?
>>
>>     Andy
>>
>> On 14/01/12 20:32, Eric Scott wrote:
>>> I'm playing with Fuseki using a config file:
>>>
>>> fuseki-server --config <config-file> --update dataset
>>>
>>> Where <config-file> declares several services, all of which have
>>> associated tdb files.
>>>
>>> When I use:
>>>
>>> s-update --file <sparql-file> --service
>>> http://localhost:3030/myService/update
>>>
>>> The update works just fine, but update does not persist if I kill the
>>> fuseki-server and restart with the same arguments. I note that several
>>> files within the associated TDB directory have updated timestamps, but
>>> querying against the new inserts produces an empty result set.
>>>
>>> Are there config options or something else one needs to provide in 
>>> order
>>> to ensure such persistence?
>>>
>>> Thanks,
>>>
>>
>>
>
>


Re: fuseki update not persisting between sessions

Posted by Eric Scott <er...@att.net>.
Unfortunately, the most recent version of the snapshot 
(apache-jena-fuseki-0.2.1-incubating-SNAPSHOT) has not fixed my problem.

I've had a chance to pair this down to a set small enough to replicate 
the problem, at least on my end.

Starting with this file:

~/RDF/minimal.ttl:
------------------
@prefix eg: <http://example.org/ontology#>.

eg:dummySubject1 eg:dummyPredicate1 eg:dummyObject1.

-----------------

I call:

 > tdbloader2 --loc ./TDB/minimal/ ./RDF/minimal.ttl

To index a TDB repo.

Now given this configuration file:

EG/services-config.ttl
----------------------
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix eg: <http://example.org/ontology#>.
<> rdfs:label "Fuseki Configuration File" .
<#server>  rdf:type fuseki:Server ;
     fuseki:services
            (
<#minimalService>
         )
     .
<#minimalService>
     rdf:type                            fuseki:Service ;
     fuseki:name                         "minimal";
     fuseki:serviceQuery                 "query";                
#enables <form action="query">...</form> in html
     fuseki:serviceUpdate                "update";               
#enables <form action="update">...<form> in html when fuseki-server is 
called with --update option.
     fuseki:serviceUpload                "upload";               
#Non-sparql upload service.
     fuseki:serviceReadWriteGraphStore   "data";                 # 
enables s-put
     fuseki:dataset <#minimalDataset>;
     .
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB  rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

<#minimalDataset>  rdf:type ja:RDFDataset;
             ja:defaultGraph <#minimalGraph>.

<#minimalGraph>  rdf:type    tdb:GraphTDB;
     tdb:location "/home/escott/TDB/minimal/".

---------------------- end services-config.ttl

I call:

 > fuseki-server --config=./EG/services-config.ttl --update &

Then:

 > s-query --service http://localhost:3030/minimal/query 'SELECT * {?s 
?p ?o}'

gives:

{
   "head": {
     "vars": [ "s" , "p" , "o" ]
   } ,
   "results": {
     "bindings": [
       {
         "s": { "type": "uri" , "value": 
"http://example.org/ontology#dummySubject1" } ,
         "p": { "type": "uri" , "value": 
"http://example.org/ontology#dummyPredicate1" } ,
         "o": { "type": "uri" , "value": 
"http://example.org/ontology#dummyObject1" }
       }
     ]
   }
}

... as expected.

Then given a file EG/test-insert.sparql:

-------------------
PREFIX eg: <http://example.org/ontology#>
INSERT DATA
{
   eg:dummySubject1 eg:dummyPredicate2 eg:dummyObject2.
}
-------------------

Entering:

 >  s-query --service http://localhost:3030/minimal/query 'SELECT * {?s 
?p ?o}'

gives:

{
   "head": {
     "vars": [ "s" , "p" , "o" ]
   } ,
   "results": {
     "bindings": [
       {
         "s": { "type": "uri" , "value": 
"http://example.org/ontology#dummySubject1" } ,
         "p": { "type": "uri" , "value": 
"http://example.org/ontology#dummyPredicate1" } ,
         "o": { "type": "uri" , "value": 
"http://example.org/ontology#dummyObject1" }
       } ,

       {
         "s": { "type": "uri" , "value": 
"http://example.org/ontology#dummySubject1" } ,
         "p": { "type": "uri" , "value": 
"http://example.org/ontology#dummyPredicate2" } ,
         "o": { "type": "uri" , "value": 
"http://example.org/ontology#dummyObject2" }
       } ,
       {
         "s": { "type": "uri" , "value": 
"http://example.org/ontology#dummyPredicate2" }
       }
     ]
   }
}
...Huzzah!

BUT -  killing the process and restarting with the same arguments does 
*not* persist the results, and all I get is the one original triple.

Is there something I'm doing wrong, or is this a bug? If so, I hope this 
gives you enough of a basis to replicate the problem on your side.

Thanks as always for your help.



On 01/15/2012 09:28 AM, Andy Seaborne wrote:
> Eric,
>
>
> That needs investigating - it should work.  It looks like it might be 
> connected to Audun's report "Problem persisting N-Triples" as this 
> erroneous behaviour is characteristic of unflushed caches.
>
> Could you tell me what
>
>    fuseki-server --version
>
> reports?
>
> Could you also say what's in the configuration file?
>
>     Andy
>
> On 14/01/12 20:32, Eric Scott wrote:
>> I'm playing with Fuseki using a config file:
>>
>> fuseki-server --config <config-file> --update dataset
>>
>> Where <config-file> declares several services, all of which have
>> associated tdb files.
>>
>> When I use:
>>
>> s-update --file <sparql-file> --service
>> http://localhost:3030/myService/update
>>
>> The update works just fine, but update does not persist if I kill the
>> fuseki-server and restart with the same arguments. I note that several
>> files within the associated TDB directory have updated timestamps, but
>> querying against the new inserts produces an empty result set.
>>
>> Are there config options or something else one needs to provide in order
>> to ensure such persistence?
>>
>> Thanks,
>>
>
>


Re: fuseki update not persisting between sessions

Posted by Andy Seaborne <an...@apache.org>.
Eric,


That needs investigating - it should work.  It looks like it might be 
connected to Audun's report "Problem persisting N-Triples" as this 
erroneous behaviour is characteristic of unflushed caches.

Could you tell me what

    fuseki-server --version

reports?

Could you also say what's in the configuration file?

	Andy

On 14/01/12 20:32, Eric Scott wrote:
> I'm playing with Fuseki using a config file:
>
> fuseki-server --config <config-file> --update dataset
>
> Where <config-file> declares several services, all of which have
> associated tdb files.
>
> When I use:
>
> s-update --file <sparql-file> --service
> http://localhost:3030/myService/update
>
> The update works just fine, but update does not persist if I kill the
> fuseki-server and restart with the same arguments. I note that several
> files within the associated TDB directory have updated timestamps, but
> querying against the new inserts produces an empty result set.
>
> Are there config options or something else one needs to provide in order
> to ensure such persistence?
>
> Thanks,
>