How to find overlapping classes? - owl

Full ontology:
Prefix: : <http://www.semanticweb.org/l.smolaga/ontologies/2018/0/untitled-ontology-14#>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Ontology: <http://www.semanticweb.org/l.smolaga/ontologies/2018/0/untitled-ontology-14>
Datatype: xsd:int
DataProperty: hasAge
Characteristics:
Functional
Domain:
Person
Range:
xsd:int
Class: Person
Class: Student
EquivalentTo:
Person
and (hasAge some xsd:int[>= "18"^^xsd:int , <= "26"^^xsd:int])
Class: Teenager
EquivalentTo:
Person
and (hasAge some xsd:int[>= "11"^^xsd:int , <= "19"^^xsd:int])
I'm trying to find a way to check if two classes overlap.
For example let's consider we have an ontology with 3 classes (Person, Teenager and Student).
Teenager is equivalent to Person and hasAge some xsd:int[>= 11, <=19 ]
Student is equivalent to Person and hasAge some xsd:int[>= 18, <=26 ]
I want to check which class overlaps with Student. How I can do this using owlapi/jena ?

The easiest way will be to create an individual, say x, which is of type (Person and Student and Teenager). Invoke the reasoner and if your ontology is consistent, it means it is possible for an individual to belong to all classes. If the ontology is inconsistent, it means an individual cannot belong to all the classes simultaneously.
You should be able to do this in an ontology editor, or programmatically via the owl-api or jena.

Related

How do I use Manchester Syntax in WebProtege to group only some individuals from from a different class based on individual name

I would like to create a new class PossibleNoduleFinding, grouping some individuals from another class Finding based on the individual name. Finding has a relationship hasFinding with each individual. Example maybe individual name nodule.
I'm trying:
Class: PossibleNodueFinding
Annotations: [in root-ontology]
rdfs:label "PossibleNoduleFinding"#en
SubClassOf: [in root-ontology]
SoftwareMapping
EquivalentTo: (Finding and hasFinding value nodule),
EquivalentTo: (Finding and hasFinding value density)
The Owl editor is not recognizing this syntax.

OWL/Protege: Model inferred class of persons, who are not members of a group

I try to create an ontology in OWL, using Protégé 5.5.0. No I have a little trouble with inferred classes.
I have three classes: Agents and as subclasses Groups and Persons. Persons can be members of Groups. Now I want to create two inferred classes: a) "Members of groups" and b) "Not members of groups" (both as subclasses of Person)
I was successful with a), using the axiom equivalent class: Person and member_of some Group.
I created one individual, which is a person and member of a group and it was inferred to be member of the class "Members of groups".
Now I'm stuck with b). I tried several options for the equivalent class, for example:
Person and member_of max 0 Group
Or: Person and member_of exactly 0 Group
Or: Person and not member_of some Group
I created an individual which is a person but no groupmember. But the reasoner does not agree with me about the fact, that this individual should belong to the inferred class "Not members of groups".
What did I do wrong?
One way to achieve this in OWL, using your Person and not member_of some Group,
is to define a MemberOfGroup class that is defined as you suggested. Then define a NotMemberOfGroup class, that is disjoint with the MemberOfGroup class. If you now define your individual to be of type Person, as well as of type not member_of some Group, then your individual will be classified as belonging to the NotMemberOfGroup class.
The reason why you have to do this, is that OWL uses the open world assumption and hence it can only make inferences about things it knows for sure. I.e. saying that the individual is a Person, while making no statement regarding member_of provides the reasoner with zero explicit info to determine that the individual either belongs or does not to a group.
The other option is to use SHACL/SHEX/SPIN.

Data properties dependency in Protege

Could someone please provide examples of what kind (if any) dependecies between Data Properties we can declare in Protege?
Basically what I am trying to do is to declare simple rules, that e.g one Data Property (year) can or can not be before the other one ( like Birth Year <= Death Year). Is that possible to be done using Data Properties?
The only dependencies that can be expressed between DataProperties are subproperty and disjointness properties. SWRLTab in Protege can be used to express rules. Assuming the following ontology:
ObjectProperty: hasDeathCertificate
Domain: Person
Range: DeathCertificate
DataProperty: dateOfBirth
Domain: Person
Range: xsd:dateTime
DataProperty: dateOfDeath
Domain: DeathCertificate
Range: xsd:dateTime
Class: DeathCertificate
Class: Person
the following SWRL rule can be specified to ensure that the date of death on a DeathCertificate is after the date birth of the person.
Person(?p)^dateOfBirth(?p, ?birth)^DeathCertificate(?d)^dateOfDeath(?p, ?death)
^swrlb:greaterThan(?death, ?birth)->hasDeathCertificate(?p, ?d)
Good luck!

Defining a class individuals as a combination of another class individuals

In an OWL ontology, given a class Student; I want to define another class StudentsPair, which is any pair of students, in such a way that automatically computes all the possible dual combinations of Student, i.e.
Student(x) and Student (y) --> StudentsPair(x,y)
I want StudentsPair as a class, not a property, because it may have additional features (such as averagePerformanceForPair, etc.).
For example,
Premise
Student(John)
Student(Alex)
Student(Mary)
-----------------
Conclusion
StudentPair((John, Alex))
StudentPair((John, Mary))
StudentPair((Alex, Mary))
The reasoner has to somehow create these new individuals! Is this possible?
You need an additional role student, then you can use Description Logic Rules, something like that might work:
Student ≡ ∃student.Self
student ◦ U ◦ student ⊑ StudentPair

OWL's EquivalentClass vs. SubClassOf

What is the difference between EquivalentClass and SubClass of? While reading through OWL primer, i find the tutorial uses SubClassOf a lot to declare a new class, as follows
SubClassOf(
:Teenager
DataSomeValuesFrom( :hasAge
DatatypeRestriction( xsd:integer
xsd:minExclusive "12"^^xsd:integer
xsd:maxInclusive "19"^^xsd:integer
)
)
)
Can I write
EquivalentClass(
:Teenager
DataSomeValuesFrom( :hasAge
DatatypeRestriction( xsd:integer
xsd:minExclusive "12"^^xsd:integer
xsd:maxInclusive "19"^^xsd:integer
)
)
)
instead?
When stating that A is a subclass of B, this restricts A to necessarily inherit all characteristics of B, but not the other way around. In your example, A = Teenager, and B = hasAge [12:19] (my own notation, but you get the idea).
This means that any instance of Teenager in the OWL ontology must necessarily also have the property hasAge with a value in the range [12:19], but not the other way around. Specifically, this does not mean that any instance of something with the property hasAge with a value in the range [12:19] is also an instance of Teenager. To make this clear, consider an instance (called c) of class Car. We might also say that:
c . hasAge 13
This says that instance c of Car is 13 years old. However, with the subclass axiom defining Teenager above, a reasoner would not infer that c is also an instance of Teenager (perhaps as we'd want, if teenagers are people, not cars).
The difference when using equivalence is that the subclass relationship is implied to go in both directions. So, if we were to instead include the second axiom that defined Teenager to be equivalent to anything with the property hasAge with a value in the range [12:19], then a reasoner would infer that the car c is also an instance of Teenager.
Equivalent classes might have the same members, e.g.,
:USPresident owl:equivalentClass :USCommanderInChief
will both have the same individuals (all or some of the US presidents). So if we assert that John Adams was a USCommanderInChief it can be inferred that John Adams was also a US President.
With subclass, we're indicating a hierarchy. e.g., GrannySmithApple is a type of Apple.
:USPresident owl:equivalentClass :USCommanderInChief .
is the same as
:USPresident rdfs:subClassOf :USCommanderInChief ;
:USCommanderInChief rdfs:subClassOf :USPresident .

Resources