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

more about object creation (ACTION-554)

From: Gary Hallmark <gary.hallmark@oracle.com>
Date: Tue, 02 Sep 2008 14:35:51 -0700
Message-ID: <48BDB1B7.1020008@oracle.com>
To: rif WG <public-rif-wg@w3.org>

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, 2 September 2008 21:37:19 GMT

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