【问题标题】:How to set up generic owl object relationships如何设置通用 owl 对象关系
【发布时间】:2014-07-15 14:06:38
【问题描述】:

警告:新手问题。

我正在尝试使用与狗相关的一组类的相关数值来模拟(作为简化示例)狗,例如“蓬松度”。我对如何表示特定类型(例如狗)相对于另一种类型(例如蓬松度)采用特定数值感到困惑。例如:

:Dog rdf:type owl:Class .
:Fluffiness rdf:type owl:Class .
:describedBy rdf:type owl:ObjectProperty ;
             rdfs:domain :Dog ;
             rdfs:range :Fluffiness .
:hasValue rdf:type owl:DatatypeProperty ;
          rdfs:domain :Fluffiness ;
          rdfs:range :&xsd;float .

:Chihuahua rdf:type :Dog .

如何将吉娃娃与狗的通用属性(例如蓬松度)的特定值(例如 0.1)联系起来?有没有办法做到这一点,而无需仅仅将 Fluffness 作为一个类删除并定义一个“hasFluffiness”数据类型属性?

【问题讨论】:

    标签: rdf semantic-web owl description-logic


    【解决方案1】:

    目前,您的表示有效,但在我看来,这有点令人费解。您最终会得到如下实例数据:

    Chihuahua describedBy fluffiness72 .
    fluffiness72 hasValue 4.
    

    正如您所注意到的,您可以改为拥有一个 hasFluffiness 数据类型属性,但如果您不想这样做,我认为您最好的选择是拥有一个 Attribute 类,例如蓬松度尺寸友好度等都是实例。然后,你可以有一个AttributeValue类和属性attributevalue(你可能会想出更好的名字),这样你就可以写数据了像这样:

    :chihuahua62 rdf:type :Chihuahua ;
                 :hasAttributeValue [ :attribute :Fluffiness   ; :value 3 ] ;
                 :hasAttributeValue [ :attribute :Friendliness ; :value 2 ] . 
    

    通过这种表示,您可以说“每只吉娃娃的蓬松度都低于 4”:

    ((∃hasAttributeValue-1.Chihuahua) ⊓ (=attribute.Fluffiness)) ⊑ ∀value.xsd:float[≤4.0]

    ((inverse(hasAttributeValue) some Chihuahua) and (属性 value Fluffiness)) SubClassOf(值 xsd:float[

    在英语中,这表示吉娃娃的每个 AttributeValue 属性 Fluffiness 的值必须小于 4.0。

    您可以使用另一种表示形式,即“如果吉娃娃有一个属性值,那么 如果该属性是蓬松度,那么该值小于 4.0”。这相当于“如果一只吉娃娃有一个属性值,那么要么该属性不是蓬松度,要么该值小于4.0”:

    吉娃娃 ⊑ ∀hasAttributeValue.(¬(=attribute.Fluffiness) ⊔ (∀value.xsd:float[≤4.0]))

    这更容易写入本体编辑器,因为它是关于您感兴趣的类的子类公理。

    这是一个展示这两种方法的本体:

    @prefix :      <http://stackoverflow.com/q/24760392/1281433/dogProperties#> .
    @prefix owl:   <http://www.w3.org/2002/07/owl#> .
    @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
    @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
    
    :Shagginess  a  owl:NamedIndividual , :Attribute .
    
    :hasValue  a         owl:DatatypeProperty ;
            rdfs:domain  :_attVal .
    
    [ a                   owl:Class ;
      rdfs:subClassOf     [ a                  owl:Restriction ;
                            owl:allValuesFrom  [ a                     rdfs:Datatype ;
                                                 owl:onDatatype        xsd:float ;
                                                 owl:withRestrictions  ( [ xsd:minInclusive
                                                                   10 ] )
                                               ] ;
                            owl:onProperty     :hasValue
                          ] ;
      owl:intersectionOf  ( [ a                   owl:Restriction ;
                              owl:onProperty      [ owl:inverseOf  :hasAttributeValue ] ;
                              owl:someValuesFrom  :Newfoundland
                            ] [ a               owl:Restriction ;
                                owl:hasValue    :Shagginess ;
                                owl:onProperty  :hasAttribute
                              ] )
    ] .
    
    :Newfoundland  a         owl:Class ;
            rdfs:subClassOf  :Dog .
    
    :Attribute  a   owl:Class .
    
    :_attVal  a     owl:Class .
    
    :hasAttribute  a     owl:ObjectProperty ;
            rdfs:domain  :_attVal ;
            rdfs:range   :Attribute .
    
    :Chihuahua  a            owl:Class ;
            rdfs:subClassOf  :Dog ;
            rdfs:subClassOf  [ a                  owl:Restriction ;
                               owl:allValuesFrom  [ a            owl:Class ;
                                                    owl:unionOf  ( [ a                 owl:Class ;
                                                                     owl:complementOf  [ a               owl:Restriction ;
                                                                                         owl:hasValue    :Shagginess ;
                                                                                         owl:onProperty  :hasAttribute
                                                                                       ]
                                                                   ] [ a                  owl:Restriction ;
                                                                       owl:allValuesFrom  [ a                     rdfs:Datatype ;
                                                                                            owl:onDatatype        xsd:float ;
                                                                                            owl:withRestrictions  ( [ xsd:maxInclusive
                                                                                                              4 ] )
                                                                                          ] ;
                                                                       owl:onProperty     :hasValue
                                                                     ] )
                                                  ] ;
                               owl:onProperty     :hasAttributeValue
                             ] .
    
    :hasAttributeValue  a  owl:ObjectProperty ;
            rdfs:range  :_attVal .
    
    :Dog    a       owl:Class .
    
    <http://stackoverflow.com/q/24760392/1281433/dogProperties>
            a       owl:Ontology .
    

    【讨论】:

    • 谢谢!看起来第一种方法是我所追求的 - 不必为每个属性/值组合创建特定实例,我可以使用空白节点来指定与狗实例关联的一些蓬松度实例和关联的值使用该属性实例。
    • 我提到的第一种和第二种方法(在描述了您当前的方法之后)是相同的;他们的区别只是我写公理的方式。在这两种情况下,想法都是使用辅助个体作为连接到狗、属性和值的 n 元关系。我很高兴它看起来对你有用!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-20
    • 1970-01-01
    • 2016-12-05
    • 2016-04-29
    • 2017-06-25
    • 1970-01-01
    相关资源
    最近更新 更多