Re: Fuseki + tdb + reasoner config
Thanks Dave. regards Rohana On 29 January 2014 08:58, Dave Reynolds wrote: > Sorry, I missed this while travelling and just realized it hasn't been > answered. > > There is no named graph support in the reasoners nor is there reasoner/tdb > integration so that I'm afraid that what you want is not possible out of > the box. > > Dave > > > On 24/01/14 16:26, Rohana Rajapakse wrote: > >> Hi, >> >> Can someone pass me a jena tdb config with a reasoner (say rdfs reasoner) >> that applies to all named-graphs. >> >> My application requirements are such that i need to insert/delete data >> into >> existing named-graphs as well as add new datasets into new named graphs on >> the fly. I will be making sparql queries against a given named-graph >> and/or >> the "union graph". In both cases, I would like to find infered-triples. >> >> If the above is not possible, is it possible to configure Fuseki tdb to >> have inferred-triples in the union (default) graph. I am thinking of >> adding >> data into named graphs and querying them on the union graph. In this case, >> when data is inserted into named graphs, the inference engine should >> kick-in and add inferred triples into either into the corresponding named >> graph or if possible into the default union graph. >> >> Hope I explained my requirement clearly. >> >> Rohana >> >> >
Fuseki + tdb + reasoner config
Hi, Can someone pass me a jena tdb config with a reasoner (say rdfs reasoner) that applies to all named-graphs. My application requirements are such that i need to insert/delete data into existing named-graphs as well as add new datasets into new named graphs on the fly. I will be making sparql queries against a given named-graph and/or the "union graph". In both cases, I would like to find infered-triples. If the above is not possible, is it possible to configure Fuseki tdb to have inferred-triples in the union (default) graph. I am thinking of adding data into named graphs and querying them on the union graph. In this case, when data is inserted into named graphs, the inference engine should kick-in and add inferred triples into either into the corresponding named graph or if possible into the default union graph. Hope I explained my requirement clearly. Rohana
Re: Default graph issue (tdb-backed Fuseki)
Thanks Andy. I am now trying to use GenericRuleReasoner. The tdb config is given below. It works fine with data added to the default graph. The query you sent me does not show any triples when I insert data into a graph. I am not sure if the way I configure the inference engine is correct. Can you please see what is wrong. Data Insert Query: == PREFIX owl: <http://www.w3.org/2002/07/owl#> INSERT DATA { GRAPH <http://test> { <http://localhost:3030/resource/Kevin> foaf:lastName "Fernando" . <http://localhost:3030/resource/Peter> foaf:lastName "Fernando" . <http://localhost:3030/resource/Kevin2> foaf:lastName "Fernando" . <http://localhost:3030/resource/Kevin> owl:sameAs < http://localhost:3030/resource/Peter> . <http://localhost:3030/resource/Peter> owl:sameAs < http://localhost:3030/resource/Kevin2> . } } Select Query: == PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT ?s ?s1 ?s2 { { ?s owl:sameAs ?o } UNION { GRAPH { ?s1 owl:sameAs ?o1 } } UNION { GRAPH ?g2 { ?s2 owl:sameAs ?o2 } } } TDB Config 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#> . [] rdf:type fuseki:Server ; # Timeout - server-wide default: milliseconds. # Format 1: "1000" -- 1 second timeout # Format 2: "1,6" -- 10s timeout to first result, then 60s timeout to for rest of query. # See java doc for ARQ.queryTimeout # ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1" ] ; # ja:loadClass "your.code.Class" ; fuseki:services ( <#service_rulesinf> ) . # TDB [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . tdb:GraphTDBrdfs:subClassOf ja:Model . <#service_rulesinf> rdf:type fuseki:Service ; rdfs:label "TDB Service with Generic Rule Reasoner" ; fuseki:name"data" ; # http://host/data fuseki:serviceQuery"sparql" ; # SPARQL query service fuseki:serviceQuery"query" ; fuseki:serviceUpdate "update" ; fuseki:serviceUpload "upload" ; fuseki:serviceReadWriteGraphStore "data" ; fuseki:dataset<#dataset> ; . <#dataset> a ja:RDFDataset; ja:defaultGraph [ a ja:InfModel; ja:reasoner [ ja:reasonerURL < http://jena.hpl.hp.com/2003/GenericRuleReasoner> ; ja:rulesFrom ; ]; ja:baseModel <#data_and_ontology_graph> ]; . <#data_and_ontology_graph> a tdb:GraphTDB ; tdb:location "MYTDB" ; # tdb:unionDefaultGraph true ; . Rules File: @prefix owl: <http://www.w3.org/2002/07/owl#> . @include . [rule1: (?S1 owl:sameAs ?S2),(?S2 owl:sameAs ?S3) ->(?S1 owl:sameAs ?S3) ] On 23 January 2014 16:11, Andy Seaborne wrote: > Hi Rohana, > > > > <#tdb_dataset_read> rdf:type tdb:DatasetTDB ; > > tdb:location "MYTDB" ; > > tdb:unionDefaultGraph true ; > > > > <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; > > tdb:location "MYTDB" ; > > . > > The two descriptions of the datasets point to the same set of files so, > internally, there is one TDB dataset engine, which has to manage all > accesses. > > "tdb:unionDefaultGraph true" is going to set a property of the engine, and > not be sensitive to the route used to name it, so it sets it on the shared > engine. It will apply to both services. > > Sorry that wasn't documented anywhere. > > Andy > > > On 23/01/14 15:06, Rohana Rajapakse wrote: > >> Hi Andy, >> >> I have tested inserting and querying data using with two tdb >> configs. Having "tdb:unionDefaultGraph true ;" in the config for read-only >> endpoint >> seems to affects the update endpoint. >> >> *The queries I am using to insert data and query are:* >> >> >> PREFIX owl: <htt
Re: Default graph issue (tdb-backed Fuseki)
Hi Andy, I have tested inserting and querying data using with two tdb configs. Having "tdb:unionDefaultGraph true ;" in the config for read-only endpoint seems to affects the update endpoint. *The queries I am using to insert data and query are:* PREFIX owl: <http://www.w3.org/2002/07/owl#> INSERT DATA { <http://localhost:3030/resource/Kevin> foaf:lastName "Fernando" . <http://localhost:3030/resource/Peter> foaf:lastName "Fernando" . } PREFIX owl: <http://www.w3.org/2002/07/owl#> select * where { ?s ?p ?o . } I have tried the following tdb config with and without setting tdb:unionDefaultGraph to true (in Fuseki web console against the dataset "/data" which is my update endpoint). In both cases the insert data query returns "Update succeeded" message. The select query, however, shown data triples only when Fuseki is run without setting tdb:unionDefaultGraph to true for READ-ONLY endpoint. I am not useing that endpoint at all (but it is available). Note they both use the same storage location "MYTDB". *Here is the tdb config file:* # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 ## Example of a TDB dataset published using Fuseki: persistent storage. @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#> . [] rdf:type fuseki:Server ; # Timeout - server-wide default: milliseconds. # Format 1: "1000" -- 1 second timeout # Format 2: "1,6" -- 10s timeout to first result, then 60s timeout to for rest of query. # See java doc for ARQ.queryTimeout # ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1" ] ; # ja:loadClass "your.code.Class" ; fuseki:services ( <#service_tdb_read_only> <#service_tdb_all> ) . # TDB [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . tdb:GraphTDBrdfs:subClassOf ja:Model . ## --- ## Read-only TDB dataset (only read services enabled). <#service_tdb_read_only> rdf:type fuseki:Service ; rdfs:label "TDB Service (R)" ; fuseki:name "ds" ; # http://host/ds fuseki:serviceQuery "query" ; fuseki:serviceQuery "sparql" ; # Don't allow SPARQL Update. #fuseki:serviceUpdate"update" ; # Use the read-only service. fuseki:serviceReadGraphStore"data" ; fuseki:serviceReadGraphStore"get" ; fuseki:dataset <#tdb_dataset_read> ; . <#tdb_dataset_read> rdf:type tdb:DatasetTDB ; tdb:location "MYTDB" ; tdb:unionDefaultGraph true ; ##NOTE: I am trying with and without this line . ## --- ## Updatable TDB dataset with all services enabled. <#service_tdb_all> rdf:type fuseki:Service ; rdfs:label "TDB Service (RW)" ; fuseki:name "data" ; # http://host/data fuseki:serviceQuery "query" ; fuseki:serviceQuery "sparql" ; fuseki:serviceUpdate"update" ; fuseki:serviceUpload"upload" ; fuseki:serviceReadWriteGraphStore "data" ; # A separate read-only graph store endpoint: fuseki:serviceReadGraphStore "get" ; fuseki:dataset <#tdb_dataset_readwrite> ; . <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; tdb:location "MYTDB" ; . On 22 January 2014 12:00, Andy Seaborne wrote: > On 22/01/14 11:34, Rohana Rajapakse wrote: > >> Dear Andy, >> >> you are absolutely correct. There is "tdb:unionDefaultGraph true ." in the >> config file for a different (read only) endpoint. It seems to affect the >> entire datastore (not endpoint specific!) >> > > It shouldn't - could you post the whole config file please ? > > Andy > > >> thanks >> >> Rohana >> >> >> On 22 January 2014 11:18, Rohana Rajapakse < >> rohana.rajapa...@gossinteractive.com> wrote: >> >>Yes it works! >>> >>> Can you please tell me what you mean by "running with default union graph >>> on". I thought we always have a default graph, and if no name
Re: Default graph issue (tdb-backed Fuseki)
yes only s1 is set. On 22 January 2014 11:41, Andy Seaborne wrote: > On 22/01/14 11:18, Rohana Rajapakse wrote: > >> Yes it works! >> > > I take you mean ?s1 is set and ?s is not? > > If ?s is set, then check the query you were using to access the data. > > > Can you please tell me what you mean by "running with default union >> graph on". I thought we always have a default graph, and if no >> named-graph is specified in sparql (update or select) queries, the >> operations are performed against the default graph, i.e. triples being >> inserted goes in the default graph and select queries return data in all >> graphs (including the default graph). >> > > That's right and that's the normal mode of operation. A separate default > graph. > > > >> How can use change default union graph to off? >> > > It's off unless something sets it on. > > The ways that can happen are: > > 1/ In the dataset assembler: > > <#dataset> rdf:type tdb:DatasetTDB ; > tdb:location "DB" ; > tdb:unionDefaultGraph true ; > . > > 2/ The server section of the config file: > > ja:context [ ja:cxtName "tdb:unionDefaultGraph" ; ja:cxtValue true ] ; > > 3/ the command line or start up script: > > --set tdb:unionDefaultGraph=true > > > > >> What exactly is the uri of the default graph? >> > > The URI is a pseudo named graph that accesses the > the storage default graph regardless of whether the query default graph is > the union of all named graphs. > > Andy > > >> Thanks >> >> Rohana >> >> -Original Message- >> From: Andy Seaborne [mailto:a...@apache.org] >> Sent: 22 January 2014 11:09 >> To: users@jena.apache.org >> Subject: Re: Default graph issue (tdb-backed Fuseki) >> >> On 22/01/14 09:29, Rohana Rajapakse wrote: >> >>> Hi, >>> >> >> Hi there, >> >> >>> >>> >>> I have a tdb-backed Fuseki installation. I am inserting data using >>> INSERT DATA sparql query (also tried reading triple data from a file) >>> without giving a named-graph uri (with GRAPH keyword), >>> >> >> Did you just use the UI or load the data some other way as well? >> >> the query is executed >>> without errors and in the query forms of the Fuseki web console I see >>> the message “*Update succeeded*”, but a select query without giving a >>> named-graph (with GRAPH <…>) does not show the inserted triples. >>> >> >> Could you try this query please: >> >> SELECT ?s ?s1 ?s2 { >> { ?s ?p ?o } >> UNION >> { GRAPH { ?s1 ?p1 ?o1 } } >> UNION >> { GRAPH ?g2 { ?s2 ?p2 ?o2 } } >> } >> >> It looks like you are running with default union graph on - maybe it was >> set globally when the server was started. >> >> Andy >> >> It all works when I inserted data into a named-graph using the >>> GRAPH<…> >>> >>> >>> >>> Can someone please let me know what is going on. >>> >>> >>> >>> I am using Fuseki-1.0.0 with Jena-2.11.0 >>> >>> >>> >>> Here is the TDB config file: >>> >>> >>> >>> <#service_tdb_all> rdf:type fuseki:Service ; >>> >>> rdfs:label "TDB Service (RW)" ; >>> >>> fuseki:name "data" ; >>> >>> fuseki:serviceQuery "query" ; >>> >>> fuseki:serviceQuery "sparql" ; >>> >>> fuseki:serviceUpdate"update" ; >>> >>> fuseki:serviceUpload"upload" ; >>> >>> fuseki:serviceReadWriteGraphStore "data" ; >>> >>> # A separate read-only graph store endpoint: >>> >>> fuseki:serviceReadGraphStore "get" ; >>> >>> fuseki:dataset <#tdb_dataset_readwrite> ; >>> >>> . >>> >>> >>> >>> <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; >>> >>> tdb:location "MYTDB" ; >>> >>> . >>> >>> >>> >>> >>> >>> Thanks for any help. >>> >>> >>> >>> Rohana >>> >>> >> Keep up-to-date with best practice, new releases, webinars and more with >> our free newsletter: http://www.gossinteractive.com/newsletter >> >> Registered Office: 24 Darklake View, Estover, Plymouth, PL6 7TL. >> >> Company Registration No: 3553908 >> >> This email contains proprietary information, some or all of which may be >> legally privileged. It is for the intended recipient only. If an >> addressing or transmission error has misdirected this email, please >> notify the author by replying to this email. If you are not the intended >> recipient you may not use, disclose, distribute, copy, print or rely on >> this email. >> >> Email transmission cannot be guaranteed to be secure or error free, as >> information may be intercepted, corrupted, lost, destroyed, arrive late >> or incomplete or contain viruses. This email and any files attached to >> it have been checked with virus detection software before transmission. >> You should nonetheless carry out your own virus check before opening any >> attachment. GOSS Interactive Ltd accepts no liability for any loss or >> damage that may be caused by software viruses. >> >> <#> >> > >
Re: Default graph issue (tdb-backed Fuseki)
Dear Andy, you are absolutely correct. There is "tdb:unionDefaultGraph true ." in the config file for a different (read only) endpoint. It seems to affect the entire datastore (not endpoint specific!) thanks Rohana On 22 January 2014 11:18, Rohana Rajapakse < rohana.rajapa...@gossinteractive.com> wrote: > Yes it works! > > Can you please tell me what you mean by "running with default union graph > on". I thought we always have a default graph, and if no named-graph is > specified in sparql (update or select) queries, the operations are > performed against the default graph, i.e. triples being inserted goes in > the default graph and select queries return data in all graphs (including > the default graph). > > How can use change default union graph to off? > > What exactly is the uri of the default graph? > > Thanks > > Rohana > > > -Original Message- > From: Andy Seaborne [mailto:a...@apache.org ] > Sent: 22 January 2014 11:09 > To: users@jena.apache.org > Subject: Re: Default graph issue (tdb-backed Fuseki) > > On 22/01/14 09:29, Rohana Rajapakse wrote: > > Hi, > > Hi there, > > > > > > > > > I have a tdb-backed Fuseki installation. I am inserting data using > > INSERT DATA sparql query (also tried reading triple data from a file) > > without giving a named-graph uri (with GRAPH keyword), > > Did you just use the UI or load the data some other way as well? > > > the query is executed > > without errors and in the query forms of the Fuseki web console I see > > the message “*Update succeeded*”, but a select query without giving a > > named-graph (with GRAPH <…>) does not show the inserted triples. > > Could you try this query please: > > SELECT ?s ?s1 ?s2 { >{ ?s ?p ?o } >UNION >{ GRAPH { ?s1 ?p1 ?o1 } } >UNION >{ GRAPH ?g2 { ?s2 ?p2 ?o2 } } > } > > It looks like you are running with default union graph on - maybe it was > set globally when the server was started. > > Andy > > > It all works when I inserted data into a named-graph using the > > GRAPH<…> > > > > > > > > Can someone please let me know what is going on. > > > > > > > > I am using Fuseki-1.0.0 with Jena-2.11.0 > > > > > > > > Here is the TDB config file: > > > > > > > > <#service_tdb_all> rdf:type fuseki:Service ; > > > > rdfs:label "TDB Service (RW)" ; > > > > fuseki:name "data" ; > > > > fuseki:serviceQuery "query" ; > > > > fuseki:serviceQuery "sparql" ; > > > > fuseki:serviceUpdate"update" ; > > > > fuseki:serviceUpload"upload" ; > > > > fuseki:serviceReadWriteGraphStore "data" ; > > > > # A separate read-only graph store endpoint: > > > > fuseki:serviceReadGraphStore "get" ; > > > > fuseki:dataset <#tdb_dataset_readwrite> ; > > > > . > > > > > > > > <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; > > > > tdb:location "MYTDB" ; > > > > . > > > > > > > > > > > > Thanks for any help. > > > > > > > > Rohana > > > > > > Keep up-to-date with best practice, new releases, webinars and more with > our free newsletter: > http://www.gossinteractive.com/newsletter > > Registered Office: 24 Darklake View, Estover, Plymouth, PL6 7TL. > > Company Registration No: 3553908 > > This email contains proprietary information, some or all of which may be > legally privileged. It is for the intended recipient only. If an addressing > or transmission error has misdirected this email, please notify the author > by replying to this email. If you are not the intended recipient you may > not use, disclose, distribute, copy, print or rely on this email. > > Email transmission cannot be guaranteed to be secure or error free, as > information may be intercepted, corrupted, lost, destroyed, arrive late or > incomplete or contain viruses. This email and any files attached to it have > been checked with virus detection software before transmission. You should > nonetheless carry out your own virus check before opening any attachment. > GOSS Interactive Ltd accepts no liability for any loss or damage that may > be caused by software viruses. > <#143b9ad660b1e235_> >
RE: Default graph issue (tdb-backed Fuseki)
Yes it works! Can you please tell me what you mean by "running with default union graph on". I thought we always have a default graph, and if no named-graph is specified in sparql (update or select) queries, the operations are performed against the default graph, i.e. triples being inserted goes in the default graph and select queries return data in all graphs (including the default graph). How can use change default union graph to off? What exactly is the uri of the default graph? Thanks Rohana -Original Message- From: Andy Seaborne [mailto:a...@apache.org] Sent: 22 January 2014 11:09 To: users@jena.apache.org Subject: Re: Default graph issue (tdb-backed Fuseki) On 22/01/14 09:29, Rohana Rajapakse wrote: > Hi, Hi there, > > > > I have a tdb-backed Fuseki installation. I am inserting data using > INSERT DATA sparql query (also tried reading triple data from a file) > without giving a named-graph uri (with GRAPH keyword), Did you just use the UI or load the data some other way as well? > the query is executed > without errors and in the query forms of the Fuseki web console I see > the message "*Update succeeded*", but a select query without giving a > named-graph (with GRAPH <...>) does not show the inserted triples. Could you try this query please: SELECT ?s ?s1 ?s2 { { ?s ?p ?o } UNION { GRAPH { ?s1 ?p1 ?o1 } } UNION { GRAPH ?g2 { ?s2 ?p2 ?o2 } } } It looks like you are running with default union graph on - maybe it was set globally when the server was started. Andy > It all works when I inserted data into a named-graph using the > GRAPH<...> > > > > Can someone please let me know what is going on. > > > > I am using Fuseki-1.0.0 with Jena-2.11.0 > > > > Here is the TDB config file: > > > > <#service_tdb_all> rdf:type fuseki:Service ; > > rdfs:label "TDB Service (RW)" ; > > fuseki:name "data" ; > > fuseki:serviceQuery "query" ; > > fuseki:serviceQuery "sparql" ; > > fuseki:serviceUpdate"update" ; > > fuseki:serviceUpload"upload" ; > > fuseki:serviceReadWriteGraphStore "data" ; > > # A separate read-only graph store endpoint: > > fuseki:serviceReadGraphStore "get" ; > > fuseki:dataset <#tdb_dataset_readwrite> ; > > . > > > > <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; > > tdb:location "MYTDB" ; > > . > > > > > > Thanks for any help. > > > > Rohana > Keep up-to-date with best practice, new releases, webinars and more with our free newsletter: http://www.gossinteractive.com/newsletter Registered Office: 24 Darklake View, Estover, Plymouth, PL6 7TL. Company Registration No: 3553908 This email contains proprietary information, some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this email, please notify the author by replying to this email. If you are not the intended recipient you may not use, disclose, distribute, copy, print or rely on this email. Email transmission cannot be guaranteed to be secure or error free, as information may be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. This email and any files attached to it have been checked with virus detection software before transmission. You should nonetheless carry out your own virus check before opening any attachment. GOSS Interactive Ltd accepts no liability for any loss or damage that may be caused by software viruses.
Default graph issue (tdb-backed Fuseki)
Hi, I have a tdb-backed Fuseki installation. I am inserting data using INSERT DATA sparql query (also tried reading triple data from a file) without giving a named-graph uri (with GRAPH keyword), the query is executed without errors and in the query forms of the Fuseki web console I see the message “*Update succeeded*”, but a select query without giving a named-graph (with GRAPH <…>) does not show the inserted triples. It all works when I inserted data into a named-graph using the GRAPH<…> Can someone please let me know what is going on. I am using Fuseki-1.0.0 with Jena-2.11.0 Here is the TDB config file: <#service_tdb_all> rdf:type fuseki:Service ; rdfs:label "TDB Service (RW)" ; fuseki:name "data" ; fuseki:serviceQuery "query" ; fuseki:serviceQuery "sparql" ; fuseki:serviceUpdate"update" ; fuseki:serviceUpload"upload" ; fuseki:serviceReadWriteGraphStore "data" ; # A separate read-only graph store endpoint: fuseki:serviceReadGraphStore "get" ; fuseki:dataset <#tdb_dataset_readwrite> ; . <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; tdb:location "MYTDB" ; . Thanks for any help. Rohana