On 20/03/13 21:21, Niclas Hoyer wrote:
Hi,
I try to get a TDB dataset with a union default graph and a reasoner to
work.
For a simple TDB dataset with a union default graph I used:
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
<#dataset> a tdb:DatasetTDB ;
tdb:location "ds" ;
tdb:unionDefaultGraph true .
For reasoning with TDB I used:
<#dataset> a ja:RDFDataset ;
ja:defaultGraph <#model> .
>
<#model> a ja:InfModel ;
ja:baseModel <#tdbGraph> ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
] .
<#tdbGraph> a tdb:GraphTDB ;
tdb:location "ds" .
Now I have no clue how to bring them together. The domain of
tdb:unionDefaultGraph is tdb:DatasetTDB, but the example with reasoning
uses ja:RDFDataset.
Is it even possible to use reasoning with a union default graph?
You don't need to bring the <#datasets> together.
<#dataset> a ja:RDFDataset ;
is fine - a general purpose, in-memory dataset to hold the inference and
be the target for the query.
You then need to define the base data.
<#tdbDataset> rdf:type tdb:DatasetTDB ;
tdb:location "ds" ;
tdb:unionDefaultGraph true .
<#tdbGraph> rdf:type tdb:GraphTDB ;
tdb:dataset <#dataset> .
i.e. the TDB dataset is only there to hook the TDB graph into the system.
You'll need to use <#dataset> in the service.
Full example:
-------------------------------------
@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 ;
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 "inf" ; # http://host/inf
fuseki:serviceQuery "sparql" ; # SPARQL query service
fuseki:dataset <#dataset> ;
.
<#dataset> rdf:type ja:RDFDataset ;
ja:defaultGraph <#model_inf> ;
.
<#model_inf> a ja:InfModel ;
ja:baseModel <#tdbGraph> ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
] .
<#tdbDataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;
tdb:unionDefaultGraph true .
<#tdbGraph> rdf:type tdb:GraphTDB ;
tdb:dataset <#tdbDataset> .
-------------------------------------
Regards,
Niclas