OWL 属性 限制与 SHACL
OWL Property Restrictions vs. SHACL
如果在 OWL Property Restrictions and SHACL 之间做出选择,是否有任何理由再选择 OWL 方法?
特别是关于基数约束,我想知道 SHACL 是否被认为可以取代 OWL。根据我的随意检查,语法看起来很相似。
我可能没有理解 OWL 基数约束的目的。作为 ontology 的一部分,它们应该有助于推理(与验证分开关注)。但是基数约束如何促进推理?
OWL 和 SHACL 之间的差异在下面的 table 中介绍。
OWL
SHACL
Based on open world assumption
Based on closed world assumption
Designed for inferencing
Designed for validation
Computationally cheap (typical problems are decidable)
?
A lot of inferences almost "out of the box"
One have to define a lot of constraints manually
Is useful as documentation for RDF
至于 OWL 中的基数约束,这些约束允许在某些情况下在某些方面关闭世界,以获得额外的推论。
基数约束的逻辑在OWL和SHACL中是相反的。非正式地:
在 SHACL 中,
ex:PersonShape
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:path ex:parent ;
sh:minCount 1 .`
表示如果某人是人,那么he/she至少要有一个parent。
在OWL,
ex:Person owl:equivalentClass [ rdf:type owl:Restriction ;
owl:onProperty ex:parent ;
owl:minCardinality "1" ] . `
表示如果某人至少有一个parent,那么he/she就是一个人
来自TopBraid marketing materials:
How is SHACL different from RDF Schema and OWL? RDFS and OWL were designed for an “Open World” in which data may be assembled from many places on the Semantic Web. This design goal has caused a lot of frustration over the years, because it made it impossible to check even the most obvious integrity constraints, such as whether a property has a certain number of values. In contrast, SHACL assumes a “Closed World”, aligning with the expectations of typical business users. Furthermore, OWL has been optimized for a certain type of classification problems, yet it could not be used to do routine operations necessary for data validation such as mathematical computations or text operations. SHACL is much more expressive. Further it seamlessly integrates with SPARQL to express almost arbitrary conditions. BTW it is perfectly fine to incrementally extend an RDFS or OWL model with SHACL statements, supporting both worlds.
根据我的经验,OWL 的大多数用户并没有真正理解或不关心 OWL 的实际语义(开放世界假设等)。在许多情况下,OWL 基数限制已被使用,因为没有其他选择。然而,正如其他地方指出的那样,owl:maxCardinality 1 的语义与大多数人的预期相反:这意味着如果 属性 有两个值,则这些值被假定为相同(owl:同)。在 SHACL 中,sh:maxCount 1 表示如果 属性 有两个值,则需要删除其中一个。
继续使用 OWL 支持 SHACL 的主要原因是 OWL 具有更长的历史(即更多的工具、可重用的本体和示例),如果您想使用OWL (DL) 推理。但如果您需要传统的封闭世界语义,请使用 SHACL。请注意,SHACL 和 OWL 可以混合使用,例如在一个文件中定义 类 和属性,然后在另一个文件中定义 OWL 限制,在另一个文件中定义 SHACL 约束。
根据我的经验,很少使用 OWL 推理,复杂的 OWL 结构(包括 Restriction
和 unionOf
)不是很有用。
甚至 rdfs:domain/range
也会导致重用问题,因为它们是单态的:将它们与多个值一起使用,这是自找麻烦。
所以我们在 Ontotext 最近一直在使用基于示例的模型、非承诺 schema:domain/rangeIncludes
和形状来表达 类 和 props 如何一起使用。
我认为 OWL 完全基于开放世界假设这一事实使其非常独特。在某些用例中,您将来自许多不同来源的许多数据集汇集在一起,这些数据集需要此独特功能。对于任何给定的事实,可能总是有来自不同来源的不同意见。 "data fabric"(或企业知识图谱)对 "Multiple versions of the Truth" 的基本支持至关重要甚至更强:它是企业范围用例的最重要的推动因素。对于 EKG,我们需要 OWL 作为核心。形成所有数据的 "unbiased" 表示,不强加任何特定的封闭世界观,推断出所有正确的事实。在洋葱圈周围有很多翻译语言,例如 SHACL(对象的严格上下文特定的封闭世界形状)、SPARQL(图表 2 表格)、R2RML(表格 2 图表)等等。
如果在 OWL Property Restrictions and SHACL 之间做出选择,是否有任何理由再选择 OWL 方法?
特别是关于基数约束,我想知道 SHACL 是否被认为可以取代 OWL。根据我的随意检查,语法看起来很相似。
我可能没有理解 OWL 基数约束的目的。作为 ontology 的一部分,它们应该有助于推理(与验证分开关注)。但是基数约束如何促进推理?
OWL 和 SHACL 之间的差异在下面的 table 中介绍。
OWL | SHACL |
---|---|
Based on open world assumption | Based on closed world assumption |
Designed for inferencing | Designed for validation |
Computationally cheap (typical problems are decidable) | ? |
A lot of inferences almost "out of the box" | One have to define a lot of constraints manually |
Is useful as documentation for RDF |
至于 OWL 中的基数约束,这些约束允许在某些情况下在某些方面关闭世界,以获得额外的推论。
基数约束的逻辑在OWL和SHACL中是相反的。非正式地:
在 SHACL 中,
ex:PersonShape
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:path ex:parent ;
sh:minCount 1 .`
表示如果某人是人,那么he/she至少要有一个parent。
在OWL,
ex:Person owl:equivalentClass [ rdf:type owl:Restriction ;
owl:onProperty ex:parent ;
owl:minCardinality "1" ] . `
表示如果某人至少有一个parent,那么he/she就是一个人
来自TopBraid marketing materials:
How is SHACL different from RDF Schema and OWL? RDFS and OWL were designed for an “Open World” in which data may be assembled from many places on the Semantic Web. This design goal has caused a lot of frustration over the years, because it made it impossible to check even the most obvious integrity constraints, such as whether a property has a certain number of values. In contrast, SHACL assumes a “Closed World”, aligning with the expectations of typical business users. Furthermore, OWL has been optimized for a certain type of classification problems, yet it could not be used to do routine operations necessary for data validation such as mathematical computations or text operations. SHACL is much more expressive. Further it seamlessly integrates with SPARQL to express almost arbitrary conditions. BTW it is perfectly fine to incrementally extend an RDFS or OWL model with SHACL statements, supporting both worlds.
根据我的经验,OWL 的大多数用户并没有真正理解或不关心 OWL 的实际语义(开放世界假设等)。在许多情况下,OWL 基数限制已被使用,因为没有其他选择。然而,正如其他地方指出的那样,owl:maxCardinality 1 的语义与大多数人的预期相反:这意味着如果 属性 有两个值,则这些值被假定为相同(owl:同)。在 SHACL 中,sh:maxCount 1 表示如果 属性 有两个值,则需要删除其中一个。
继续使用 OWL 支持 SHACL 的主要原因是 OWL 具有更长的历史(即更多的工具、可重用的本体和示例),如果您想使用OWL (DL) 推理。但如果您需要传统的封闭世界语义,请使用 SHACL。请注意,SHACL 和 OWL 可以混合使用,例如在一个文件中定义 类 和属性,然后在另一个文件中定义 OWL 限制,在另一个文件中定义 SHACL 约束。
根据我的经验,很少使用 OWL 推理,复杂的 OWL 结构(包括 Restriction
和 unionOf
)不是很有用。
甚至 rdfs:domain/range
也会导致重用问题,因为它们是单态的:将它们与多个值一起使用,这是自找麻烦。
所以我们在 Ontotext 最近一直在使用基于示例的模型、非承诺 schema:domain/rangeIncludes
和形状来表达 类 和 props 如何一起使用。
我认为 OWL 完全基于开放世界假设这一事实使其非常独特。在某些用例中,您将来自许多不同来源的许多数据集汇集在一起,这些数据集需要此独特功能。对于任何给定的事实,可能总是有来自不同来源的不同意见。 "data fabric"(或企业知识图谱)对 "Multiple versions of the Truth" 的基本支持至关重要甚至更强:它是企业范围用例的最重要的推动因素。对于 EKG,我们需要 OWL 作为核心。形成所有数据的 "unbiased" 表示,不强加任何特定的封闭世界观,推断出所有正确的事实。在洋葱圈周围有很多翻译语言,例如 SHACL(对象的严格上下文特定的封闭世界形状)、SPARQL(图表 2 表格)、R2RML(表格 2 图表)等等。