Python OWLReady使用OWLReady library运行Hermit resoner时出现一致性Ontologyerror
我有一个简单的本体文件,它是在我尝试使用python和OWLReady进行解析时创建的 下面是它显示的代码Python OWLReady使用OWLReady library运行Hermit resoner时出现一致性Ontologyerror,python,ontology,owlready,Python,Ontology,Owlready,我有一个简单的本体文件,它是在我尝试使用python和OWLReady进行解析时创建的 下面是它显示的代码 OwlReadyInconsistentOntologyError: C:\ProgramData\Anaconda3\lib\site-packages\owlready2\reasoning.py in sync_reasoner_hermit(x, infer_property_values, debug, keep_tmp_file) 134 except sub
OwlReadyInconsistentOntologyError:
C:\ProgramData\Anaconda3\lib\site-packages\owlready2\reasoning.py in sync_reasoner_hermit(x, infer_property_values, debug, keep_tmp_file)
134 except subprocess.CalledProcessError as e:
135 if (e.returncode == 1) and (b"Inconsistent ontology" in (e.output or b"")):
--> 136 raise OwlReadyInconsistentOntologyError()
137 else:
138 raise OwlReadyJavaError("Java error message is:\n%s" % (e.stderr or e.output or b"").decode("utf8"))
OwlReadyInconsistentOntologyError:
这是我尝试的本体文件
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xml:base="http://elearn.org/onto.owl"
xmlns="http://elearn.org/onto.owl#">
<owl:Ontology rdf:about="http://elearn.org/onto.owl"/>
<owl:DatatypeProperty rdf:about="#Age">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Name">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Gender">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Qualification">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Branch">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Background_Knowledge">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Active_Reflective">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#AR_Value">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Sensitive_Intutive">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#S_I_Value">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Visual_Verbal">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#V_V_Value">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#Global_Sequential">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#G_S_Value">
<rdfs:domain rdf:resource="#Learner"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</owl:DatatypeProperty>
<owl:Class rdf:about="#Learner">
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Class>
<Learner rdf:about="#L1">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
<Age rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">18</Age>
<Name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">L1</Name>
<Gender rdf:datatype="http://www.w3.org/2001/XMLSchema#string">M</Gender>
<Qualification rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</Qualification>
<Branch rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Mathematics with Computer</Branch>
<Background_Knowledge rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</Background_Knowledge>
<Active_Reflective rdf:datatype="http://www.w3.org/2001/XMLSchema#string">1</Active_Reflective>
<AR_Value rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">70</AR_Value>
<Sensitive_Intutive rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0</Sensitive_Intutive>
<S_I_Value rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">40</S_I_Value>
<Visual_Verbal rdf:datatype="http://www.w3.org/2001/XMLSchema#string">1</Visual_Verbal>
<V_V_Value rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">60</V_V_Value>
<Global_Sequential rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0</Global_Sequential>
<G_S_Value rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">50</G_S_Value>
</Learner>
</rdf:RDF>
我使用相同的代码打开了另一个文件(不是同一个本体),我使用JenaAPI创建了这个文件,没有错误
什么是OWLEADYINConsistentOntologyerror?
我怎样才能解决这个问题呢?它给了你这个错误,因为隐士推理者发现你的本体是不一致的。这使用基于描述逻辑的人工智能推理过程来查找本体语句中的逻辑错误。您的另一个本体没有给出错误,因为它没有发现任何逻辑上的不一致。你可以使用你可以下载的Protege自己检查 如果您在Protege中打开本体并运行Hermit reasoner,它将声明您的本体不一致,并提供不一致的原因。以下是Protege中显示的不一致的屏幕截图: 看看它陈述的第一个不一致性
Global_Sequential Range: xsd:integer
L1 Global_Sequential "0" ^^xsd:string
第一行说明Global_Sequential
数据属性的范围是xsd:integer
。这意味着,每当个人通过Global\u Sequential
数据属性链接到某个值时,该值应为整数
第二行表示单个L1
通过Global\u Sequential
数据属性链接到xsd:string
。这就是本体不一致的原因。也就是说,对于个人Li
您应该提供一个整数值,而不是一个字符串值
对于个人L1
数据属性Active\u refoptional
、Visual\u verball
和Age
,也出现了类似的错误。在Sensitive\u
的情况下,数据属性需要一个字符串,但提供了一个整数
为
L1
个人修复所有这些值将导致您的本体一致。它会给您带来此错误,因为Hermit推理机发现您的本体不一致。这使用基于描述逻辑的人工智能推理过程来查找本体语句中的逻辑错误。您的另一个本体没有给出错误,因为它没有发现任何逻辑上的不一致。你可以使用你可以下载的Protege自己检查
如果您在Protege中打开本体并运行Hermit reasoner,它将声明您的本体不一致,并提供不一致的原因。以下是Protege中显示的不一致的屏幕截图:
看看它陈述的第一个不一致性
Global_Sequential Range: xsd:integer
L1 Global_Sequential "0" ^^xsd:string
第一行说明Global_Sequential
数据属性的范围是xsd:integer
。这意味着,每当个人通过Global\u Sequential
数据属性链接到某个值时,该值应为整数
第二行表示单个L1
通过Global\u Sequential
数据属性链接到xsd:string
。这就是本体不一致的原因。也就是说,对于个人Li
您应该提供一个整数值,而不是一个字符串值
对于个人L1
数据属性Active\u refoptional
、Visual\u verball
和Age
,也出现了类似的错误。在Sensitive\u
的情况下,数据属性需要一个字符串,但提供了一个整数
为
L1
个体修复所有这些值将导致本体保持一致。您有范围为xsd:string但用xsd:integer值断言的数据属性。这是不一致的,因为xsd:string和xsd:integer是不相交的数据类型。您有范围为xsd:string但用xsd:integer值断言的数据属性。这是不一致的,因为xsd:string和xsd:integer是不相交的数据类型。