Thanks for the response, Andy. For question 1 I get just the one row (:x :graph1)
For question2 I am uploading a trig file with the two graph definitions via the Fuseki “add data” user interface. So both named graphs are being uploaded in the same file. Thanks again -- Scott From: Andy Seaborne <a...@apache.org> Sent: Sunday, September 15, 2024 10:21 AM To: 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. On 12/09/2024 20:29, Scott Henninger wrote: > 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? In the config.ttl I gave, only the :tdbGraph, which connects to <urn:x-arq:UnionGraph>, the internal name for the union default graph marked at "## *******" Does SELECT * WHERE { :x rdf:type ?T } give two rows? > 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? How are you updating the data? Which named graph? --- For RDFS, range+domain, subClass, subProperty: This has two features that are different to what you describe: 1. The schema is in a separate graph, often a file. 2. It does not work for unionDefaultGraph which is a feature omission. (2) ought to be fixed. It happens because DatasetRDFS works using the Java API not via SPARQL; unionDefaultGraph is a SPARQL effect. ---- ---- fuseki:dataset :rdfsDataset ; . ## RDFS :rdfsDataset rdf:type ja:DatasetRDFS ; ja:rdfsSchema <file:schema.ttl>; ja:dataset :baseDataset; . :tdbDataset a tdb2:DatasetTDB ; tdb2:location "DB2" ; tdb2:unionDefaultGraph true ; . ---- ---- Andy > Thanks again for all your efforts > -- Scott > > From: Andy Seaborne <a...@apache.org<mailto:a...@apache.org>> > Sent: Thursday, September 12, 2024 6:10 AM > To: users@jena.apache.org<mailto: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 ; >>>> . >>>> >>>>