加权 RDF 谓词 (owl:ObjectProperty)
在RDF中,语句用S、P和O表示;在 OWL 中,owl:ObjectProperty 表示谓词逻辑。
(S) (P) (O)
I like dog
<owl:Class rdf:about="Person" />
<owl:NamedIndividual rdf:about="I">
<rdf:type rdf:resource="Person"/>
<like rdf:resource="Dog"/>
</owl:NamedIndividual>
<owl:Class rdf:about="Pet" />
<owl:NamedIndividual rdf:about="Dog">
<rdf:type rdf:resource="Pet"/>
</owl:NamedIndividual>
<owl:ObjectProperty rdf:about="like">
<rdfs:domain>
<owl:Restriction>
<owl:onProperty rdf:resource="like"/>
<owl:someValuesFrom rdf:resource="Person"/>
</owl:Restriction>
</rdfs:domain>
<rdfs:range>
<owl:Restriction>
<owl:onProperty rdf:resource="like"/>
<owl:someValuesFrom rdf:resource="Pet"/>
</owl:Restriction>
</rdfs:range>
</owl:ObjectProperty>
但如何描述我喜欢狗的“程度”呢? 如何为谓词提供属性或值? 我得到的一种解决方案是将 1 个 (S,P,O) 语句扩展到 3 个语句。 例如,
(S) (P) (O)
Person isSrcOf LikeRelation
Pet isTargetOf LikeRelation
LikeRelation hasValue [0~100]
它应该可以工作,但显然它会让本体变大 3 倍:(
我很感激任何建议!
in RDF a statement is represented with S,P and O; In OWL the owl:ObjectProperty represents the predicate logic.
(S) (P) (O)
I like dog
<owl:Class rdf:about="Person" />
<owl:NamedIndividual rdf:about="I">
<rdf:type rdf:resource="Person"/>
<like rdf:resource="Dog"/>
</owl:NamedIndividual>
<owl:Class rdf:about="Pet" />
<owl:NamedIndividual rdf:about="Dog">
<rdf:type rdf:resource="Pet"/>
</owl:NamedIndividual>
<owl:ObjectProperty rdf:about="like">
<rdfs:domain>
<owl:Restriction>
<owl:onProperty rdf:resource="like"/>
<owl:someValuesFrom rdf:resource="Person"/>
</owl:Restriction>
</rdfs:domain>
<rdfs:range>
<owl:Restriction>
<owl:onProperty rdf:resource="like"/>
<owl:someValuesFrom rdf:resource="Pet"/>
</owl:Restriction>
</rdfs:range>
</owl:ObjectProperty>
But how about to describe "the degree" I like dogs?
How can I give a property or value to a predicate?
One solution I got is to extend one (S,P,O) statement to 3 statements.
For example,
(S) (P) (O)
Person isSrcOf LikeRelation
Pet isTargetOf LikeRelation
LikeRelation hasValue [0~100]
It should work but obviously it will let ontology 3 times bigger :(
I appreciate any suggestion!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不会使用RDF 具体化,在这种情况下不会,而且几乎在任何情况下都不会。 RDF具体化只会让事情变得更加复杂。正如您所评论的,它会夸大您的本体论,但不仅如此,它还会使您的本体论应用 OWL 推理变得非常困难。
我处理过与您所呈现的相同的场景,并且大多数时候我最终得到了以下设计。
(S) (P) [ (P) (O) (P) (O)]
我喜欢 [“我喜欢什么”Dog,“我有多喜欢它”“很多”]
如果你想用这个模型表示一些实例数据(在 RDF/Turtle 语法中):
在这种情况下,我正在创建一个空白对象
LikeLevel
的节点,但您也可以创建一个地面对象,有时您可能希望/需要避免 bNode。在这种情况下:这种设计可以被认为是一种轻量级的具体化,与RDF具体化的主要区别在于将本体设计保留在用户的模型中。
I wouldn't use RDF reification, not in this case and almost not in any case. RDF reification just makes the things always more complicated. As you commented it will inflate your ontology, but not just that, it'll also make your ontology very difficult for applying OWL reasoning.
I've dealt with the same scenario that you've presented and most of times I've ended up with the following design.
(S) (P) [ (P) (O) (P) (O)]
I like [ 'what I like' Dog , 'how much I like it' 'a lot']
If you want to represent some instance data with this model (in RDF/Turtle syntax):
In this case I'm creating a blank node for the object
LikeLevel
but you could create a ground object as well, sometimes you might want/need to avoid bNodes. In that case:This design can be consider a light case of reification, the main difference with RDF reification is that keeps the ontology design in the user's model.
您的建议是有效的;它被称为具体化,是表示本体或 RDF 图中两个项目之间关系固有属性的标准方式,其中陈述是在项目之间以成对的方式进行的 - 这是数据模型本身有时需要具体化。
如果您担心具体化会夸大您的本体,您可以尝试以下方法,但通常不太理想,并且会带来自己的问题:
somewhatLikes
、doesntLike
,爱
;如果您有一组有限的替代方案,并且不介意创建额外的属性,那么这可能是合适的。如果您打算用整数(或任何广泛的替代方案)对“相似度”进行编码,那么这将变得乏味且麻烦(而且我什至会建议不正确) - 遵循此方法,您将拥有诸如likes0
、likes1
、...、likes99
、likes100
之类的属性。此方法还会排除查询,例如,一个人在一定程度值范围内喜欢的所有狗,这在 SPARQL 中可以使用您指定的具体化方法实现,但不能使用此方法。Dog< 的所有类型/实例进行,请将
likesDogs
属性附加到Person
实例/code>,而不是单个实例。当然,这取决于您想要在这里捕获的内容;如果是后者,那么这也不合适。祝你好运!
Your suggestion is a valid one; it is called reification and is the standard way of representing properties inherent to a relationship between two items in an ontology or RDF graph, where statements are made in a pairwise manner between items - it is a limitation of the data model itself that makes reification necessary sometimes.
If you're worried that reification will inflate your ontology, you could try the following instead, but are generally less desirable and come with their own problems:
somewhatLikes
,doesntLike
,loves
; this may be suitable if you have a limited set of alternatives, and don't mind creating the extra properties. This becomes tedious and cumbersome (and I'd go so far as to suggest incorrect) if you intend to encode the 'degree of likeness' with an integer (or any wide range of alternatives) - following this approach, you'd have properties likelikes0
,likes1
, ...,likes99
,likes100
. This method would also preclude querying, for example, all dogs that a person likes within a range of degree values, which is possible in SPARQL with the reification approach you've specified, but not with this approach.likesDogs
property to thePerson
instance, if the assertion can be made against the person onto all types/instances ofDog
, and not individual instances. This will, of course, be dependent of what you're trying to capture here; if it's the latter, then this also won't be appropriate.Good luck!
我认为@msalvadores 弄错了。
让我们忘记狗和喜欢的东西吧。我们在这里真正要做的是:
其中
axb
是ax b
语句的标识符,a、b、c、d
是主语或对象和 x, y, z 是谓词。我们需要的是以某种方式将 a, x, b 资源绑定到 axb 语句。这就是具体化的方式:
我认为这很容易理解。
让我们检查一下 msalvadores 做了什么:
我们可以轻松地将其转换为 axb 术语,
这只是用低质量的工具和更多的努力来模仿具体化(您需要一个包装类并定义一个对象属性)。
ax w
语句对我来说没有意义;我喜欢一个类似的关卡,哪些物体是狗???据我所知,以我非常有限的 RDF 知识,有两种方法可以做到这一点。
1.) 使用具体化
2.) 实例化一个谓词类
这取决于您的品味和您的实际词汇,您选择哪一个。
我认为您不理解谓词和陈述之间的区别。这里有一个很好的例子:RDF 中具体化的简单示例
这里的陈述:
如果我们正在对陈述进行陈述,我们会这样写:
如果我们正在对谓词进行陈述,那么我们会写这样的内容:
我认为有很大的不同。具体化是关于关于陈述的陈述,而不是关于谓词的陈述......
I think @msalvadores gets it wrong.
Let's forget about the dogs and likes. What we are really doing here is:
where
axb
is the identifier of thea x b
statement,a, b, c, d
are subjects or objects andx, y, z
are predicates. What we need is binding thea, x, b
resources to theaxb
statement somehow.This is how reification does it:
which I think is very easy to understand.
Let's check what msalvadores does:
we can easily translate this to
axb
termswhich is just mimicking reification with low quality tools and more effort (you need a wrapper class and define an object property). The
a x w
statement does not makes sense to me; I like a like level, which objects are dogs???There are 2 ways to do this as far as I can tell with my very limited RDF knowledge.
1.) use reification
2.) instantiate a predicate class
It depends on your taste and your actual vocab which one you choose.
I don't think you understand the difference between a predicate and a statement. A great example about it is available here: Simple example of reification in RDF
The statement here:
If we are making statements about the statement, we write something like this:
If we are making statements about the predicate then we write something like this:
I think there is a big difference. Reification is about making statements about statements not about predicates...
耶拿文件中的一句话引起了我的注意。
OWL Full 真的允许 ObjectProperty 也成为一个类吗?
如果一个 ObjectProperty 可以是一个类,并且可以有个体,那么我可以用 P_individual 来描述一个语句
,并且我可以在 P_individual 上有更多的属性。对吗?
或者我遗漏了一些要点?
由于以下 RDF 有效,因此相应的 OWL 应该是可以实现的。
A sentence from Jena's document just catch my eye.
does OWL Full really allow an ObjectProperty be a Class as well?
If an ObjectProperty could be a Class, and could have individuals then I could describe a statement with
and I could have further properties on P_individual. Is it right?
or am I missing some points?
since the following RDF is valid, a corresponding OWL should be achievable.