我对这个 "semantic web primer for object oriented developers" 的解释正确吗?
Have I interpretted this "semantic web primer for object oriented developers" correctly?
This document 表示 "Therefore, pointing ack(sic) to the above example, if something has a price, then it can be handled as an instance of Product, even if it partakes in other declarations (or triples) "
进行单词搜索以查找参考。
基本上,他们是说 属性 "hasPrice" 的域是 "Product"。这意味着所有产品都可以有一个价格(到目前为止有意义),但它也意味着任何具有 属性 "hasPrice" 的东西都可以被视为 "Product"。这对我来说似乎有点松散。用 OOP 术语来说,它们当然不是说带有 属性 "hasPrice" 的任何东西都实现了 "Product" 接口,对吧?那太疯狂了!
如果您声明 hasPrice
的域是 Product
,RDF 和 OWL 都会推断任何具有 hasPrice
属性 的域都是类型 Product
。所以在这方面你的理解是正确的。请注意,如果 hasPrice
的定义没有域,则推理器不会进行此推断。
在一个 ontology 中,如果你有一个 Service
也有一个 hasPrice
属性,它会推断它是一个 Product
。如果您声明 Service
与 Product
不相交,您的 ontology 会出现不一致。
一种解决方法是在您的 ontology 中引入一个 class 来表示域,比如 HasPriceDomain
这是您的 hasPrice
所有域的联合属性。这将导致任何具有 hasPrice
属性 的内容被推断为 HasPriceDomain
.
类型
DataProperty: hasPrice
Domain: HasPriceDomain
Range: xsd:double
Class: HasPriceDomain
EquivalentTo: Product or Service
Class: Product
SubClassOf: hasPrice some xsd:double
DisjointWith: Service
Class: Service
SubClassOf: hasPrice some xsd:double
DisjointWith: Product
从 OOP 的角度来看,最好将 OOP classes 视为 RDF/OWL classes,将 classes 的 OOP 实例视为 RDF/OWL个人。
在 OOP 接口中通常指定行为(即方法),不能简单地转换为 RDF/OWL。从 RDF/OWL 开始,最好只关注 classes。
有关将 OOP 转换为 OWL 的详细信息,请参阅 https://henrietteharmse.com/uml-vs-owl/. For detail regarding the translation of methods, see Chapter 5 of https://henrietteharmse.files.wordpress.com/2017/09/scenariotestingusingowl_v0-1-7-final.pdf。
This document 表示 "Therefore, pointing ack(sic) to the above example, if something has a price, then it can be handled as an instance of Product, even if it partakes in other declarations (or triples) "
进行单词搜索以查找参考。
基本上,他们是说 属性 "hasPrice" 的域是 "Product"。这意味着所有产品都可以有一个价格(到目前为止有意义),但它也意味着任何具有 属性 "hasPrice" 的东西都可以被视为 "Product"。这对我来说似乎有点松散。用 OOP 术语来说,它们当然不是说带有 属性 "hasPrice" 的任何东西都实现了 "Product" 接口,对吧?那太疯狂了!
如果您声明 hasPrice
的域是 Product
,RDF 和 OWL 都会推断任何具有 hasPrice
属性 的域都是类型 Product
。所以在这方面你的理解是正确的。请注意,如果 hasPrice
的定义没有域,则推理器不会进行此推断。
在一个 ontology 中,如果你有一个 Service
也有一个 hasPrice
属性,它会推断它是一个 Product
。如果您声明 Service
与 Product
不相交,您的 ontology 会出现不一致。
一种解决方法是在您的 ontology 中引入一个 class 来表示域,比如 HasPriceDomain
这是您的 hasPrice
所有域的联合属性。这将导致任何具有 hasPrice
属性 的内容被推断为 HasPriceDomain
.
DataProperty: hasPrice
Domain: HasPriceDomain
Range: xsd:double
Class: HasPriceDomain
EquivalentTo: Product or Service
Class: Product
SubClassOf: hasPrice some xsd:double
DisjointWith: Service
Class: Service
SubClassOf: hasPrice some xsd:double
DisjointWith: Product
从 OOP 的角度来看,最好将 OOP classes 视为 RDF/OWL classes,将 classes 的 OOP 实例视为 RDF/OWL个人。
在 OOP 接口中通常指定行为(即方法),不能简单地转换为 RDF/OWL。从 RDF/OWL 开始,最好只关注 classes。
有关将 OOP 转换为 OWL 的详细信息,请参阅 https://henrietteharmse.com/uml-vs-owl/. For detail regarding the translation of methods, see Chapter 5 of https://henrietteharmse.files.wordpress.com/2017/09/scenariotestingusingowl_v0-1-7-final.pdf。