Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Representing if-then sentence using OWL?

Tags:

owl

ontology

I am working with basic OWL, and it's quite easy to represent some simple sentence like "Songoku is a lecturer, he teaches Maths".

E.g.:

<owl:Class rdf:ID="Lecturer"></owl:Class>
<owl:Class rdf:ID="Subject"></owl:Class>
<owl:Property rdf:ID="teach">
   <rdfs:domain rdf:resource="#Lecturer"/>
   <rdfs:range rdf:resource="#Subject"/>
</owl:Property>

<Subject rdf:ID="Maths"></Subject>
<Lecturer rdf:ID="Songoku">
    <teach>
        <Subject rdf:about="#Maths"></Subject>
    </teach>
</Lecturer>

But I faced a problem when I tried to represent this sentence: Bob is a Student, If Bob has 5 dogs, then he has at least 1 cat..

Can you tell me some suggestion?

like image 431
Songokute Avatar asked May 11 '13 10:05

Songokute


2 Answers

You can represent some fairly complicated conditional sentences in OWL using general subclass axioms. Let's look at a few examples. If you were trying something a little bit simpler, say

Students with at least five dogs have at least one cat.

which is shorthand for the quantified conditional "For all x, if x is a student with at least five dogs, then x has at least one cat, you can do this in OWL with

(Student and hasPet min 5 Dog) subClassOf (hasPet some Cat)

Those are both anonymous class expressions, but you could define some equivalent classes to make some things simpler:

StudentWithAtLeastFiveDogs equivalentClass (Student and hasPet min 5 Dogs)
CatOwner equivalentClass (hasPet some Cat)
StudentWithAtLeastFiveDogs subClassOf CatOwner

Now, your example was Bob is a Student, If Bob has 5 dogs, then he has at least 1 cat. There are two sentences there. The first is easily encoded by

Bob a Student

The second is a bit more complicated. You're saying that Bob is a member of the class of things which, if they have at least five dogs, they have at least one cat. A (material) conditional "If P then Q" is logically equivalent to the disjunction "(not P) or Q". So we're saying that Bob is a member of the class of things that either do not have at least five dots or that do have at least one cat. The class expression for that is

(not (hasPet min 5 Dog)) or (hasPet some Cat)

Now our knowledge about Bob is that

Bob a Student
Bob a (not (hasPet min 5 Dog)) or (hasPet some Cat)

You could define an equivalent class for that anonymous class expression, but I doubt it will be rendered very naturally in most languages. Here's what an ontology containing that knowledge about Bob looks like (in the N3 format):

@prefix :        <http://www.example.com/example#> .
@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.com/example>
      a       owl:Ontology .
:Cat  a       owl:Class .
:Student
      a       owl:Class .
:Dog  a       owl:Class .
:hasPet
      a       owl:ObjectProperty .
:Bob  a       :Student , owl:NamedIndividual ;
      a       [ a       owl:Class ;
                owl:unionOf ([ a       owl:Class ;
                            owl:complementOf
                                    [ a       owl:Restriction ;
                                      owl:minQualifiedCardinality
                                              "5"^^xsd:nonNegativeInteger ;
                                      owl:onClass :Dog ;
                                      owl:onProperty :hasPet
                                    ]
                          ] [ a       owl:Restriction ;
                            owl:onProperty :hasPet ;
                            owl:someValuesFrom :Cat
                          ])
              ] .

This same approach can be used for datatype properties and restrictions on their values. For instance, to say that "if Bob weighs at least 60kg, then he is at least 180cm tall," we can say that Bob is an element of the class of things that, if they weight at least 60kg, then they are at least 180cm tall, or equivalently, the class of things that either do not weight at least 60kg, or that are at least 180 cm tall. In the Manchester syntax, the class expression looks like

(not (hasWeight some int[>= 60])) or (hasHeight some int[>= 180])

The relevant portion from the N3 serialization of the ontology is:

:Bob  a       [ a       owl:Class ;
                owl:unionOf ([ a       owl:Class ;
                            owl:complementOf
                                    [ a       owl:Restriction ;
                                      owl:onProperty :hasWeight ;
                                      owl:someValuesFrom
                                              [ a       rdfs:Datatype ;
                                                owl:onDatatype xsd:int ;
                                                owl:withRestrictions
                                                        ([ xsd:minInclusive 60
                                                          ])
                                              ]
                                    ]
                          ] [ a       owl:Restriction ;
                            owl:onProperty :hasHeight ;
                            owl:someValuesFrom
                                    [ a       rdfs:Datatype ;
                                      owl:onDatatype xsd:int ;
                                      owl:withRestrictions
                                              ([ xsd:minInclusive 180
                                                ])
                                    ]
                          ])
              ] .
like image 167
Joshua Taylor Avatar answered Dec 14 '22 13:12

Joshua Taylor


This is a text in Attempto Controlled English (ACE):

Bob is a student. If Bob has 5 dogs then Bob has at least 1 cat.

and it has this representation in OWL:

ClassAssertion(
  :student
  :Bob
)
SubClassOf(
  ObjectIntersectionOf(
     ObjectOneOf(
        :Bob
     )
     ObjectMinCardinality(
        5
        :have
        :dog
     )
  )
  ObjectSomeValuesFrom(
     :have
     :cat
  )
)

which can be computed automatically with the ACE parser (APE). So, if you have managed to conceptualize your statement in English, it's worth checking if the ACE parser can map it automatically to OWL, see the online demo of the ACE parser.

like image 44
Kaarel Avatar answered Dec 14 '22 11:12

Kaarel