在Protégé中,我创建了一个包含 Service , Attributes 等类的本体,以及一个对象属性 hasAttributes ,如下所示:
服务具有属性属性(serviceIdentifier:String,Type(String),Description(sting),providerIdentifier(String),InputParameter(),OutputParameter(),price(Integer)
我的问题是:我们必须将 serviceidentifier , type , description 等作为类的子类或数据属性属性
本体论如下:
<?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 -->
答案 0 :(得分:2)
现在写的问题很难说出你的要求,但如果我理解你的话,我的印象是你现在有两个班:
并且服务可以通过hasAttribute属性与Attribute相关联。此外,每个属性都由一些属性的值描述:
这意味着您可能拥有如下所示的数据:
:service72 :hasAttribute _:attr1 .
_:attr1 rdf:type :Attribute .
_:attr1 :price 73 .
除非你因某种原因确实需要引用属性的实例,否则这种表示似乎比它需要的要复杂一些。至于具体问题:
我们必须将serviceidentifier,类型,描述等视为类Attributes的子类或数据属性吗?
您可以声明,例如,ServiceIdentifier作为Attribute的子类,但如果服务提供者的重要值是字符串,那么您仍然需要一个将ServiceIdentifier的实例与之关联的数据属性实际标识服务的字符串。也就是说,你最终会得到这样的数据:
:service72 :hasAttribute _:attr
_:attr rdf:type :ServiceIdentifier .
_:attr :hasServiceIdentifierString "service identification"
对象属性将个体与其他个体相关联,数据属性将个体与文字数据相关联。如果你让hasAttribute成为一个对象属性,那么Attributes必须是个体,不同类型的属性可以是Attrbute的子类,但是你需要数据属性来将Attribute的实例与实际的属性值相关联。
我认为您可以轻松地将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 .
一般来说,在早期使用最少数量的结构可能并不是一个坏主意,并且在您取得进展并需要更多结构时优化本体。