Thank you for your quick response.
The idea is to use SPARQL directly against Fuseki and allow the user to upload
new graphs into the dataset as named graphs using the web-interface. I've
already looked into that example, I think. At least my config file includes
this setup. The reasoning does work using SPARQL queries against Fuseki, but
only for the default graph and not the named graphs in that dataset.
Additionally, the unionising of the named graphs into the default graph does
not work, which I can't explain. The definition of my tdbDataset is the
following (I've sent the complete config at the bottom of my first mail):
<#tdbDataset> rdf:type tdb:DatasetTDB ; tdb:location "DB" ; ## If the
unionDefaultGraph is used, then the "update" service should be removed. <-- I
also did that
## The unionDefaultGraph is read only.
tdb:unionDefaultGraph true ;
.
Regarding the second example you sent: As I understand, this would allow me to
add named graphs in the config file, but what about those I would like to add
later on? Is it possible to include/create a reasoner that works on the entire
dataset - including named graphs that are added - or do I have to add all
graphs in the config file at the start of the Fuseki server?
-----Ursprüngliche Nachricht-----
Von: ajs6f [mailto:[email protected]]
Gesendet: Donnerstag, 21. Dezember 2017 22:29
An: [email protected]
Betreff: Re: Reasoning over multiple graphs following the same schema
_How_ are you trying to use this setup: are you expecting to use the Java API
to query this setup, or just use SPARQL directly against Fuseki?
If you use the Java API, you can set up whatever ontological models you want
over whatever named graphs or unions you want (although performance may or may
not be what you want).
If you expect to just send SPARQL against Fuseki and have the inference occur
automatically as part of the process of answering your queries, it's a
different story... there is an example here:
https://github.com/apache/jena/blob/master/jena-fuseki2/examples/service-inference-2.ttl
of what I think you are trying to do. Perhaps you can try it directly?
As for using the named graphs, we do have examples in our test of assembler RDF
incantations like:
<#graph> rdf:type tdb:GraphTDB ;
tdb:location "/my/tdb/DB" ;
tdb:graphName "http://example.com/graph" .
so it might be worth trying something like that, or something like that with
the tdb:dataset property, a la:
<#tdbGraph> rdf:type tdb:GraphTDB ;
tdb:dataset <#tdbDataset> ;
tdb:graphName "http://example.com/graph" .
Then you could use the same
<#model_inf> a ja:InfModel ;
ja:baseModel <#tdbGraph> ; etc.
That may or may not work, and if it doesn't, we can try and figure out why and
whether it would be possible to add that feature. (Andy or Dave may have some
insight already for this.)
ajs6f
> On Dec 21, 2017, at 1:12 PM, Wagner, Anna <[email protected]> wrote:
>
> Hi there,
>
> hopefully this question wasn't already asked a hundred times, but I haven't
> found anything quite the same in the archives.
> First off: my use case is that I want to store multiple named graphs within
> one dataset, all of which are based on the same schema. Now I'd like to use a
> reasoner for all of these named graphs. To make it even more complicated, it
> would also be a nice feature, if all these named graphs would be unionised in
> the default graph, so I could also use the reasoner for all of them at the
> same time.
> Now here's what I've done so far: the base for my Fuseki is a TDB according
> to this example I've found
> (http://krr.cs.vu.nl/wp-content/uploads/2013/09/protege-fuseki-yasgui-manual.pdf),
> the inferring is working fine for the default graph (the default graph only,
> though). So I tried to unionise the named graphs in the default graph,
> thinking this would allow me to maybe just store the basic schema in the
> default graph and infer through the entire data instead of the named graphs.
> And that's my problem right now: somehow (I'm guessing as always the bug is
> sitting right in front of the monitor, but I really can't find my mistake,
> unfortunately), the unionising does not work. I've enabled it within the
> DatasetTDB in the config file, but I cannot even call not-inferred
> information from the named graphs using the default graph. Could you maybe
> explain to me what I'm doing wrong here? Also, I still have the problem, that
> I'd like to infer my named graphs only, too. But to my understanding from the
> mailinglist archive this is not possible, isn't it?
>
> Thank you very much for your help
> Anna
>
> This is my config.ttl, setting up the Fuseki works without problems, the
> effects are just not the way I imagined.
>
> # Licensed under the terms of
> http://www.apache.org/licenses/LICENSE-2.0
> @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 .
> ## ---------------------------------------------------------------
> ## Service with only SPARQL query on an inference model.
> ## Inference model bbase data in TDB.
> <#service1> rdf:type fuseki:Service ;
> fuseki:name "ViKoDB" ; # http://host/inf fuseki:serviceQuery "sparql"
> ; # SPARQL query service ## fuseki:serviceUpdate "update" ;
> fuseki:serviceUpload "upload" ; # Non-SPARQL upload service
> fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store
> protocol (read and write) ## A separate read-only graph store endpoint:
> fuseki:serviceReadGraphStore "get" ; # SPARQL Graph store protocol
> (read only) 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> ;
> ja:schema <#solconpro_model> #this is me adding a local ttl file
> containing my basic schema to the ReasonerFactory ] .
> <#solconpro_model> a ja:MemoryModel ;
> ja:content [ja:externalContent <file:solconpro.ttl>] .
> <#tdbDataset> rdf:type tdb:DatasetTDB ; tdb:location "DB" ; ## If the
> unionDefaultGraph is used, then the "update" service should be removed.
> ## The unionDefaultGraph is read only.
> tdb:unionDefaultGraph true ;
> .
> <#tdbGraph> rdf:type tdb:GraphTDB ;
> tdb:dataset <#tdbDataset> .
>
> _____________________________________________
> Anna Wagner, M.Sc.
> Wissenschaftliche Mitarbeiterin
> Technische Universität Darmstadt
> Institut für Numerische Methoden und Informatik im Bauwesen
> Franziska-Braun-Str. 7
> D-64287 Darmstadt
> Germany
>
> Tel: +49 (0)6151 - 16 21335
> Fax: +49 (0)6151 - 16 21339
>
> [email protected]
> http://www.iib.tu-darmstadt.de
>