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

Re: more about object creation (ACTION-554)

From: Gary Hallmark <gary.hallmark@oracle.com>
Date: Mon, 08 Sep 2008 23:47:05 -0700
Message-ID: <48C61BE9.6020903@oracle.com>
To: Patrick Albert <palbert@ilog.fr>
CC: rif WG <public-rif-wg@w3.org>

Patrick Albert wrote:
> I like option A, because it is simple, and object creation in PRD has to
> be very simple.
>
> Two complementary remarks. 
>
> 1/ The variable that can be bound to the newly created object might not
> need t be declared. It's name and it's type -- the class of the new
> object -- suffice for the declaration.
>   
that's true of all the Forall variables.  We agreed we'd declare every 
variable, so it's a matter of
i. declare in the top-level Forall
ii. declare in an Exists in the conclusion (not legal in BLD, but is 
legal in FLD)
iii. introduce something PRD-specific, e.g. "Let"

Do(Let ?oid (new ?oid # SomeClass [ slot1 -> "init-val 1" ])) :- 1=1
> 2/ I don not understand why the initialization of the object is
> described as '[' (TERM '->' TERM)* ']', I would replace  by '['
> (SLOT-NAME '->' TERM)* ']'
>
>   
It allows the possibility of invoking a constructor.  Maybe :-)
>  Patrick. 
>
>
> -----Original Message-----
> From: public-rif-wg-request@w3.org [mailto:public-rif-wg-request@w3.org]
> On Behalf Of Gary Hallmark
> Sent: mardi 2 septembre 2008 23:36
> To: rif WG
> Subject: more about object creation (ACTION-554)
>
>
> At today's telecon we discussed object creation.  Christian and Patrick 
> wonder how one obtains a reference to the new object.  I.e. how to 
> support the following use case (expressed in FLD):
>
> Forall ?x (Exists ?y ?z And(?y # _Y ?z # _Z ?y[_z->?z] ?z[_x->?x]) :- ?x
>
> # _X)
>
> The proposed syntax
>
> 'new' CLASS '[' (TERM '->' TERM)* ']'
>
> provides no good way to do this.  I see several options:
>
> 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?
>
> Option B. Use the FLD syntax for PRD.  The concern is that this is 
> overly general and thus PRD would have many hard to specify restrictions
>
> on the use of Exists in a conclusion.
>
> Option C. use a builtin (e.g. rif:new) so that object creation could be 
> in core.  E.g.
>
> Forall ?x (And(rif:new(1 ?x) # _Z rif:new(1 ?x)[_x->?x] rif:new(2 ?x) # 
> _Y rif:new(2 ?x)[_z->rif:new(1 ?x]) :- ?x # _X)
>
> There are n+1 arguments to rif:new.  The n Forall variables and one 
> "occurrence number".  There are m distinct occurrence numbers per 
> ruleset, where m is the number of existential variables in the ruleset 
> that are "skolemized".  In the above, n=1 and m=2.  Note that rif:new 
> has variable arity (n+1).
>
> The drawback of option C is that production rule engines don't typically
>
> provide rif:new as a function.  A PRD translator would find it very 
> difficult to translate rif:new in a condition, or indeed in an action 
> except for when used in membership with a Class Constant and in frames.
>
> Also, PRD would need to support And() and "#" in conclusions, but "#" 
> only in the case where the left side is rif:new...
>
>   
Received on Tuesday, 9 September 2008 06:47:56 GMT

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