uml与RDF和OWL的关系 [英] uml Composition relationships to RDF and OWL
问题描述
我是RDF和OWL本体的初学者.
I'm beginner in RDF and OWL ontologies.
我正在尝试将此图转换为OWL语法.
I'm trying to transform this diagram into OWL syntax.
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<!-- OWL Class Definition - Robot Position -->
<owl:Class rdf:ID="house" />
<owl:Class rdf:ID="room" />
<owl:Class rdf:ID="kitchen" />
<owl:Class rdf:ID="garden" />
<owl:Class rdf:ID="table" />
<owl:Class rdf:ID="chair" />
<owl:ObjectProperty rdf:ID="composedBy">
<rdfs:domain rdf:resource="#house"/>
<rdfs:rang rdf:resource="#room" >
</owl:ObjectProperty>
</rdf:RDF>
我不知道如何使多次使用的按关系组成. 我正在考虑使用
I don't know how to do to make the composed by relation used many times. I'm thinking to make the range to take in a collection type with
(house)---composedBy---(room, kitchen, garden)
但是,我想使用相同的关系
but, I want to use the same relation with
(kitchen)---comoposedBy---(table, chair)
验证器发生错误,因为我两次使用committedBy作为ID. (我现在将其删除)
The validator is making an error because I used composedBy as an ID twice. (I removed it now)
如何正确翻译此图.
:))
推荐答案
如果您要说一所房子必须有一个(或至少一个)厨房,并且必须有一个(或至少一个)房间,并且必须有一个(或至少一个)花园,那么unionOf并不能真正解决这里的问题.我认为不必担心composition属性的范围,如果您拥有更通用的component属性,并通过使用存在性限制来表达必须保持的不同关系,则可能会有所帮助.例如,你可以这么说
If you're trying to say that a House must have a (or at least one) Kitchen, and must have a (or at least one) Room, and must have a (or at least one) Garden, then unionOf isn't really solving the issue here. Rather than worrying about the range of the composition property, I think it might be more helpful if you have a more generic component property, and express the different relationships that must hold by using existential restrictions. E.g., you could say that
房屋⊑ = 1 hasPart.Kitchen
房屋⊑ ≥2hasPart.Room
房屋⊑ ∃ hasPart.Garden
House ⊑ =1 hasPart.Kitchen
House ⊑ ≥2 hasPart.Room
House ⊑ ∃hasPart.Garden
说一栋房子正好有一个厨房,至少两个房间和至少一个花园.同样,您可以说其中有一张桌子和一张带有
to say that a House has exactly one Kitchen, at least two Room, and at least one Garden. Similarly, you could say that has a table and a chair with
厨房⊑ ∃ hasPart.Chair
厨房⊑ ∃ hasPart.Table
Kitchen ⊑ ∃hasPart.Chair
Kitchen ⊑ ∃hasPart.Table
在Protégé中,它看起来像:
In Protégé, this would look like:
Turtle和RDF/XML中的RDF序列化是:
The RDF serialization in Turtle and RDF/XML are:
@prefix : <http://www.example.org/houses#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://www.example.org/houses>
a owl:Ontology .
:hasPart a owl:ObjectProperty .
:Table a owl:Class .
:Room a owl:Class .
:Garden a owl:Class .
:Chair a owl:Class .
:House a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:minQualifiedCardinality "2"^^xsd:nonNegativeInteger ;
owl:onClass :Room ;
owl:onProperty :hasPart
] ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty :hasPart ;
owl:someValuesFrom :Garden
] ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onClass :Kitchen ;
owl:onProperty :hasPart ;
owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger
] .
:Kitchen a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty :hasPart ;
owl:someValuesFrom :Table
] ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty :hasPart ;
owl:someValuesFrom :Chair
] .
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://www.example.org/houses#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.example.org/houses"/>
<owl:Class rdf:about="http://www.example.org/houses#Room"/>
<owl:Class rdf:about="http://www.example.org/houses#House">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:about="http://www.example.org/houses#hasPart"/>
</owl:onProperty>
<owl:onClass rdf:resource="http://www.example.org/houses#Room"/>
<owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
>2</owl:minQualifiedCardinality>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:someValuesFrom>
<owl:Class rdf:about="http://www.example.org/houses#Garden"/>
</owl:someValuesFrom>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:onClass>
<owl:Class rdf:about="http://www.example.org/houses#Kitchen"/>
</owl:onClass>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
>1</owl:qualifiedCardinality>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="http://www.example.org/houses#Chair"/>
<owl:Class rdf:about="http://www.example.org/houses#Table"/>
<owl:Class rdf:about="http://www.example.org/houses#Kitchen">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:someValuesFrom rdf:resource="http://www.example.org/houses#Table"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:someValuesFrom rdf:resource="http://www.example.org/houses#Chair"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
</rdf:RDF>
这篇关于uml与RDF和OWL的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!