【问题标题】:owl ontology (data properties)owl本体(数据属性)
【发布时间】:2014-03-26 14:13:27
【问题描述】:

在 Protégé 中,我创建了一个包含类 ServiceAttributes 等的本体,以及一个对象属性 hasAttributes,如下所示:

Service有Attributes属性(serviceIdentifier:String, Type(String), Description(sting), providerIdentifier(String), InputParameter(), OutputParameter(), price(Integer)

我的问题是:我们是否必须将serviceidentifiertypedescription等视为类的子类或数据属性属性

本体如下:

<?xml version="1.0"?>


<!DOCTYPE Ontology [
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
    <!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>


<Ontology xmlns="http://www.w3.org/2002/07/owl#"
     xml:base="http://www.semanticweb.org/acer/ontologies/2014/1/untitled-ontology-56"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     ontologyIRI="http://www.semanticweb.org/acer/ontologies/2014/1/untitled-ontology-56">
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <Declaration>
        <Class IRI="#attributes"/>
    </Declaration>
    <Declaration>
        <Class IRI="#capsule"/>
    </Declaration>
    <Declaration>
        <Class IRI="#requirement"/>
    </Declaration>
    <Declaration>
        <Class IRI="#service"/>
    </Declaration>
    <Declaration>
        <ObjectProperty IRI="#hasAttribute"/>
    </Declaration>
    <Declaration>
        <ObjectProperty IRI="#hasCapsule"/>
    </Declaration>
    <Declaration>
        <ObjectProperty IRI="#hasRequirement"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#description"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#diskFree"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#diskFreeUnit"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#diskFreeValue"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#inputParameter"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#location"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#memoryFree"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#memoryFreeUnit"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#memoryFreeValue"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#numInstance"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#operationSystem"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#outputParameter"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#port"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#price"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#protocol"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#providerIdentifier"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#serviceIdentifier"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="#type"/>
    </Declaration>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#description"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#inputParameter"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#numInstance"/>
            <Datatype abbreviatedIRI="xsd:integer"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#outputParameter"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#price"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#providerIdentifier"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#serviceIdentifier"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#attributes"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#type"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#capsule"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#location"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#capsule"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#port"/>
            <Datatype abbreviatedIRI="xsd:integer"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#capsule"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#protocol"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#requirement"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#diskFreeUnit"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#requirement"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#diskFreeValue"/>
            <Datatype abbreviatedIRI="xsd:integer"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#requirement"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#memoryFreeUnit"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#requirement"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#memoryFreeValue"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#requirement"/>
        <DataAllValuesFrom>
            <DataProperty IRI="#operationSystem"/>
            <Datatype abbreviatedIRI="xsd:string"/>
        </DataAllValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#service"/>
        <ObjectSomeValuesFrom>
            <ObjectProperty IRI="#hasAttribute"/>
            <Class IRI="#attributes"/>
        </ObjectSomeValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#service"/>
        <ObjectSomeValuesFrom>
            <ObjectProperty IRI="#hasCapsule"/>
            <Class IRI="#capsule"/>
        </ObjectSomeValuesFrom>
    </SubClassOf>
    <SubClassOf>
        <Class IRI="#service"/>
        <ObjectSomeValuesFrom>
            <ObjectProperty IRI="#hasRequirement"/>
            <Class IRI="#requirement"/>
        </ObjectSomeValuesFrom>
    </SubClassOf>
    <SubDataPropertyOf>
        <DataProperty IRI="#diskFreeUnit"/>
        <DataProperty IRI="#diskFree"/>
    </SubDataPropertyOf>
    <SubDataPropertyOf>
        <DataProperty IRI="#diskFreeValue"/>
        <DataProperty IRI="#diskFree"/>
    </SubDataPropertyOf>
    <SubDataPropertyOf>
        <DataProperty IRI="#memoryFreeUnit"/>
        <DataProperty IRI="#memoryFree"/>
    </SubDataPropertyOf>
    <SubDataPropertyOf>
        <DataProperty IRI="#memoryFreeValue"/>
        <DataProperty IRI="#memoryFree"/>
    </SubDataPropertyOf>
</Ontology>



<!-- Generated by the OWL API (version 3.4.2) http://owlapi.sourceforge.net -->

【问题讨论】:

  • 如果你能发布你的本体会很有帮助。目前很难准确地说出你在问什么。
  • 这看起来不像是说明您的问题的本体的最小示例。你确定你不能做一个更小的例子来说明这个问题吗?

标签: semantic-web owl ontology protege linked-data


【解决方案1】:

由于现在写的问题,有点难以说出你在问什么,但如果我理解正确的话,我的印象是你目前有两个类:

  • 服务
  • 属性

并且服务可以通过 hasAttribute 属性与属性相关联。此外,每个属性都由一些属性的一些值来描述:

  • 服务标识符(范围:字符串)
  • 类型(范围:字符串)
  • 描述(范围:字符串)
  • inputParameter(范围:未指定)
  • 输出参数(范围:未指定)
  • 价格(范围:整数)

这意味着您可能拥有如下所示的数据:

:service72 :hasAttribute _:attr1 .
_:attr1 rdf:type :Attribute .
_:attr1 :price 73 .

除非您出于某种原因实际上需要引用 Attributes 的实例,否则这种表示似乎比它需要的要复杂一些。至于具体问题:

我们必须将服务标识符、类型、描述等视为类 Attributes 的子类或数据属性吗?

可以声明,例如,ServiceIdentifier 作为 Attribute 的子类,但如果服务提供者的重要值是一个字符串,那么您仍然需要一个将 ServiceIdentifier 实例关联到的数据属性实际标识服务的字符串。也就是说,你最终会得到这样的数据:

:service72 :hasAttribute _:attr
_:attr rdf:type :ServiceIdentifier .
_:attr :hasServiceIdentifierString "service identification"

对象属性将个人与其他个人联系起来,数据属性将个人与文字数据联系起来。如果您将 hasAttribute 设为对象属性,则 Attributes 必须是个体,并且不同种类的属性可以是 Attrbute 的子类,但您需要数据属性来将 Attribute 的实例与实际的属性值相关联。

我认为您可以轻松地将 hasAttribute 设为数据属性,然后将这些属性声明为作为 hasAttribute 子属性的数据属性。也就是说,你会有这样的属性层次结构:

  • hasAttribute(范围:未指定)
    • 服务标识符(范围:字符串)
    • 类型(范围:字符串)
    • 描述(范围:字符串)

那么你可以有这样的数据:

:service72 :serviceIdentifier "some identification" .
:service72 :type "my favorite service" .
:service72 :price 32 .

那么,因为那些属性是hasAttribute的子属性,所以如果你使用一个推理器,你仍然可以根据需要推断出以下三元组:

:service72 :hasAttribute "some identification" .
:service72 :hasAttribute "my favorite service" .
:service72 :hasAttribute 32 .

一般来说,在早期使用最少个必要的结构可能不是一个坏主意,并随着你的进步和需要更多的结构来完善你的本体。

【讨论】:

  • 谢谢你的回答,但是请我把我的本体发给你,因为我不太明白你的解释。
  • @user3347859 您的问题下方有一个编辑链接。正如我在评论中指出的那样,您应该将本体作为代码复制并粘贴到问题中。
  • 我有一条消息:太长了 6416 个字符
  • @user3347859 你可能想展示太多了;您当然不需要整个本体来说明您要做什么。尝试create a Minimal, Complete, Tested and Readable example。另见SSCCE。从头开始,放在一起足以说明问题。这是标准的良好调试实践。另外,这是关于这个问题的讨论,而不是关于我的特定答案。让我们把未来的 cmets 放在这个问题上,而不是这个答案上。
  • @user3347859 否。将本体添加到问题中。请不要将其作为评论发布,尤其是不要作为对答案的评论。
猜你喜欢
  • 2013-09-04
  • 2014-02-25
  • 2016-08-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-12
  • 1970-01-01
相关资源
最近更新 更多