我尝试使用 graphdb 中内置的 OWL2-RL 规则。我显然做错了什么或者理解错误。这是我的玩具本体。
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.semanticweb.org/rlehmann/ontologies/2017/10/untitled-ontology-182#"
xml:base="http://www.semanticweb.org/rlehmann/ontologies/2017/10/untitled-ontology-182"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:untitled-ontology-182="http://www.semanticweb.org/rlehmann/ontologies/2017/10/untitled-ontology-182#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:ontology="http://www.some/ontology/">
<owl:Ontology rdf:about="http://www.semanticweb.org/rlehmann/ontologies/2017/10/untitled-ontology-182"/>
<!-- http://www.some/ontology/hasValue -->
<owl:DatatypeProperty rdf:about="http://www.some/ontology/hasValue">
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:DatatypeProperty>
<!-- http://www.some/ontology/ClassA -->
<owl:Class rdf:about="http://www.some/ontology/ClassA"/>
<!-- http://www.some/ontology/InvA -->
<owl:NamedIndividual rdf:about="http://www.some/ontology/InvA">
<rdf:type rdf:resource="http://www.some/ontology/ClassA"/>
<ontology:hasValue rdf:datatype="http://www.w3.org/2001/XMLSchema#string">StringValue</ontology:hasValue>
</owl:NamedIndividual>
<!-- http://www.some/ontology/InvB -->
<owl:NamedIndividual rdf:about="http://www.some/ontology/InvB">
<ontology:hasValue rdf:datatype="http://www.w3.org/2001/XMLSchema#string">FooBar</ontology:hasValue>
</owl:NamedIndividual>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.some/ontology/hasValue"/>
<owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
<rdfs:subClassOf rdf:resource="http://www.some/ontology/ClassA"/>
</owl:Restriction>
</rdf:RDF>
如果我没有误解 OWL2-Profiles 中的表 2该本体应位于 OWL2 RL 配置文件中。我希望“InvB”被归类为 A 类。但事实并非如此。它实际上适用于推理器(HermiT、Pellet,...),但不适用于规则(Drools、Graphdb),这是规范中的一个空白。
如何“修复”我的本体或有任何解决方法吗?
干杯,
罗伯特
最佳答案
我们的应用程序不可以选择在 GCI 左侧不使用匿名类。是的,对象属性完美地工作。
经过一些研究,我们实际上发现,它永远不可能那样工作。在对应于 RL-Profile 的 GraphDB .pie 文件中,只有一些规则的概念“//这些未实现(并且可能无法实现)”。这包括 OWL2 RL Section 4.3 Table 8 中定义的规则“dt-type2” 。 RDF第 3.1 节给出了为什么这不起作用的实际答案。
RDF Graphs
An RDF graph is a set of RDF triples.
3.1 Triples
An RDF triple consists of three components:
the subject, which is an IRI or a blank node
the predicate, which is an IRI
the object, which is an IRI, a literal or a blank node
"FooBar"^^xsd:string rdf:type xsd:string 这是不允许的,但显然是必需的。
我们很不确定 w3c 的人除了 RDF 之外还有什么想法?!
就像现在一样,这种推理在 GraphDB 中根本不起作用(并且一般没有规则引擎?)。但这不是 GraphDB 的错,而只是规范链中的一个缺口。
但是,我们在本体中做了一个解决方法,解决了问题并且对我们有用。我们只需
- 为我们使用的数据类型定义了新概念
- 将所有 DataProperties 转换为 ObjectProperties
- 引入了新的数据类型属性,其域为新数据类型概念之一,范围为 xsd:xyz。例如属性:hasStringValue 域:字符串范围:xsd:字符串
这对我们有用。
关于owl - 子类表达式中的数据属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47474393/