You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Сергей Антоненко <ly...@gmail.com> on 2014/05/11 22:01:45 UTC
Persisting named graphs in TDB with jena-fuseki
Hello everybody.
I have jena-fuseki-1.0.1 configured using this file:
///
@prefix : <#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
[] rdf:type fuseki:Server ;
fuseki:services (
<#tdb>
) .
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
<#tdb> rdf:type fuseki:Service;
fuseki:name "tdb";
fuseki:serviceQuery "sparql";
fuseki:serviceUpdate "update";
fuseki:serviceReadWriteGraphStore "data";
fuseki:dataset <#dataset>.
tdb:GraphTDB
rdfs:subClassOf ja:Model.
<#dataset>
rdf:type ja:RDFDataset.
<#tdbGraph>
rdf:type tdb:GraphTDB;
tdb:location "DB".
///
To reproduce an error, I make this query sequence:
///
CLEAR ALL;
///
PREFIX example: <http://example.org/>
CREATE GRAPH example:graphs
///
PREFIX example: <http://example.org/>
WITH example:graphs
INSERT {
example:graph1 a example:graph.
example:graph2 a example:graph.
} WHERE {}
///
Then I perform SELECT query:
///
PREFIX example: <http://example.org/>
SELECT * WHERE {
GRAPH example:graphs {
?s ?p ?o
}
}
///
Which returns me correct result:
///
--------------------------------------------------------------------------------------
| s | p |
o |
======================================================================================
| example:graph1 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
example:graph |
| example:graph2 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
example:graph |
--------------------------------------------------------------------------------------
///
But after restarting fuseki server, the query above returns empty set. And
all the data in default graph remains in database.
Why does it happen? Is this a kind of a problem I can fix?
Re: Persisting named graphs in TDB with jena-fuseki
Posted by Dave Reynolds <da...@gmail.com>.
Indeed the rule reasoner pre-dates the notion of datasets and only
applies to a model = set of triples.
Dave
On 12/05/14 19:12, Сергей Антоненко wrote:
> Thanks, I've understood my problem.
>
> I was trying to produce minimal config version to reproduce the bigger
> problem.
>
> I am using a generic jena rules reasoner and I'm trying to make it work for
> all named graphs. But it seems like it can be applied only to a model
> (which as I believe is just a more complex representation of graph of
> triples, not quads) and I needed it for whole dataset.
>
> What I need is basic forward-chain rule reasoner inside each named graph,
> without no interference this others.
>
> I was trying all combinations I could image for assembler config file, but
> it was just named graph persistence was broke or reasoning not working. Or
> both.
>
> So what do I do? Am I doing something logically wrong and it's not fixable,
> or I need some more configuration magic, or I need to write some java code
> to create my own smart dataset implementation with all blackjack and
> hookers I need?
>
>
>
>
> On 12 May 2014 16:23, Andy Seaborne <an...@apache.org> wrote:
>
>> Hi there,
>>
>> Your setup creates an in-memory dataset and put a single graph from TDB
>> into that dataset and only that graph. New graphs will go into the
>> in-memory dataset, which isn't persistent.
>>
>> SPARQL operations act on datasets.
>>
>> Is there a specific reason for this setup?
>>
>> To attach the whole TDB dataset to the server, use:
>>
>> ...
>> fuseki:dataset <#dataset>.
>>
>> <#dataset> tdb:DatasetTDB ;
>> tdb:location "DB" ;
>> .
>> ...
>>
>> then new graphs go into TDB (transactionally).
>>
>> Andy
>>
>>
>> On 11/05/14 21:01, Сергей Антоненко wrote:
>>
>>> Hello everybody.
>>>
>>> I have jena-fuseki-1.0.1 configured using this file:
>>>
>>> ///
>>> @prefix : <#> .
>>> @prefix fuseki: <http://jena.apache.org/fuseki#> .
>>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>>> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
>>> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
>>> @prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
>>>
>>> [] rdf:type fuseki:Server ;
>>> fuseki:services (
>>> <#tdb>
>>> ) .
>>>
>>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>>>
>>> <#tdb> rdf:type fuseki:Service;
>>> fuseki:name "tdb";
>>> fuseki:serviceQuery "sparql";
>>> fuseki:serviceUpdate "update";
>>> fuseki:serviceReadWriteGraphStore "data";
>>> fuseki:dataset <#dataset>.
>>>
>>> tdb:GraphTDB
>>> rdfs:subClassOf ja:Model.
>>>
>>> <#dataset>
>>> rdf:type ja:RDFDataset.
>>>
>>> <#tdbGraph>
>>> rdf:type tdb:GraphTDB;
>>> tdb:location "DB".
>>> ///
>>>
>>> To reproduce an error, I make this query sequence:
>>>
>>> ///
>>> CLEAR ALL;
>>> ///
>>> PREFIX example: <http://example.org/>
>>> CREATE GRAPH example:graphs
>>> ///
>>> PREFIX example: <http://example.org/>
>>>
>>> WITH example:graphs
>>> INSERT {
>>> example:graph1 a example:graph.
>>> example:graph2 a example:graph.
>>> } WHERE {}
>>> ///
>>>
>>
>> Same effect with INSERT DATA
>>
>> INSERT DATA {
>> GRAPH example:graphs {
>>
>> example:graph1 a example:graph.
>> example:graph2 a example:graph.
>> }
>> }
>>
>>
>>> Then I perform SELECT query:
>>> ///
>>> PREFIX example: <http://example.org/>
>>> SELECT * WHERE {
>>> GRAPH example:graphs {
>>> ?s ?p ?o
>>> }
>>> }
>>> ///
>>>
>>> Which returns me correct result:
>>> ///
>>>
>>> ------------------------------------------------------------
>>> --------------------------
>>> | s | p |
>>> o |
>>> ============================================================
>>> ==========================
>>> | example:graph1 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
>>> example:graph |
>>> | example:graph2 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
>>> example:graph |
>>> ------------------------------------------------------------
>>> --------------------------
>>>
>>> ///
>>>
>>> But after restarting fuseki server, the query above returns empty set. And
>>> all the data in default graph remains in database.
>>>
>>> Why does it happen? Is this a kind of a problem I can fix?
>>>
>>>
>>
>
Re: Persisting named graphs in TDB with jena-fuseki
Posted by Сергей Антоненко <ly...@gmail.com>.
Thanks, I've understood my problem.
I was trying to produce minimal config version to reproduce the bigger
problem.
I am using a generic jena rules reasoner and I'm trying to make it work for
all named graphs. But it seems like it can be applied only to a model
(which as I believe is just a more complex representation of graph of
triples, not quads) and I needed it for whole dataset.
What I need is basic forward-chain rule reasoner inside each named graph,
without no interference this others.
I was trying all combinations I could image for assembler config file, but
it was just named graph persistence was broke or reasoning not working. Or
both.
So what do I do? Am I doing something logically wrong and it's not fixable,
or I need some more configuration magic, or I need to write some java code
to create my own smart dataset implementation with all blackjack and
hookers I need?
On 12 May 2014 16:23, Andy Seaborne <an...@apache.org> wrote:
> Hi there,
>
> Your setup creates an in-memory dataset and put a single graph from TDB
> into that dataset and only that graph. New graphs will go into the
> in-memory dataset, which isn't persistent.
>
> SPARQL operations act on datasets.
>
> Is there a specific reason for this setup?
>
> To attach the whole TDB dataset to the server, use:
>
> ...
> fuseki:dataset <#dataset>.
>
> <#dataset> tdb:DatasetTDB ;
> tdb:location "DB" ;
> .
> ...
>
> then new graphs go into TDB (transactionally).
>
> Andy
>
>
> On 11/05/14 21:01, Сергей Антоненко wrote:
>
>> Hello everybody.
>>
>> I have jena-fuseki-1.0.1 configured using this file:
>>
>> ///
>> @prefix : <#> .
>> @prefix fuseki: <http://jena.apache.org/fuseki#> .
>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
>> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
>> @prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
>>
>> [] rdf:type fuseki:Server ;
>> fuseki:services (
>> <#tdb>
>> ) .
>>
>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>>
>> <#tdb> rdf:type fuseki:Service;
>> fuseki:name "tdb";
>> fuseki:serviceQuery "sparql";
>> fuseki:serviceUpdate "update";
>> fuseki:serviceReadWriteGraphStore "data";
>> fuseki:dataset <#dataset>.
>>
>> tdb:GraphTDB
>> rdfs:subClassOf ja:Model.
>>
>> <#dataset>
>> rdf:type ja:RDFDataset.
>>
>> <#tdbGraph>
>> rdf:type tdb:GraphTDB;
>> tdb:location "DB".
>> ///
>>
>> To reproduce an error, I make this query sequence:
>>
>> ///
>> CLEAR ALL;
>> ///
>> PREFIX example: <http://example.org/>
>> CREATE GRAPH example:graphs
>> ///
>> PREFIX example: <http://example.org/>
>>
>> WITH example:graphs
>> INSERT {
>> example:graph1 a example:graph.
>> example:graph2 a example:graph.
>> } WHERE {}
>> ///
>>
>
> Same effect with INSERT DATA
>
> INSERT DATA {
> GRAPH example:graphs {
>
> example:graph1 a example:graph.
> example:graph2 a example:graph.
> }
> }
>
>
>> Then I perform SELECT query:
>> ///
>> PREFIX example: <http://example.org/>
>> SELECT * WHERE {
>> GRAPH example:graphs {
>> ?s ?p ?o
>> }
>> }
>> ///
>>
>> Which returns me correct result:
>> ///
>>
>> ------------------------------------------------------------
>> --------------------------
>> | s | p |
>> o |
>> ============================================================
>> ==========================
>> | example:graph1 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
>> example:graph |
>> | example:graph2 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
>> example:graph |
>> ------------------------------------------------------------
>> --------------------------
>>
>> ///
>>
>> But after restarting fuseki server, the query above returns empty set. And
>> all the data in default graph remains in database.
>>
>> Why does it happen? Is this a kind of a problem I can fix?
>>
>>
>
Re: Persisting named graphs in TDB with jena-fuseki
Posted by Andy Seaborne <an...@apache.org>.
Hi there,
Your setup creates an in-memory dataset and put a single graph from TDB
into that dataset and only that graph. New graphs will go into the
in-memory dataset, which isn't persistent.
SPARQL operations act on datasets.
Is there a specific reason for this setup?
To attach the whole TDB dataset to the server, use:
...
fuseki:dataset <#dataset>.
<#dataset> tdb:DatasetTDB ;
tdb:location "DB" ;
.
...
then new graphs go into TDB (transactionally).
Andy
On 11/05/14 21:01, Сергей Антоненко wrote:
> Hello everybody.
>
> I have jena-fuseki-1.0.1 configured using this file:
>
> ///
> @prefix : <#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
> @prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> .
>
> [] rdf:type fuseki:Server ;
> fuseki:services (
> <#tdb>
> ) .
>
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>
> <#tdb> rdf:type fuseki:Service;
> fuseki:name "tdb";
> fuseki:serviceQuery "sparql";
> fuseki:serviceUpdate "update";
> fuseki:serviceReadWriteGraphStore "data";
> fuseki:dataset <#dataset>.
>
> tdb:GraphTDB
> rdfs:subClassOf ja:Model.
>
> <#dataset>
> rdf:type ja:RDFDataset.
>
> <#tdbGraph>
> rdf:type tdb:GraphTDB;
> tdb:location "DB".
> ///
>
> To reproduce an error, I make this query sequence:
>
> ///
> CLEAR ALL;
> ///
> PREFIX example: <http://example.org/>
> CREATE GRAPH example:graphs
> ///
> PREFIX example: <http://example.org/>
>
> WITH example:graphs
> INSERT {
> example:graph1 a example:graph.
> example:graph2 a example:graph.
> } WHERE {}
> ///
Same effect with INSERT DATA
INSERT DATA {
GRAPH example:graphs {
example:graph1 a example:graph.
example:graph2 a example:graph.
}
}
>
> Then I perform SELECT query:
> ///
> PREFIX example: <http://example.org/>
> SELECT * WHERE {
> GRAPH example:graphs {
> ?s ?p ?o
> }
> }
> ///
>
> Which returns me correct result:
> ///
>
> --------------------------------------------------------------------------------------
> | s | p |
> o |
> ======================================================================================
> | example:graph1 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
> example:graph |
> | example:graph2 | <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> |
> example:graph |
> --------------------------------------------------------------------------------------
>
> ///
>
> But after restarting fuseki server, the query above returns empty set. And
> all the data in default graph remains in database.
>
> Why does it happen? Is this a kind of a problem I can fix?
>