Solutions d'exercices sur le langage générique pour rechercher des RCs

Exercice de contrôle
Si l'on suppose que la BC [KB] ne contient que
   pm#relation  \.  (part  pm#type: pm#transitive_relation_type)  pm#type  pm#supertype
   B1  part _[each->a]: (B2 part _[each->a]: (B3 part _[each->a]: B4)),  /^ A1,  \. C1;

   //i.e.:   B1  /^ A1,  \. C1;   each B1  part: a B2;   any  B2 part: a B3;   any B3 part: a B4;
quelles réponses doit donner un moteur d'inférences aux requêtes FL suivantes
s'il connait la sémantique de pm#transitive_relation_type, pm#type et pm#supertype ?

//Queries   +   answers (here, with or without the "closed world assumption"):

/*1:*/ ? [a B1 part: a B4]

each B1  part: (a B2  part: (a B3  part: a B4));  //since "each" implies "a"   
part  pm#type: pm#transitive_relation_type;

/*2.*/ ? [a B1 part .^1: a B4]

[]  //no answer since "a B1" is not directly connected to "a B4"

/*3.*/ ? [a B1 part .^1: a ?x]

each B1  part: a B2;  //not also [B1 /^ A1, \. C1] since the query is about "a B1", not "B1"

/*4.*/ ?x [a B1 part .^1: ?x]

?x = a B2;  //with "a ?x" in the query, the answer would have been:  ?x = B2

/*5.*/ ? [a B1 part: a ^(?x /^ A1)]

[]  //since B2 is not subtype of A1 (it is B1 which is subtype of A1)

/*6.*/ ?x [a B1 part: ?x]

?x = a B2;  ?x = a B3;  ?x = a B4;  //since part is transitive

/*7.*/ ? [B1 pm#relation .^1: a ?x] //i.e.: ? [B1 pm#relation _[.->.] .^1: a ?x]

[] //for most inference engines, since "a ?x" specifies that "a" must be explicit in the
   //  searched graphs (+ note that the query is about the type B1, not about "a B1").
   //However, since A1 and B1 are (implicitly) of type Class (= Concept_type;
   //    so A1 and B1 both satisfy|match|specialize `a ?x´ with `?x = Class´) and
   //  since the inference engine is here assumed to know the semantics of pm#type,
   //  if the engine is good, it can infer that a solution for ?x is Class or, more precisely,
   //  ^(? instance: B1) and  ^(? instance: C1); hence, a good engine could answer: 
   //     B1  /^ A1,  \. C1;   pm#relation  \.  pm#type  pm#supertype;
   //  Note:  the above 2nd part is needed since 1) pm#relation is in the query graph,
   //  2) pm#type and pm#supertype relations are exploited for finding the above solution, and
   //  3) it is the KB which tells that pm#relation is supertype of pm#type and pm#supertype.

/*8.*/ ?x [B1 pm#relation .^1: ?x]

?x = A1;  ?x = C1;

/*9.*/ ? [B1 pm#relation .^1: ?x]

B1  /^ A1,  \. C1;   pm#relation \. pm#supertype;

/*10.*/ ? [every B1 pm#relation: a ?x]

[each B1  part: (a B2 part: (a B3 part: a B4))]; 
pm#relation \. (part pm#type: pm#transitive_relation_type);
//  pm#relation is in the query; transitivity needed.
//  Without  [part  pm#type: pm#transitive_relation_type]  in the KB,
//    the 1st line of the answer would have been:   [each B1  part: a B2];


Rappel (pour faciliter la compréhension des réponses ci-dessus) :  la BC [KB] ne contient que
   pm#relation  \.  (part  pm#type: pm#transitive_relation_type)  pm#type  pm#supertype
   B1  part _[each->a]: (B2 part _[each->a]: (B3 part _[each->a]: B4)),  /^ A1,  \. C1;

Exercices sur le langage générique pour rechercher des RCs

Si une BC ne contient que le graphe
[B1  part _[each->a ?b2]:  (B2  part _[?b2->a]:  (B3  pm#type: A3),  pm#type: A2)]
et que la sémantique de "part" est prédéfinie dans le moteur d'inférences utilisé,
quelles réponses ce moteur d'inférence doit retourner pour les 2 requêtes suivantes sur cette BC
(d'après la description donnée en cours pour le langage de requêtes utilisé ci-dessous) ?
Si le graphe entier est une réponse, vous pouvez utiliser [...] pour ne pas le ré-écrire entièrement.
Pour signaler qu'une requête n'a pas de réponse, utilisez [] (i.e. le graphe vide).

/*1:*/ ?s [a B1  part .^1: a ?x] <= ?s

?s = [B1  part _[each->a ?b2]:  B2]


/*2:*/ ? [a B1  part: (a ?x  pm#type: A2)]

[] /* Indeed, A2 is equivalent to the type Class (since B2 is a type and is
      instance of A2); hence, [B2  pm#type: A2] does not imply [each B1 part: a B2].
      The answer would have been  [B1  part _[each->a ?b2]:  (B2  pm#type: A2)]
      if i) the query had been  ? [a B1  part: a ^(?x  pm#type: A2)]
      or ii) there had been [a B2  pm#type: A2] instead of [B2  pm#type: A2].
    */