Ontology Languages (COMP321) Solution to Exercise 7 1. Solution: Query Answer for I Certain A for DNemo Certain A for (T , DNemo ) Clownfish(Karl) Yes Yes Yes Clownfish(Dory) No Don’t know No Fish(Nemo) No Don’t know Yes ¬Fish(Nemo) Yes Don’t know No ∃has friend.>(Nemo) Yes Yes Yes ∃has friend.Fish(Nemo) No Don’t know Yes Clownfish u ¬Surgeonfish(Karl) Yes Don’t know Yes Fish(Dory) No Don’t know Yes Surgeonfish u ¬Fish(Dory) Yes Don’t know No ∃has friend.Clownfish(Karl) No Don’t know Don’t know 2. Consider the following non-Boolean queries Fi : • F1 (x) = Clownfish(x) • F2 (x) = ¬Surgeonfish(x) • F3 (x, y) = has friend(x, y) • F4 (x) = Clownfish(x) ∧ ¬has friend(x, Dory) For each query Fi , give • answer(Fi , I); • certanswer(Fi , DNemo ); • certanswer(Fi , (T , DNemo )). Solution: • answer(F1 , I) = {Nemo, Karl}. • certanswer(F1 , DNemo ) = {Nemo, Karl}. • certanswer(F1 , (T , DNemo )) = {Nemo, Karl}. • answer(F2 , I) = {Nemo, Karl}. • certanswer(F2 , DNemo ) = ∅. • answer(F2 , (T , DNemo )) = {Nemo, Karl}. • answer(F3 , I) = {(Nemo, Dory)}. • certanswer(F3 , DNemo ) = {(Nemo, Dory)}. • certanswer(F3 , (T , DNemo )) = {(Nemo, Dory)}. • answer(F4 , I) = {Karl}. • certanswer(F4 , DNemo ) = ∅. • certanswer(F4 , (T , DNemo )) = ∅. 3. Consider the EL TBox T0 : Footballplayer Basketballplayer Handballplayer Team Manager Manager v v v v v v ∃plays for.Team ∃plays for.Team ∃plays for.Team ∃managed by.Manager Employee ∃managed by.Manager and the ABox A0 : Footballplayer(bob), Basketballplayer(john), Handballplayer(peter), Team(redsocks) managed by(redsocks, sue) Compute the interpretation IT0 ,A0 as described in the Comp321 Lecture Notes. Solution: The initial assignment is: S(dFootballplayer ) S(dBasketballplayer ) S(dHandballplayer ) S(dTeam ) S(dManager ) S(dEmployee ) S(bob) S(john) S(peter) S(redsocks) S(sue) R(plays for) R(managed by) = = = = = = = = = = = = = {Footballplayer} {Basketballplayer} {Handballplayer} {Team} {Manager} {Employee} {Footballplayer} {Basketballplayer} {Handballplayer} {Team} ∅ ∅ {(redsocks, sue)} • Update R using (rightR) six times: R(plays for) = {(dFootballplayer , dteam ), (dBasketballplayer , dTeam ), (dHandballplayer ), dTeam ), (bob, dTeam ), (john, dTeam ), (peter, dTeam )} • Update S using (simpleR): S(dManager ) = {Manager, Employee} • Update R using (rightR) three times: R(managed by) = {(redsocks, sue), (dTeam , dManager ), (dManager , dManager ), (redsocks, dManager )} Thus, the interpretation IT0 ,A0 is given by: • The domain ∆IT0 ,A0 consists of dFootballplayer , dBasketballplayer , dHandballplayer , dTeam , dManager , dEmployee , bob, john, peter, redsocks, sue. • FootballplayerIT0 ,A0 = {dFootballplayer , bob}; • BasketballplayerIT0 ,A0 = {dBasketballplayer , john}; • HandballplayerIT0 ,A0 = {dHandballplayer , peter}; • TeamIT0 ,A0 = {dTeam , redsocks}; • ManagerIT0 ,A0 = {dManager }; • EmployeeIT0 ,A0 = {dManager , dEmployee }; • plays forIT0 ,A0 consists of (dFootballplayer , dteam ), (dBasketballplayer , dTeam ), (dHandballplayer ), dTeam ) (bob, dTeam ), (john, dTeam ), (peter, dTeam )}. • managed byIT0 ,A0 consists of (redsocks, sue), (dTeam , dManager ), (dManager , dManager ), (redsocks, dManager ). For EL concept queries, we know that IT0 ,A0 gives the answer “Yes” if, and only if, (T0 , A0 ) gives the answer “Yes”. Check this for the queries: • ∃plays for.Team(peter); • ∃managed by.Manager(peter); • ∃plays for.∃managed by.Manager(peter). Solution. • ∃plays for.Team(peter): in both cases the answer is “Yes”. • ∃managed by.Manager(peter): in both cases the answer is not “Yes”. For IT0 ,A0 it is “No”; for (T0 , A0 ) it is “Don’t know”. • ∃plays for.∃managed by.Manager(peter): in both cases the answer is “Yes”. For more complex queries, IT0 ,A0 can give the answer “Yes” even if (T0 , A0 ) does not give the answer “Yes”. Check this for • F (x, y) = ∃z.(plays for(x, z) ∧ plays for(y, z)). • F = ∃x.managed by(x, x). Solution. • john and peter play for dTeam in IT0 ,A0 . Thus IT0 ,A0 |= F (john, peter). But (T0 , A0 ) 6|= F (john, peter). • (dManager , dmanager ) ∈ managed byIT0 ,A0 . Thus IT0 ,A0 |= F . However, (T0 , A0 ) 6|= F .