logics for data and knowledge representation web ontology language (owl) -- exercises feroz farazi

16
Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

Upload: letitia-gwenda-turner

Post on 21-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

Logics for Data and Knowledge Representation

Web Ontology Language (OWL) -- Exercises

Feroz Farazi

Page 2: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

Exercise 1 Suppose that a family consists of a father (John), a mother

(Maria), two sisters (Sara and Jenifer) and two brothers

(David and Robert). In an OWL representation we find that

the two brothers and the two sisters are codified as follows: :David :hasFather :John

:Sara :hasFather :John

:John :spouseOf :Maria

Later on another property :hasChild is codified.

(i) What will be the output of the following SPARQL Query

when a reasoner is activated?:John :hasChild ?y

Page 3: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

(ii) Expand the OWL representation in a way that supports

returning non-empty result of the following query and this

expansion is independent of the entity-entity triples.:John :hasChild ?y

(iii) Add also the following axioms to the dataset. :Jenifer :hasFather :John

:Robert :hasFather :John

What result the following query will return?

:John :hasChild ?y

(iv) How can we infer the spouse relation in the reverse direction?

Exercise 1

Page 4: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

Solution

(i) The result of the query is empty.

(ii) We can make the property :hasFather as an inverse

property of :hasChild as follows:

:hasFather owl:inverseOf :hasChild

Query Result: :David

:Sara

(iii) Query Result::David

:Sara

:Jenifer

:Robert

(iv) We can make the relation :spouseOf its own inverse as follows: :spouseOf owl:inverseOf :spouseOf

Page 5: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

Within a family, relations such as

:spouseOf

:marriedTo

:siblingOf

are applicable in both directions (from subject to object, and vice versa) whereas the following do not hold always.

:brotherOf

:sisterOf

i) Which property holds in the relations that are applicable in both directions?

ii) How can we represent these relations in OWL?

iii) In which basic category this property belongs?

Exercise 2

Page 6: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

i) Symmetric property holds in these relations

ii) They can be represented as follows:

:spouseOf rdf:type owl:SymmetricProperty

:marriedTo rdf:type owl:SymmetricProperty

:siblingOf rdf:type owl:SymmetricProperty

iii) The symmetric property is an object property. Moreover,

the domain and range of the symmetric property are the

same.

Solution

Page 7: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

Consider that in the family of John and Maria, also John’s father (James) and mother (Jerry) live. Relations such as :hasAncestor and :hasDescendent can be applied between different levels. For example:

:John :hasAncestor :James

:Sara :hasAncestor :John

:James :hasDescendent :John

:John :hasDescendent :Sara• Which property holds in the relations that are applicable in

different levels of the hierarchy? • How can we represent these relations in OWL?• In which basic category this property belongs?• Show the results of the following queries:

a) :James :hasDescendent ?y b) :John :hasAncestor ?y

Exercise 3

Page 8: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

i) Transitive property holds in these relations

ii) They can be represented as follows:

:hasAncestor rdf:type owl:TransitiveProperty

:hasDescendent rdf:type owl:TransitiveProperty

iii) The transitive property is an object property.

iv) a) Query Result

:John

:Sara

b) Query Result:

:James

Solution

Page 9: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

1. In RDFS we can represent that two classes :Test and :Experiment are equivalent.

:Test rdfs:subClassOf :Experiment

:Experiment rdfs:subClassOf :Test

Convert this representation in OWL.

2. In RDFS we can represent that two properties :hasChild and :hasKid are equivalent.

:hasChild rdfs:subPropertyOf :hasKid

:hasKid rdfs:subPropertyOf :hasChild

Convert this representation in OWL.

3. Is there any way to represent the fact that two entities (or individuals) :Italia and :Il_Bel_Paese are same.

Exercise 4

Page 10: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

1. OWL representation:

:Test owl:equivalentClass :Experiment

2. OWL representation:

:hasChild owl:equivalentProperty :hasKid

3. It can be represented in OWL as follows:

:Italia owl:sameAs :Il_Bel_Paese

Solution

Page 11: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

1. a) Which OWL property allows to have exactly one value

for a particular individual?

b) In a family tree, relations such as the following ones can

be defined as functional.

:hasFather

:hasMother

Represent them in OWL and demonstrate their use with necessary entity-entity axioms.

2. a) Which OWL property allows to have exactly one subject

for a particular object?

c) Demonstrate the use of this property in developing

applications such as entity matching.

Exercise 5

Page 12: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

1. a) OWL Functional property has this feature.

b) OWL representations of the properties :hasFather and :hasMother are as follows:

:hasFather rdf:type owl:FunctionalProperty

:hasMother rdf:type owl:FunctionalProperty

Two entity-entity axioms are provided below:

:John :hasFather :James

:John :hasFather :Handler

The objects :James and :Handler are the values of the same subject and property. We already have defined that

:hasFather property is functional. Therefore, it can be concluded that :James and :Handler refer to the same person.

Solution

Page 13: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

2. a) OWL Inverse Functional property has this feature.

b) Given that the property :SSN (social security number) is

an Inverse Functional property and it is encoded as

follows:

:SSN rdf:type owl:InverseFunctionalProperty

Two entity-entity axioms are provided below:

mo:James :SSN N123812834

ps:Handler :SSN N123812834

The subjects :James and :Handler are attached to thesame social security number, which cannot be shared

by two different persons. Therefore, we can conclude that mo:James and ps:Handler are the same entity.

Solution

Page 14: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

Which OWL constructs support the encoding of the following statements?

i) If x and y are brothers and y is son of z then x is son of z.

ii) If y is brother of z and z is father of x, then y is uncle

of x.

iii) If disease x is located in body part y which is part of body

part z, then x is located in z.

Represent all the above statements in OWL. Also write

explicitly which version of OWL supports the encoding of

such statements.

Exercise 6

Page 15: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

SubPropertyOf and ObjectPropertyChain support the encoding of such statements.

i) SubPropertyOf( ObjectPropertyChain( :brotherOf :sonOf) :sonOf)

ii) SubPropertyOf( ObjectPropertyChain( :brotherOf

:fatherOf) :uncleOf)

iii) SubPropertyOf( ObjectPropertyChain( :locatedIn

:part of) :locatedIn)

Solution

Page 16: Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi

1. Create the family tree ontology in Protégé (can be downloaded here: http://protege.stanford.edu/download/registered.html#p4.3).

2. Encode inverse relation between entities.

3. Implement symmetric properties.

4. Implement functional properties.

5. Implement inverse functional properties.

6. Develop Pizza ontology according to the manual provided in the following link: http://130.88.198.11/tutorials/protegeowltutorial/resources/ProtegeOWLTutorialP4_v1_3.pdf

Exercise 7 (Laboratory)