3

I am trying to convert a UML Class Diagram into an Ontoloy and I have a Question.

Let's say I have the following setup:

        rel1
ClassA ------> ClassB

        rel1
ClassC ------> ClassD

For the first case I converted the Relation "rel1" to an Object Property as follows:

_x:rel1 rdf:type owl:ObjectProperty ;
    rdfs:domain _x:ClassA ;
    rdfs:range _x:ClassB .

But I don't know how to go about the Second one. What I want to have is: rel1 has the domain-range pair (ClassA,ClassB) OR (ClassC, ClassD). First I thought about using a union, but it doesn't model it in an appropriate way, because combinations like (ClassA, ClassD) or (ClassC, ClassB) could be possible.

I hope somebody can help.

Thank you, John

John
  • 63
  • 4

1 Answers1

2

What your rel1 association is saying is that it has as domain the union of ClassA and ClassC with the range the union of ClassB and ClassD, which you can specify as follows:

ObjectProperty: rel1
  Domain: ClassA or ClassC
  Range: ClassB or ClassD

The main benefit of specifying domain and range restrictions for a property is that if 2 individuals are linked via that property, the reasoner can infer the types of the individuals. Specifying the domain and range as stated above will not allow this because ClassA or ClassC is an anonymous class and reasoners typically only give inferences on named classes, not anonymous classes. To get around this you can do the following:

Class: Rel1Domain 
  EquivalentTo: ClassA or ClassC

Class: Rel1Range 
  EquivalentTo: ClassB or ClassD

ObjectProperty: rel1
  Domain: Rel1Domain
  Range: Rel1Range    
Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
  • Well, what I forgot to mention is, that the relation should be either (ClassA, ClassB) or (ClassC,ClassD). I don't want combinations like (ClassA, ClassD) to be possible. So I don't know if a union would do the trick. – John May 25 '18 at 11:26
  • Well then you really have 2 different properties and it should be called different names. I.e. `rel1AB ` and `rel1CD` with the domains and ranges as you need. – Henriette Harmse May 25 '18 at 11:42
  • The problem is, that I should do it according to a UML Class Diagramm. And I am not allowed to change it. But if there is no workaround, maybe I have to. Btw, I used many of your UML to OWL rules you described in your paper, so thank you for that. It was really helpfull :) – John May 25 '18 at 11:52
  • You could put local constraints to exclude unwanted pairs; i.e., add an axiom saying that ClassA is a subclass of forall rel1 ClassB. This will imply that any use of rel1 between an individual of ClassA and an individual of ClassD will fail (provided that ClassB and ClassD are disjoint). Otherwise you have to drop the universal ranges and specify what you expect to be the filler of rel1 for each use. – Ignazio May 25 '18 at 21:04
  • @John When you have an association `rel1` between different classes in UML, the actual qualified name of `rel1` are different. I.e. it is `A::rel1` vs `C::rel1`. Hence, strictly speaking they are different associations. However, if you gather the domains and ranges together as I suggested, you can discover various modeling heuristic violations. I discuss this in Chapter 7 of [my dissertation](https://henrietteharmse.files.wordpress.com/2017/09/scenariotestingusingowl_v0-1-7-final.pdf). – Henriette Harmse May 26 '18 at 06:13