加权 RDF 谓词 (owl:ObjectProperty)

发布于 2024-09-17 21:04:21 字数 1287 浏览 9 评论 0原文

在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

内心荒芜 2024-09-24 21:04:21

我不会使用RDF 具体化,在这种情况下不会,而且几乎在任何情况下都不会。 RDF具体化只会让事情变得更加复杂。正如您所评论的,它会夸大您的本体论,但不仅如此,它还会使您的本体论应用 OWL 推理变得非常困难。

我处理过与您所呈现的相同的场景,并且大多数时候我最终得到了以下设计。

(S) (P) [ (P) (O) (P) (O)]
我喜欢 [“我喜欢什么”Dog,“我有多喜欢它”“很多”]

Class: LikeLevel //it represents class of things a person likes with a degree factor.

ObjectProperty: likeObject
    Domain: LikeLevel
    Range: Pet //(or Thing)

ObjectProperty: likeScale
    Domain: LikeLevel
    Range: xsd:int //(or an enumeration class i.e: 'nothing', 'a bit', 'very much',...)

ObjectProperty: like
    Domain: Person
    Range: LikeLevel

如果你想用这个模型表示一些实例数据(在 RDF/Turtle 语法中):

:I :like [ a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7] . 

在这种情况下,我正在创建一个空白对象 LikeLevel 的节点,但您也可以创建一个地面对象,有时您可能希望/需要避免 bNode。在这种情况下:

:I :like :a0001 .
:a0001 a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7.

这种设计可以被认为是一种轻量级的具体化,与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']

Class: LikeLevel //it represents class of things a person likes with a degree factor.

ObjectProperty: likeObject
    Domain: LikeLevel
    Range: Pet //(or Thing)

ObjectProperty: likeScale
    Domain: LikeLevel
    Range: xsd:int //(or an enumeration class i.e: 'nothing', 'a bit', 'very much',...)

ObjectProperty: like
    Domain: Person
    Range: LikeLevel

If you want to represent some instance data with this model (in RDF/Turtle syntax):

:I :like [ a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7] . 

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:

:I :like :a0001 .
:a0001 a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7.

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.

荒人说梦 2024-09-24 21:04:21

您的建议是有效的;它被称为具体化,是表示本体或 RDF 图中两个项目之间关系固有属性的标准方式,其中陈述是在项目之间以成对的方式进行的 - 这是数据模型本身有时需要具体化。

如果您担心具体化会夸大您的本体,您可以尝试以下方法,但通常不太理想,并且会带来自己的问题:

  1. 创建特定属性,例如 somewhatLikesdoesntLike;如果您有一组有限的替代方案,并且不介意创建额外的属性,那么这可能是合适的。如果您打算用整数(或任何广泛的替代方案)对“相似度”进行编码,那么这将变得乏味且麻烦(而且我什至会建议不正确) - 遵循此方法,您将拥有诸如 likes0likes1、...、likes99likes100 之类的属性。此方法还会排除查询,例如,一个人在一定程度值范围内喜欢的所有狗,这在 SPARQL 中可以使用您指定的具体化方法实现,但不能使用此方法。
  2. 如果可以针对 person 的断言针对 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:

  1. Create specific properties, such as 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 like likes0, 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.
  2. Attach the likesDogs property to the Person instance, if the assertion can be made against the person onto all types/instances of Dog, 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!

┈┾☆殇 2024-09-24 21:04:21

我认为@msalvadores 弄错了。

让我们忘记狗和喜欢的东西吧。我们在这里真正要做的是:

a x b
axb y c
axb z d

其中 axbax b 语句的标识符,a、b、c、d 是主语或对象和 x, y, z 是谓词。我们需要的是以某种方式将 a, x, b 资源绑定到 axb 语句。

这就是具体化的方式:

axb subject a
axb predicate x
axb object b

我认为这很容易理解。

让我们检查一下 msalvadores 做了什么:

:I :like [ a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7] . 

我们可以轻松地将其转换为 axb 术语,

a x w
w type AxbSpecificObjectWrapper
w object b
w y c

这只是用低质量的工具和更多的努力来模仿具体化(您需要一个包装类并定义一个对象属性)。 ax w 语句对我来说没有意义;我喜欢一个类似的关卡,哪些物体是狗???

但是如何描述我喜欢狗的“程度”呢?

据我所知,以我非常有限的 RDF 知识,有两种方法可以做到这一点。

1.) 使用具体化

stmt_1
    a LikeStatement
    subject I
    predicate like
    object dogs
    how_much "very much"

2.) 实例化一个谓词类

I like_1 dogs
like_1
    a Like
    how_much "very much"

这取决于您的品味和您的实际词汇,您选择哪一个。

如何为谓词提供属性或值?

我认为您不理解谓词和陈述之间的区别。这里有一个很好的例子:RDF 中具体化的简单示例

Tolkien wrote Lord of the rings
Wikipedia said that

这里的陈述:

that: [Tolkien, wrote, LotR]

如果我们正在对陈述进行陈述,我们会这样写:

[Wikipedia, said, that]

如果我们正在对谓词进行陈述,那么我们会写这样的内容:

[Wikipedia, said, wrote]

我认为有很大的不同。具体化是关于关于陈述的陈述,而不是关于谓词的陈述......

I think @msalvadores gets it wrong.

Let's forget about the dogs and likes. What we are really doing here is:

a x b
axb y c
axb z d

where axb is the identifier of the a x b statement, a, b, c, d are subjects or objects and x, y, z are predicates. What we need is binding the a, x, b resources to the axb statement somehow.

This is how reification does it:

axb subject a
axb predicate x
axb object b

which I think is very easy to understand.

Let's check what msalvadores does:

:I :like [ a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7] . 

we can easily translate this to axb terms

a x w
w type AxbSpecificObjectWrapper
w object b
w y c

which 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???

But how about to describe "the degree" I like dogs?

There are 2 ways to do this as far as I can tell with my very limited RDF knowledge.

1.) use reification

stmt_1
    a LikeStatement
    subject I
    predicate like
    object dogs
    how_much "very much"

2.) instantiate a predicate class

I like_1 dogs
like_1
    a Like
    how_much "very much"

It depends on your taste and your actual vocab which one you choose.

How can I give a property or value to a predicate?

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

Tolkien wrote Lord of the rings
Wikipedia said that

The statement here:

that: [Tolkien, wrote, LotR]

If we are making statements about the statement, we write something like this:

[Wikipedia, said, that]

If we are making statements about the predicate then we write something like this:

[Wikipedia, said, wrote]

I think there is a big difference. Reification is about making statements about statements not about predicates...

等待我真够勒 2024-09-24 21:04:21

耶拿文件中的一句话引起了我的注意。

...OWL Full allows ... state the following .... construction:

<owl:Class rdf:ID="DigitalCamera">
  <rdf:type owl:ObjectProperty />
</owl:Class>
..

OWL Full 真的允许 ObjectProperty 也成为一个类吗?
如果一个 ObjectProperty 可以是一个类,并且可以有个体,那么我可以用 P_individual 来描述一个语句

S_individual P_individual O_individual

,并且我可以在 P_individual 上有更多的属性。对吗?
或者我遗漏了一些要点?

由于以下 RDF 有效,因此相应的 OWL 应该是可以实现的。

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:j.0="http://somewhere/" > 

  <rdf:Description rdf:about="http://somewhere/Dog_my_dog">
    <j.0:name>Lucky</j.0:name>
  </rdf:Description>
  <rdf:Description rdf:about="http://somewhere/like_dog">
    <j.0:degree>80</j.0:degree>
  </rdf:Description>

  <rdf:Description rdf:about="http://somewhere/Cat_my_cat">
    <j.0:name>Catty</j.0:name>
  </rdf:Description>
  <rdf:Description rdf:about="http://somewhere/like_cat">
    <j.0:degree>86</j.0:degree>
  </rdf:Description>

  <rdf:Description rdf:about="http://somewhere/Person_I">
    <j.0:name>Bob</j.0:name>
    <j.0:like_dog rdf:resource="http://somewhere/Dog_my_dog"/>
    <j.0:like_cat rdf:resource="http://somewhere/Cat_my_cat"/>
  </rdf:Description>

</rdf:RDF>

A sentence from Jena's document just catch my eye.

...OWL Full allows ... state the following .... construction:

<owl:Class rdf:ID="DigitalCamera">
  <rdf:type owl:ObjectProperty />
</owl:Class>
..

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

S_individual P_individual O_individual

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.

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:j.0="http://somewhere/" > 

  <rdf:Description rdf:about="http://somewhere/Dog_my_dog">
    <j.0:name>Lucky</j.0:name>
  </rdf:Description>
  <rdf:Description rdf:about="http://somewhere/like_dog">
    <j.0:degree>80</j.0:degree>
  </rdf:Description>

  <rdf:Description rdf:about="http://somewhere/Cat_my_cat">
    <j.0:name>Catty</j.0:name>
  </rdf:Description>
  <rdf:Description rdf:about="http://somewhere/like_cat">
    <j.0:degree>86</j.0:degree>
  </rdf:Description>

  <rdf:Description rdf:about="http://somewhere/Person_I">
    <j.0:name>Bob</j.0:name>
    <j.0:like_dog rdf:resource="http://somewhere/Dog_my_dog"/>
    <j.0:like_cat rdf:resource="http://somewhere/Cat_my_cat"/>
  </rdf:Description>

</rdf:RDF>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文