Hi Kamal,
There is an RDFS reasoner which is dataset-aware.
https://jena.apache.org/documentation/rdfs/
but the subsystem around "ja:reasoner" is per-graph. This is true for
the Jena supplied reasoners as well as the Openllet integration - the
interface is a graph. Openllet is not dataset-aware and is set up to
work with a specific graph.
This has two consequences:
1/ New graphs need a Fuseki config change.
2/ Updates to graphs must go through the reasoner because reasoners
cache. Sending direct to the storage graph will not update a reasoner.
What might help you is the ability to push new configuration dataset
configurations at run time in the war file and apache-jena-fuseki
packagings of Fuseki. This is the protocol of the admin interface
Have one dataset (each with a unique fuseki:name) per ttl file.
POST the assembler description of the fuseki:Service to /$/datasets.
(Ideally, Fuseki would be able to reload the single combined
configuration without restart but that's not yet available.)
Andy
On 23/06/2022 09:52, Kamil Dobrowolski wrote:
Hi,
In my project i have to provide possibility to store data in a named
graphs.
New graph can be created in runtime - import ttl file into specified
named graph.
Seems straightforward. Problem is when reasoners spring into action.
In application it has to be possible to query 'raw' data and
inferenced data.
When new graph is created it should be available for querying both -
with and without reasoning.
For 'raw' data - no problem, pure fuseki service - don't want to use a
union graph :
########################################################################
/:data_service rdf:type fuseki:Service ;
fuseki:name "data-service" ;
fuseki:serviceQuery "query" , "sparql" ;
fuseki:serviceReadGraphStore "get" ;
fuseki:serviceReadWriteGraphStore "data" ;
fuseki:serviceUpdate "update" ;
fuseki:serviceUpload "upload" ;
fuseki:dataset :base_nounion_dataset_tdb2 ;
.
:base_nounion_dataset_tdb2 rdf:type tdb2:DatasetTDB2 ;
tdb2:unionDefaultGraph false;
tdb2:location
"C:/dev/dev_tools/apache-jena-fuseki-4.4.0/run/databases/test_nu";/
.
########################################################################
Reasoner - here is the problem. I have no idea how to force Fuseki to
build inferences over dynamically created named graphs.
Only solution i found is to 'put' reasoning on every named graph in
config.ttl:
########################################################################
/:reasoner_service rdf:type fuseki:Service ;
fuseki:name "reasoner-service" ;
fuseki:serviceQuery "query" , "sparql" ;
fuseki:dataset :namedgraphs_reasoner_dataset_tdb2 ;
.
:namedgraphs_reasoner_dataset_tdb2 rdf:type ja:RDFDataset;
ja:namedGraph [ ja:graph <#first_named_reasoner_inferenceModel> ;
ja:graphName <http://test.test/first <http://test.test/first>> ];
ja:namedGraph [ ja:graph <#second_named_reasoner_inferenceModel> ;
ja:graphName <http://test.test/second <http://test.test/second>> ];
.
<#first_named_reasoner_inferenceModel> a ja:InfModel;
ja:reasoner [ ja:reasonerClass
"openllet.jena.PelletReasonerFactory"];
ja:baseModel <#first_named_reasoner_graph>;
.
<#first_named_reasoner_graph> rdf:type tdb2:GraphTDB2;
tdb2:dataset :base_nounion_dataset_tdb2;
tdb2:graphName <http://test.test/first <http://test.test/first>> ;
.
<#second_named_reasoner_inferenceModel> a ja:InfModel;
ja:reasoner [ ja:reasonerClass
"openllet.jena.PelletReasonerFactory"];
ja:baseModel <#second_named_reasoner_graph>;
.
<#second_named_reasoner_graph> rdf:type tdb2:GraphTDB2;
tdb2:dataset :base_nounion_dataset_tdb2;
tdb2:graphName <http://test.test/second <http://test.test/second>> ;
./
########################################################################
This is not acceptable option for me. After every new graph creation i
would have to add reasoning configuration for it and restart Fuseki.
I couldn't even find a way to force reasoner (Pellet ) to rebuild its
inference model - it has to be reastarted.
Maybe You have idea how it could be achieved without config changes
and restart?
Best Regards,
Kamil Dobrowolski