I have 2 ontologies (generated through Protege).
A ontology (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) :-
<?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
. When I run the HermiT reasoner with A ontology. It throws and org.semanticweb.HermiT.datatypes.UnsupportedDatatypeException
Exception.
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 :-
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). 'Z' ontology is also in this owlManager
.
I tried to run HermiT reasoner in protege but it doesn't throw any exception there.
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? Is it equivalent as a value to "FOO"^^ex:myName or not? HermiT doesn't have a way to know the answer to these questions, and thus complains:
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.
You'll need to provide some kind of definition for this datatype that HermiT can understand, or perhaps use datatype facets instead.