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> ;
    ] ;
    .

: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>>
 ;
     ] ;
.
: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>
Sent: Saturday, August 24, 2024 9:52 AM
To: 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>>
Sent: Tuesday, July 23, 2024 4:35 PM
To: users@jena.apache.org<mailto: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>>

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>>>
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#>>>
 .
@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#>>>
 .

@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#>>>
 .
@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#>>>
 .
@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#>>>
 .

[] 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 ;
.



Reply via email to