W3C home > Mailing lists > Public > public-rif-wg@w3.org > September 2008

Re: more about object creation (ACTION-554)

From: Christian de Sainte Marie <csma@ilog.fr>
Date: Tue, 09 Sep 2008 16:48:41 +0200
Message-ID: <48C68CC9.6020308@ilog.fr>
To: Gary Hallmark <gary.hallmark@oracle.com>
CC: rif WG <public-rif-wg@w3.org>

</Chair>
Gary,

like Patrick (and probably for the same reasons :-), I prefer option A.

Gary Hallmark wrote:
> 
> Option A. 'new' [Var '#'] CLASS '[' (TERM '->' TERM)* ']'
> 
> e.g.
> Forall ?x ?z (Do(new ?z # _Z[_x->?x] new _Y[_z->?z]) :- ?x # _X)
> 
> The Var ?z must be declared somewhere, presumably in the enclosing 
> Forall.  What happens if the Var is also referenced in the rule condition?

However, I would prefer if we introduced a specific construct, modeled on the quantifiers, to identify local (or convenience) bindings. E.g. something like:

   Bind ::= 'Bind' Var Pattern (Formula)

allowing to write rules like (informally)

Forall ?employee (?employee # ex:Employee)
If (
    Bind ?salary (?employee[salary->?salary)
    And (?employee[name->"csma"] fun:numeric-less-than(?salary, 200,000))
    )
Then
   Bind ?salary (?employee[salary->?salary)
   Do(?employee[salary->fun:numeric-multiply(?salary, 1.1)])
  

(in which case the semantics I proposed for the "no-repeat" resolution strategy would work, because the repetition would be checked only wrt the binding of the "rule" variable ?employee).

Wrt the "New" construct, if the newly created object needs be reused in the action part of the same rule, it would be enclosed as the pattern in a Bind, and, if not, it would just be another action. Like (to use Gary's example):
   
Forall ?x (Bind ?z (new _Z[_x->?x]) Do(new _Y[_z->?z])) :- ?x # _X
                   |bind'g pattern|
                   |   for ?z     |
                                    |<- scope of ?z ->|
          |<------------------- scope of ?x --------------------->|

Christian
<Chair>
Received on Tuesday, 9 September 2008 14:50:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 18:33:54 GMT