jena icon indicating copy to clipboard operation
jena copied to clipboard

OWLFBRuleReasoner do not work

Open violetcyl opened this issue 3 years ago • 9 comments

Version

apache-jena-fuseki-4.5.0,apache-jena-4.5.0

Question

I want to use jena OWLFBRuleReasoner for rule reasoning,but if fails. I can get query results but no inference results with OWLFBRuleReasoner. I confirm ontology.ttl is correct, because I can get inference results by using protege. If I customize the rules with GenericRuleReasoner ,I can get inference results. I can't figure out it,could you help ?

Fuseki_conf.ttl @prefix : http://base/# . @prefix tdb: http://jena.hpl.hp.com/2008/tdb# . @prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# . @prefix ja: http://jena.hpl.hp.com/2005/11/Assembler# . @prefix rdfs: http://www.w3.org/2000/01/rdf-schema# . @prefix fuseki: http://jena.apache.org/fuseki# .

:service1 a fuseki:Service ; fuseki:dataset <#dataset> ; fuseki:name "privilegeGuide" ; fuseki:serviceQuery "query" , "sparql" ; fuseki:serviceReadGraphStore "get" ; fuseki:serviceReadWriteGraphStore "data" ; fuseki:serviceUpdate "update" ; fuseki:serviceUpload "upload" .

<#dataset> rdf:type ja:RDFDataset ; ja:defaultGraph <#model_inf> ; .

<#model_inf> a ja:InfModel ; ja:baseModel <#tdbGraph> ;

#本体文件的路径
ja:content [ja:externalContent <file://Users/Jena_Fuseki/apache-jena-fuseki-4.5.0/run/databases/ontology.ttl > ] ;

#启用OWL推理机
ja:reasoner [
    ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
]; .

<#tdbGraph> rdf:type tdb:GraphTDB ; tdb:dataset <#tdbDataset> ; .

<#tdbDataset> rdf:type tdb:DatasetTDB ; tdb:location "../apache-jena-4.5.0/tdb" ;

violetcyl avatar Jul 07 '22 07:07 violetcyl

Not sure if this is the case. But someone mentioned ja:content doesn't go with presistent db.

My config looks like yours except for the ja:content part, and it works:

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

PREFIX :        <https://github.com/site-bender#>
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 tdb2:    <http://jena.apache.org/2016/tdb#>
PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>

## ---------------------------------------------------------------
## Updatable TDB2 dataset im-memory with all services enabled.

:service
    rdf:type                          fuseki:Service ;
    rdfs:label                        "TDB2 ds" ;
    fuseki:name                       "ds" ;
    fuseki:serviceQuery               "" ;
    fuseki:serviceQuery               "sparql" ;
    fuseki:serviceQuery               "query" ;
    fuseki:serviceUpdate              "" ;
    fuseki:serviceUpdate              "update" ;
    fuseki:serviceReadWriteGraphStore "data" ;
    fuseki:serviceReadGraphStore      "get" ;
    fuseki:dataset                    :dataset ;
.

:dataset
    rdf:type        ja:RDFDataset ;
    ja:defaultGraph :defaultInferenceModel ;
.

:defaultInferenceModel
    rdf:type     ja:InfModel ;
    ja:baseModel :tdbGraph ;
    ja:reasoner  [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner> ] ;
.

:tdbGraph
    rdf:type     tdb2:GraphTDB2 ;
    tdb2:dataset :tdbDataset ;
.

:tdbDataset
    rdf:type      tdb2:DatasetTDB2 ;
    tdb2:location "--mem--" ;
.

nathanbowang avatar Jul 07 '22 09:07 nathanbowang

Jena does not cover all of OWL-DL. Maybe your ontology uses a feature not covered.

You may get an answer if ask on the Jena users list [email protected].

Joining list information: https://jena.apache.org/help_and_support/index.html

afs avatar Jul 07 '22 10:07 afs

Not sure if this is the case. But someone mentioned ja:content doesn't go with presistent db.

My config looks like yours except for the ja:content part, and it works:

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

PREFIX :        <https://github.com/site-bender#>
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 tdb2:    <http://jena.apache.org/2016/tdb#>
PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>

## ---------------------------------------------------------------
## Updatable TDB2 dataset im-memory with all services enabled.

:service
    rdf:type                          fuseki:Service ;
    rdfs:label                        "TDB2 ds" ;
    fuseki:name                       "ds" ;
    fuseki:serviceQuery               "" ;
    fuseki:serviceQuery               "sparql" ;
    fuseki:serviceQuery               "query" ;
    fuseki:serviceUpdate              "" ;
    fuseki:serviceUpdate              "update" ;
    fuseki:serviceReadWriteGraphStore "data" ;
    fuseki:serviceReadGraphStore      "get" ;
    fuseki:dataset                    :dataset ;
.

:dataset
    rdf:type        ja:RDFDataset ;
    ja:defaultGraph :defaultInferenceModel ;
.

:defaultInferenceModel
    rdf:type     ja:InfModel ;
    ja:baseModel :tdbGraph ;
    ja:reasoner  [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner> ] ;
.

:tdbGraph
    rdf:type     tdb2:GraphTDB2 ;
    tdb2:dataset :tdbDataset ;
.

:tdbDataset
    rdf:type      tdb2:DatasetTDB2 ;
    tdb2:location "--mem--" ;
.

thanks, but it still does not work.

violetcyl avatar Jul 26 '22 06:07 violetcyl

Does @natebowang configuration (exactly as given) work? Do you have named graphs in the TDB database?

afs avatar Jul 26 '22 07:07 afs

Yes, my configuration is exactly like that. You can replace my ontology with yours in my ontology-dev-server project to see if it works. Here is the configuration I copied Here is my tiny ontology

@afs, I don't have named graphs there yet. @violetcyl Could you upload a sample of your ontology that doesn't work?

nathanbowang avatar Jul 26 '22 23:07 nathanbowang

Sorry - my bad - my reply was to @violetcyl.

It isn't clear to me what "do not work" means so start from something that works and change it.

It is only going to see the default graph - unless tdb2:unionDefaultGraph true is used.

afs avatar Jul 27 '22 08:07 afs

Sorry - my bad - my reply was to @violetcyl.

It isn't clear to me what "do not work" means so start from something that works and change it.

It is only going to see the default graph - unless tdb2:unionDefaultGraph true is used.

thanks for you answer. I prefer to believe "Jena does not cover all of OWL-DL. Maybe your ontology uses a feature not covered." Anyway,I will email the author.If he replies to me, I will share the answer.

violetcyl avatar Jul 29 '22 02:07 violetcyl

Yes, my configuration is exactly like that. You can replace my ontology with yours in my ontology-dev-server project to see if it works. Here is the configuration I copied Here is my tiny ontology

@afs, I don't have named graphs there yet. @violetcyl Could you upload a sample of your ontology that doesn't work?

thanks, your files with my config ,it works. Maybe my ontology uses a feature not covered.

violetcyl avatar Jul 29 '22 07:07 violetcyl

is only going to see the default graph - unless td

means ”No error, but no inference function“.

violetcyl avatar Jul 29 '22 07:07 violetcyl

Assuming this is answered.

afs avatar Nov 09 '22 18:11 afs