简体   繁体   中英

define relationship between classes in protege5.0

I'm building my ontology using Protege tool and I've defined my classes and individuals. Now, I want to add relationship between classes. However, I've read that:

object property define relations between instances, but in OWL we can use restriction to define relations between classes

Can you help with some example to understand that?

My issue: I have class1 and class2 for which I need to build an "opposite Of" relation between those classes. Can you help?

Here are some steps you can follow:

(1) Create the classes Class1 and Class2 .

<owl:Class rdf:about="http://henrietteharmse.com/tutorial/DomainRangeExample#Class1"/>
<owl:Class rdf:about="http://henrietteharmse.com/tutorial/DomainRangeExample#Class2"/> 

(2) Define an object property, say, related with domain Class1 and range Class2 :

<owl:ObjectProperty rdf:about="http://henrietteharmse.com/tutorial/DomainRangeExample#related">
    <rdfs:domain rdf:resource="http://henrietteharmse.com/tutorial/DomainRangeExample#Class1"/>
    <rdfs:range rdf:resource="http://henrietteharmse.com/tutorial/DomainRangeExample#Class2"/>
</owl:ObjectProperty>

Explanation This states that if individual a is related to individual b via the object property related then a will be assumed to be of type Class1 and b will be assumed to be of type Class2 .

(3) Define another object property, say inverseRelated , that is the inverse of related :

<owl:ObjectProperty rdf:about="http://henrietteharmse.com/tutorial/DomainRangeExample#inverseRelated">
    <owl:inverseOf rdf:resource="http://henrietteharmse.com/tutorial/DomainRangeExample#related"/>
</owl:ObjectProperty>

Explanation This states that if individual a is related to individual b via the object property inverseRelated then a will be assumed to be of type Class2 and b will be assumed to be of type Class1 .

(4) Define 2 individuals, say individual1 and individual2 with individual1 to individual2 via the inverseRelated object property:

<owl:NamedIndividual rdf:about="http://henrietteharmse.com/tutorial/DomainRangeExample#individual1">
    <DomainRangeExample:inverseRelated rdf:resource="http://henrietteharmse.com/tutorial/DomainRangeExample#individual2"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://henrietteharmse.com/tutorial/DomainRangeExample#individual2"/>

(5) If you now run a reasoner over your ontology (ie in Protege), you will see that individual1 is inferred to be of type Class2 and individual2 is of type Class1 .

Consider classes A and B (I'm using turtle syntax)

:A rdf:type owl:Class .
:B rdf:type owl:Class .

You can define A and B to be disjoint (a relationship between classes), meaning that if an element is one of them it cannot be in another.

:A owl:disjointWith :B .

If you query for example:

not B

You obtain class A . It also works for individuals.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM