- From: Christian De Sainte Marie <csma@fr.ibm.com>
- Date: Tue, 2 Feb 2010 19:18:42 +0100
- To: Gary Hallmark <gary.hallmark@oracle.com>
- Cc: public-rif-wg@w3.org, public-rif-wg-request@w3.org
- Message-ID: <OFF441D48A.7520EFEA-ONC12576BE.0062DA4B-C12576BE.0064984A@fr.ibm.com>
Gary, Gary wrote on 02/02/2010 17:27:26: > > > The transformation that you propose does not work, since ?y will > > always be bound to 1 and ?z to B, whether the instance matched foo(1) > > or bar(B) (and, thus, the two different instances will always have the > > same bindings for all their universal variables). > > I don't understand. Surely if the only fact is foo(1), then ?y is bound > to 1 and ?z is unbound. Similarly, if the only fact is bar(B), then ?y > is unbound and ?z is bound to B... Unfortunately, that rule > > Rule: FORALL ?x, ?y, ?z, IF test(?x) AND ( ?y=1 AND foo(?y) OR ? > > z=B AND bar(?z) ) THEN... is unsafe (since ?y and ?z are not bound in every disjunct). The rule: FORALL ?x, ?y, ?z, IF test(?x) AND ?y=1 AND ?z=B AND (foo(?y) OR bar(?z)) is safe, but the binding of the universal variables does not discriminate the two instances :-( And I see no easy way to explain that ?y is not bound if the instance matches bar(?z); I mean, not easier than introducing the notion of matched facts, of something similar. If we do not want to add the dummy (disjunct counter) variable, we can explicitely "annotate" each rule instance with the disjunct it matches in the disjunctive normal form (as defined for the purpose of checking safeness); if the rule is not disjunctive, the disjunct if the condition itself. And two instances are equal only if they bind the universal variables to the same values, and if they matched the same disjunct. That would mimick the way it actually works in most engines (if not all): that is, disjunctive rules are really handled as one rule per disjunct, with all the same action part... Actually, I would prefer that: it requires a change in the definition of rule instance (esp. rule instances equality), but it is simpler (more intuitive) than adding the notion of matched facts, and it is less artificial than adding a fake universal variable just for differentiating the disjuncts... What do you think? Cheers, Christian IBM 9 rue de Verdun 94253 - Gentilly cedex - FRANCE Tel. +33 1 49 08 35 00 Fax +33 1 49 08 35 10 Sauf indication contraire ci-dessus:/ Unless stated otherwise above: Compagnie IBM France Siege Social : 17 avenue de l'Europe, 92275 Bois-Colombes Cedex RCS Nanterre 552 118 465 Forme Sociale : S.A.S. Capital Social : 611.451.766,20 ? SIREN/SIRET : 552 118 465 03644
Received on Tuesday, 2 February 2010 18:19:20 UTC