[英]OWLAPI : HermiT reasoner thows “UnsupportedDatatypeException” for data type from imported Ontology
I have 2 ontologies (generated through Protege). 我有2个本体(通过Protege生成)。
A ontology (A.owl) :- 本体论(A.owl): -
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
<rdf:RDF xmlns="http://www.semanticweb.org/ontologies/A#"
xml:base="http://www.semanticweb.org/ontologies/A"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.semanticweb.org/ontologies/A">
<owl:imports rdf:resource="http://www.semanticweb.org/ontologies/Z"/>
</owl:Ontology>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/A#A -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/A#A">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/ontologies/A#B"/>
</owl:Class>
<!-- http://www.semanticweb.org/ontologies/A#B -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/A#B"/>
</rdf:RDF>
<!-- Generated by the OWL API (version 3.5.1) http://owlapi.sourceforge.net -->
Z ontology (Z.owl) :- Z本体论(Z.owl): -
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
<rdf:RDF xmlns="http://www.semanticweb.org/ontologies/Z#"
xml:base="http://www.semanticweb.org/ontologies/Z"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.semanticweb.org/ontologies/Z"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Datatypes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/Z#myName -->
<rdfs:Datatype rdf:about="http://www.semanticweb.org/ontologies/Z#myName"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/Z#myProp -->
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/Z#myProp"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Data properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/Z#name -->
<owl:DatatypeProperty rdf:about="http://www.semanticweb.org/ontologies/Z#name">
<rdfs:range rdf:resource="http://www.semanticweb.org/ontologies/Z#myName"/>
</owl:DatatypeProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/Z#X -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/Z#X">
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/ontologies/Z#Y"/>
</owl:Class>
<!-- http://www.semanticweb.org/ontologies/Z#Y -->
<owl:Class rdf:about="http://www.semanticweb.org/ontologies/Z#Y"/>
</rdf:RDF>
<!-- Generated by the OWL API (version 3.5.1) http://owlapi.sourceforge.net -->
I have imported Z.owl
inside A.owl
. 我在
Z.owl
里面导入了A.owl
。 When I run the HermiT reasoner with A ontology. 当我用A本体运行HermiT推理器时。 It throws and
org.semanticweb.HermiT.datatypes.UnsupportedDatatypeException
Exception. 它抛出和
org.semanticweb.HermiT.datatypes.UnsupportedDatatypeException
异常。
Exception Details :- 例外细节: -
Exception in thread "main" org.semanticweb.HermiT.datatypes.UnsupportedDatatypeException: HermiT supports all and only the datatypes of the OWL 2 datatype map, see
http://www.w3.org/TR/owl2-syntax/#Datatype_Maps.
The datatype 'http://www.semanticweb.org/ontologies/Z#myName' is not part of the OWL 2 datatype map and
no custom datatype definition is given;
therefore, HermiT cannot handle this datatype.
My JAVA Code is :- 我的JAVA代码是: -
Configuration reasonerConf = new Configuration();
reasonerConf.throwInconsistentOntologyException = false;
ReasonerFactory factory = new ReasonerFactory();
OWLReasoner reasoner = factory.createReasoner(owlOntology, reasonerConf); //Line where it throws above Exception
owlOntology
is current working ontology which is 'A' loaded into owlManager
(OWLOntologyManager). owlOntology
是当前的工作本体,它是加载到owlManager
(OWLOntologyManager)中的'A' 。 'Z' ontology is also in this owlManager
. 'Z'本体也在这个
owlManager
。
I tried to run HermiT reasoner in protege but it doesn't throw any exception there. 我试图运行HermiT推理器,但它不会抛出任何异常。
You declared a datatype: 您声明了一种数据类型:
<rdfs:Datatype rdf:about="http://www.semanticweb.org/ontologies/Z#myName"/>
but it has no associated definition. 但它没有相关的定义。 What is its lexical form?
它的词汇形式是什么? Is "foo"^^ex:myName a legal instance or not?
是“foo”^^ ex:myName是否是合法实例? Is it equivalent as a value to "FOO"^^ex:myName or not?
是否相当于“FOO”^^ ex:myName的值? HermiT doesn't have a way to know the answer to these questions, and thus complains:
HermiT没有办法知道这些问题的答案,因此抱怨:
The datatype ' http://www.semanticweb.org/ontologies/Z#myName ' is not part of the OWL 2 datatype map and no custom datatype definition is given;
数据类型“ http://www.semanticweb.org/ontologies/Z#myName ”不是OWL 2数据类型映射的一部分,并且未给出自定义数据类型定义; therefore, HermiT cannot handle this datatype.
因此,HermiT无法处理此数据类型。
You'll need to provide some kind of definition for this datatype that HermiT can understand, or perhaps use datatype facets instead. 您需要为HermiT可以理解的数据类型提供某种定义,或者使用数据类型facet。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.