OWL:基于值的属性限制:有可能吗?

发布于 2025-01-08 15:08:52 字数 2690 浏览 0 评论 0原文

我寻找一个清晰的 OWL 解决方案来定义一个属性,该属性是另一个属性的限制,类似于等效的类。限制基于域或范围的数据属性。受限制的财产肯定是子财产,并且,必须推断。

“孩子”、“母亲”、“父亲”是 Person s father.gender = "男" 数据属性 mother.gender = "female"

(Male subclassOf Person = 等价类"性别值"male")

父亲parentOf child '对象关系 motherparentOfchild'对象关系

如何根据parentOf和父亲的性别定义fatherOf属性? 显然它是parentOf 的子属性。

然而,Protégé 中的等效对象属性编辑器不允许设置属性查询,即使我真的不知道这是否可以通过属性链来解决。

将fatherOf 定义为子属性并(手动)设置fatherOf 而不是parentOf 不是一个选项,因为此族示例是更复杂场景的过于简单化的情况。

<Declaration>
    <Class IRI="#Person"/>
</Declaration>
<Declaration>
    <ObjectProperty IRI="#fatherOf"/>
</Declaration>
<Declaration>
    <ObjectProperty IRI="#parentOf"/>
</Declaration>
<Declaration>
    <DataProperty IRI="#gender"/>
</Declaration>
<Declaration>
    <NamedIndividual IRI="#father"/>
</Declaration>
<Declaration>
    <NamedIndividual IRI="#kid"/>
</Declaration>
<Declaration>
    <NamedIndividual IRI="#mother"/>
</Declaration>
<ClassAssertion>
    <Class IRI="#Person"/>
    <NamedIndividual IRI="#father"/>
</ClassAssertion>
<ClassAssertion>
    <Class IRI="#Person"/>
    <NamedIndividual IRI="#kid"/>
</ClassAssertion>
<ClassAssertion>
    <Class IRI="#Person"/>
    <NamedIndividual IRI="#mother"/>
</ClassAssertion>
<ObjectPropertyAssertion>
    <ObjectProperty IRI="#parentOf"/>
    <NamedIndividual IRI="#father"/>
    <NamedIndividual IRI="#kid"/>
</ObjectPropertyAssertion>
<ObjectPropertyAssertion>
    <ObjectProperty IRI="#parentOf"/>
    <NamedIndividual IRI="#mother"/>
    <NamedIndividual IRI="#kid"/>
</ObjectPropertyAssertion>
<DataPropertyAssertion>
    <DataProperty IRI="#gender"/>
    <NamedIndividual IRI="#father"/>
    <Literal datatypeIRI="&rdf;PlainLiteral">male</Literal>
</DataPropertyAssertion>
<DataPropertyAssertion>
    <DataProperty IRI="#gender"/>
    <NamedIndividual IRI="#mother"/>
    <Literal datatypeIRI="&rdf;PlainLiteral">female</Literal>
</DataPropertyAssertion>
<SubObjectPropertyOf>
    <ObjectProperty IRI="#fatherOf"/>
    <ObjectProperty IRI="#parentOf"/>
</SubObjectPropertyOf>
<DataPropertyDomain>
    <DataProperty IRI="#gender"/>
    <Class IRI="#Person"/>
</DataPropertyDomain>
<DataPropertyRange>
    <DataProperty IRI="#gender"/>
    <Datatype abbreviatedIRI="xsd:string"/>
</DataPropertyRange>

I look for a clearly OWL solution to define a property that is a restriction of another property, similar to an equivalent class. Restriction is based on data properties of either the domain or the range. The restricted property is definitely a subproperty, and, must be inferred.

"kid","mother","father" are Person s
father.gender = "male" data property
mother.gender = "female"

(a Male subclassOf Person = equivalent class "gender value "male")

father parentOf child ' object relation
mother parentOf child ' object relation

How to defined fatherOf property, based on parentOf and gender of father?
Clearly it is a subproperty of parentOf.

However, equivalent object property editor in Protégé does not allow setting a property query, even I do not really see if this can be solved with a property chain.

Defining fatherOf as subproperty and (manually) setting fatherOf instead of parentOf is not an option, since this family example is an oversimplified situation of a more complex scenario.

<Declaration>
    <Class IRI="#Person"/>
</Declaration>
<Declaration>
    <ObjectProperty IRI="#fatherOf"/>
</Declaration>
<Declaration>
    <ObjectProperty IRI="#parentOf"/>
</Declaration>
<Declaration>
    <DataProperty IRI="#gender"/>
</Declaration>
<Declaration>
    <NamedIndividual IRI="#father"/>
</Declaration>
<Declaration>
    <NamedIndividual IRI="#kid"/>
</Declaration>
<Declaration>
    <NamedIndividual IRI="#mother"/>
</Declaration>
<ClassAssertion>
    <Class IRI="#Person"/>
    <NamedIndividual IRI="#father"/>
</ClassAssertion>
<ClassAssertion>
    <Class IRI="#Person"/>
    <NamedIndividual IRI="#kid"/>
</ClassAssertion>
<ClassAssertion>
    <Class IRI="#Person"/>
    <NamedIndividual IRI="#mother"/>
</ClassAssertion>
<ObjectPropertyAssertion>
    <ObjectProperty IRI="#parentOf"/>
    <NamedIndividual IRI="#father"/>
    <NamedIndividual IRI="#kid"/>
</ObjectPropertyAssertion>
<ObjectPropertyAssertion>
    <ObjectProperty IRI="#parentOf"/>
    <NamedIndividual IRI="#mother"/>
    <NamedIndividual IRI="#kid"/>
</ObjectPropertyAssertion>
<DataPropertyAssertion>
    <DataProperty IRI="#gender"/>
    <NamedIndividual IRI="#father"/>
    <Literal datatypeIRI="&rdf;PlainLiteral">male</Literal>
</DataPropertyAssertion>
<DataPropertyAssertion>
    <DataProperty IRI="#gender"/>
    <NamedIndividual IRI="#mother"/>
    <Literal datatypeIRI="&rdf;PlainLiteral">female</Literal>
</DataPropertyAssertion>
<SubObjectPropertyOf>
    <ObjectProperty IRI="#fatherOf"/>
    <ObjectProperty IRI="#parentOf"/>
</SubObjectPropertyOf>
<DataPropertyDomain>
    <DataProperty IRI="#gender"/>
    <Class IRI="#Person"/>
</DataPropertyDomain>
<DataPropertyRange>
    <DataProperty IRI="#gender"/>
    <Datatype abbreviatedIRI="xsd:string"/>
</DataPropertyRange>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

[浮城] 2025-01-15 15:08:52

因此,您的数据中有类似以下内容:

:x  :parentOf  :y .
:x  :gender  "male" .

并且您想推断:

:x  :fatherOf  :y .

恐怕您无法在 OWL 中执行此操作。对于像这样的情况,您可能需要依赖 SWRL、SPIN 等规则语言。但是,对于父亲、母亲等的特定情况,您可以执行以下操作:

  • define :hasParent 作为 :parentOf 的逆;
  • :hasParent 的基数限制为 2;
  • :hasFather 定义为 :fatherOf 的逆;
  • :hasFather 设为 owl:FunctionalProperty
  • :hasMother 定义为 :motherOf 的逆;
  • :hasMother 设为 owl:FunctionalProperty
  • 定义男性类:Man
  • 定义女性类:Woman
  • 使 :Man:Woman 分离;
  • :hasFather的范围设置为:Man
  • :hasMother 的范围设置为 :Woman

所以本体看起来像这样(在 Turtle 中,因为我不熟悉 OWL/XML):

:Person  a  owl:Class;
  rdfs:subClassOf  [
    a  owl:Restriction;
    owl:onProperty  :hasParent;
    owl:cardinality  2
  ] .
:Man  a  owl:Class;
  owl:equivalentclass  [
    a  owl:Class;
    owl:intersectionOf (
      :Person
      [
         a  owl:Restriction;
         owl:onProperty  :gender;
         owl:hasValue  "male";
      ]
    )
  ] .
:Woman  a  owl:Class;
  owl:equivalentclass  [
    a  owl:Class;
    owl:intersectionOf (
      :Person
      [
         a  owl:Restriction;
         owl:onProperty  :gender;
         owl:hasValue  "female";
      ]
    )
  ] .
:gender  a  owl:DatatypeProperty, owl:FunctionalProperty .
:hasParent  a  owl:ObjectProperty;
  owl:inverseOf  :parentOf;
  rdfs:domain  :Person;
  rdfs:range  :Person .
:hasFather  a  owl:ObjectProperty, owl:FunctionalProperty;
  rdfs:subPropertyOf  :hasParent;
  rdfs:range  :Man .
:hasMother  a  owl:ObjectProperty, owl:FunctionalProperty;
  rdfs:subPropertyOf  :hasParent;
  rdfs:range  :Woman .

这应该可以解决问题,但它是一个非常复杂的本体,用它进行推理可能会很慢。

编辑:我补充说:gender必须是功能性的,否则可能会有一个母亲同时也是一个父亲,这是行不通的!

So, you have something like the following in your data:

:x  :parentOf  :y .
:x  :gender  "male" .

and you would like to infer that:

:x  :fatherOf  :y .

I'm afraid you cannot do this in OWL. For cases like this one, you may want to rely on a rule language like SWRL, SPIN, etc. However, for the particular case of father, mother, etc, you could do the following:

  • define :hasParent as the inverse of :parentOf;
  • restrict the cardinality of :hasParent to 2;
  • define :hasFather as the inverse of :fatherOf;
  • make :hasFather a owl:FunctionalProperty;
  • define :hasMother as the inverse of :motherOf;
  • make :hasMother a owl:FunctionalProperty;
  • define the class :Man of male people;
  • define the class :Woman of female people;
  • make :Man disjointWith :Woman;
  • set the range of :hasFather to :Man;
  • set the range of :hasMother to :Woman.

So the ontology looks like this (in Turtle because I'm not familiar with OWL/XML):

:Person  a  owl:Class;
  rdfs:subClassOf  [
    a  owl:Restriction;
    owl:onProperty  :hasParent;
    owl:cardinality  2
  ] .
:Man  a  owl:Class;
  owl:equivalentclass  [
    a  owl:Class;
    owl:intersectionOf (
      :Person
      [
         a  owl:Restriction;
         owl:onProperty  :gender;
         owl:hasValue  "male";
      ]
    )
  ] .
:Woman  a  owl:Class;
  owl:equivalentclass  [
    a  owl:Class;
    owl:intersectionOf (
      :Person
      [
         a  owl:Restriction;
         owl:onProperty  :gender;
         owl:hasValue  "female";
      ]
    )
  ] .
:gender  a  owl:DatatypeProperty, owl:FunctionalProperty .
:hasParent  a  owl:ObjectProperty;
  owl:inverseOf  :parentOf;
  rdfs:domain  :Person;
  rdfs:range  :Person .
:hasFather  a  owl:ObjectProperty, owl:FunctionalProperty;
  rdfs:subPropertyOf  :hasParent;
  rdfs:range  :Man .
:hasMother  a  owl:ObjectProperty, owl:FunctionalProperty;
  rdfs:subPropertyOf  :hasParent;
  rdfs:range  :Woman .

This should do the trick, but it's a very complicated ontology and reasoning with it may be very slow.

Edit: I added that :gender must be functional, otherwise there could be a mother who is at the same time a father and that would not work!

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