Hello Andy; My responses are below
In looking at improving this area, could you give some background: 1/ What level of inference is the data going to use? Right now, we are interested is OWL reasoning, but as we proceed to larger data where performance may become a factor, I suspect we will find RDFS reasoning to be adequate. OTOH we only need inference at load time so as long as the load time, including inference, is reasonable performance may not be a big factor. The most important inference at the moment is subclass reasoning. 2/ Does the schema/ontology need to be in the dataset and visible to runtime query? Or in a separate file? The ontology is maintained in a separate file from the data and the files are loaded independently. 3/ Does the schema/ontology change incrementally or is it changing to a "new released version", infrequently and with significant changes? The data doesn’t change much once loaded. We do our ontology and data work outside of the graph store and perform file loads. Therefore, I’d say changes once loaded are infrequent, if they occur at all. Hope that helps and thanks again -- Scott Andy On 12/09/2024 20:51, Scott Henninger wrote: > I had a typo. The results I get are: > :T1 :graph1 > > -- Scott > > From: Scott Henninger > Sent: Thursday, September 12, 2024 2:29 PM > To: users@jena.apache.org<mailto:users@jena.apache.org> > Subject: Re: Using Fuseki to query the union of datasets - with inference > > Thank you for the response, Andy. Unfortunately I can’t reproduce what you > describe here. I started Fuseki 5.1 with a config file using the config you > gave me here. I then used the Fuseki “add data” to upload a TriG file with > the data in your example. When I go to query the default graph, I don’t see > any matches for :x. If I do a > SELECT * WHERE { GRAPH ?g { :x rdf:type ?T }} > I only get > :x :graph1 > > Did you run your test different somehow? > > A second question. I thought maybe the inference would appear after > re-starting Fuseki, but the data was erased. I would have thought that { > :tdbDataset a tdb:DatasetTDB } meant the data was saving in TDB, but it > doesn’t seem to be persistent. Why is that? > > Thanks again for all your efforts > -- Scott > > From: Andy Seaborne > <a...@apache.org<mailto:a...@apache.org<mailto:a...@apache.org%3cmailto:a...@apache.org>>> > Sent: Thursday, September 12, 2024 6:10 AM > To: > users@jena.apache.org<mailto:users@jena.apache.org<mailto:users@jena.apache.org%3cmailto:users@jena.apache.org>> > Subject: [EXTERNAL] Re: Using Fuseki to query the union of datasets - with > inference > > CAUTION: This email originated from outside of the organization. Do not click > links or open attachments unless you recognize the sender and know the > content is safe. > > Hi Scott, > > On 09/09/2024 21:28, Scott Henninger wrote: >> Thank you for the config for unionDefaultGraph, Andy. I am able to see the >> data both in the named graph and the default graph with your config. Now I >> want to add inference to the default graph. In that case I do need to go >> through a model, correct? >> >> Below is a config that I’m trying that doesn’t do what I want. I cannot see >> the triples in the default graph and no inferences are created. What am I >> doing wrong here? Specifically what would a config look like that performs >> inferences that appear in the default graph? > > tdb:unionDefaultGraph only makes the SPARQL default graph appear as the > union of named graphs. > > To get the inference code to see a union graph, try a named graph of > <urn:x-arq:UnionGraph> > > The tdb:unionDefaultGraph can be removed unless you want to have > (non-inference) access to the dataset. > > ----- > :defaultDataset a ja:RDFDataset ; > ja:defaultGraph :infModel ; > . > :infModel a ja:InfModel ; > ja:baseModel :tdbGraph ; > ja:reasoner [ > ja:reasonerURL > <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner<http://jena.hpl.hp.com/2003/OWLFBRuleReasoner><http://jena.hpl.hp.com/2003/OWLFBRuleReasoner<http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>>> > ; > ] ; > . > > :tdbGraph a tdb:GraphTDB ; > tdb:dataset :tdbDataset ; > tdb:namedGraph <urn:x-arq:UnionGraph> ## ******* > . > > :tdbDataset a tdb:DatasetTDB ; > tdb:location "DB" ; > . > ----- > > I tried (TriG): > > ----------- > GRAPH :graph1 { > :x rdf:type :T1 . > } > > GRAPH :graph2 { > :T1 rdfs:subClassOf :T2 . > } > ----------- > > query: > SELECT * { :x rdf:type ?T } > > and got T1 and T2. > > >> :service1 rdf:type fuseki:Service ; >> fuseki:name "union-graph-inference" ; >> fuseki:serviceQuery "sparql" ; >> fuseki:dataset : defaultDataset; >> . >> :defaultDataset a ja:RDFDataset ; >> ja:defaultGraph :infModel ; >> . >> :infModel a ja:InfModel ; >> ja:baseModel :tdbGraph ; >> ja:reasoner [ >> ja:reasonerURL >> <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner<http://jena.hpl.hp.com/2003/OWLFBRuleReasoner><http://jena.hpl.hp.com/2003/OWLFBRuleReasoner<http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>><http://jena.hpl.hp.com/2003/OWLFBRuleReasoner<http://jena.hpl.hp.com/2003/OWLFBRuleReasoner><http://jena.hpl.hp.com/2003/OWLFBRuleReasoner<http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>>>> >> ; >> ] ; >> . >> :tdbGraph a tdb:GraphTDB ; >> tdb:dataset :tdbDataset ; >> . >> :tdbDataset a tdb:DatasetTDB ; > > > NB This is TDB1. > It should not affect this query but TDB2 is a better choice long term. > Both work in the illustration above. > TDB2 is more robust and work better in Fuseki. > >> tdb:location "DB" ; >> tdb:unionDefaultGraph true ; >> . >> >> >> Thanks for all your help >> -- Scott >> >> From: Andy Seaborne >> <a...@apache.org<mailto:a...@apache.org<mailto:a...@apache.org%3cmailto:a...@apache.org>>> >> Sent: Saturday, August 24, 2024 9:52 AM >> To: >> users@jena.apache.org<mailto:users@jena.apache.org<mailto:users@jena.apache.org%3cmailto:users@jena.apache.org>> >> Subject: Re: [EXTERNAL] Re: Using Fuseki to query the union of datasets >> >> CAUTION: This email originated from outside of the organization. Do not >> click links or open attachments unless you recognize the sender and know the >> content is safe. >> >> >> >> On 24/07/2024 20:08, Scott Henninger wrote: >>> Thank you for the response, Pedro. However it seems to me that I am already >>> applying the approach you reference in the page. See lines 35-37 int the >>> config file I included. Perhaps I am applying it wrong? If so, where am I >>> going wrong? >> >> You don't need to go through a model. Connect the fuseki:Service to the >> dataset with tdb:unionDefaultGraph >> >> >> :service1 rdf:type fuseki:Service ; >> fuseki:name "union-graph" ; >> fuseki:serviceQuery "sparql" ; >> fuseki:dataset :tdbDataset ; >> >> :tdbDataset rdf:type tdb:DatasetTDB ; >> tdb:location "DB" ; >> tdb:unionDefaultGraph true ; >> . >> >> Andy >> >>> >>> -- Scott >>> >>> From: Pedro >>> <pedro.win.s...@googlemail.com.INVALID<mailto:pedro.win.s...@googlemail.com.INVALID<mailto:pedro.win.s...@googlemail.com.INVALID%3cmailto:pedro.win.s...@googlemail.com.INVALID<mailto:pedro.win.s...@googlemail.com.INVALID%3cmailto:pedro.win.s...@googlemail.com.INVALID%3cmailto:pedro.win.s...@googlemail.com.INVALID%3cmailto:pedro.win.s...@googlemail.com.INVALID>>>> >>> Sent: Tuesday, July 23, 2024 4:35 PM >>> To: >>> users@jena.apache.org<mailto:users@jena.apache.org<mailto:users@jena.apache.org%3cmailto:users@jena.apache.org<mailto:users@jena.apache.org%3cmailto:users@jena.apache.org%3cmailto:users@jena.apache.org%3cmailto:users@jena.apache.org>>> >>> Subject: [EXTERNAL] Re: Using Fuseki to query the union of datasets >>> >>> CAUTION: This email originated from outside of the organization. Do not >>> click links or open attachments unless you recognize the sender and know >>> the content is safe. >>> >>> Hi Scott >>> >>> Look at the TDB and TDB2 examples in >>> https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html><https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html>><https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html><https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html>>><https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html><https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html>><https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html><https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html<https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html>>>> >>> >>> Uncomment the line >>> >>> tdb:unionDefaultGraph true; >>> >>> Cheers! >>> >>> On Tue, 23 Jul 2024, 22:29 Scott Henninger, >>> <scott.hennin...@ecstech.com<mailto:scott.hennin...@ecstech.com<mailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com<mailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com<mailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com%3cmailto:scott.hennin...@ecstech.com>>>>> >>> wrote: >>> >>>> I am attempting to use Fuseki to query the union of a set of datasets. I >>>> am using the following configuration to define a TDB dataset named >>>> "union-graph" and setting tdb:unionDefaultGraph to true to query the union >>>> of the datasets. However when I query "union-graph" I do not see the >>>> triples from the datasets I have populated. How can I configure Fuseki to >>>> query the union of datasets? >>>> >>>> Thank you >>>> -- Scott >>>> >>>> @prefix : <#> . >>>> @prefix fuseki: >>>> <http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#><http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#>><http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#><http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#>>><http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#><http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#>><http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#><http://jena.apache.org/fuseki#<http://jena.apache.org/fuseki#>>>>> >>>> . >>>> @prefix rdf: >>>> <http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#><http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>><http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#><http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>><http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#><http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>><http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#><http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>>>> >>>> . >>>> >>>> @prefix rdfs: >>>> <http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#><http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>><http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#><http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>><http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#><http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>><http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#><http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>>>> >>>> . >>>> @prefix tdb: >>>> <http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#><http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#>><http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#><http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#>>><http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#><http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#>><http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#><http://jena.hpl.hp.com/2008/tdb#<http://jena.hpl.hp.com/2008/tdb#>>>>> >>>> . >>>> @prefix ja: >>>> <http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#><http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>><http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#><http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>>><http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#><http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>><http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#><http://jena.hpl.hp.com/2005/11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>>>>> >>>> . >>>> >>>> [] rdf:type fuseki:Server ; >>>> fuseki:services ( >>>> :service1 >>>> ) . >>>> >>>> # Custom code. >>>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . >>>> >>>> # TDB >>>> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . >>>> tdb:GraphTDB rdfs:subClassOf ja:Model . >>>> >>>> :service1 rdf:type fuseki:Service ; >>>> fuseki:name "union-graph" ; >>>> fuseki:serviceQuery "sparql" ; >>>> fuseki:dataset :dataset ; >>>> . >>>> >>>> :dataset rdf:type ja:RDFDataset ; >>>> ja:defaultGraph :model_default ; >>>> . >>>> >>>> :model_default a ja:InfModel ; >>>> ja:baseModel :tdbGraph ; >>>> . >>>> >>>> :tdbDataset rdf:type tdb:DatasetTDB ; >>>> tdb:location "DB" ; >>>> tdb:unionDefaultGraph true ; >>>> . >>>> >>>> :tdbGraph rdf:type tdb:GraphTDB ; >>>> tdb:dataset :tdbDataset ; >>>> . >>>> >>>>