W3C home > Mailing lists > Public > public-rif-wg@w3.org > June 2007

Re: [TED] ACTION-294: Propose a treatment of sequences

From: Dave Reynolds <der@hplb.hpl.hp.com>
Date: Wed, 13 Jun 2007 16:20:51 +0100
Message-ID: <46700B53.4080201@hplb.hpl.hp.com>
To: "Boley, Harold" <Harold.Boley@nrc-cnrc.gc.ca>
CC: RIF WG <public-rif-wg@w3.org>

Given that the proposed mapping of RDF to RIF will map the triple 
(s,p,o) to the Frame s[p->o], then RDF lists will end up as nested RIF 
Frame structures:

   _:1[rdf:first->a, rdf:rest->
       _:2[rdf:first->Y, rdf:rest->
           _:3[rdf:first->c, rdf:rest->rdf:nil]]]

rather than nested function symbols.

It would convenient if the RIF list builtins worked on RDF lists.

Possibilities include:

(1) Use nested-frame rather than nested-pair representation for lists (I 
suspect this is too ugly to be acceptable but thought I'd mention it).

(2) Include in the RIF-specified RDF mapping a transformation so that 
RDF lists map to RIF lists.

(3) Let individual applications include mapping rules which explicitly 
map the nested-frame structures to RIF lists and say nothing about RDF 
lists in the spec.

I'm not sure I like any of these and so don't have a specific proposal 
at this stage. I'm just mentioning it in case anyone has another take on 
this issue.

Dave
-- 
Hewlett-Packard Limited
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England


Boley, Harold wrote:
> This is about my ACTION-294: Actually, two proposals for treating
> sequences.
> 
> In the EBNF of
> http://www.w3.org/2005/rules/wg/wiki/Core/Positive_Conditions
> 
> Uniterm ::= Const '(' TERM* ')'
> 
> could be used to represent Lisp's dotted pairs (head . tail) and
> Prolog's lists
> [head | tail] by employing a distinguished binary function symbol, say
> Pair, and
> a distinguished constant symbol, say Nil, so the Prolog list [a,Y,c]
> would become
> the Pair nesting
> 
> <Pair>
>   <Const>a</Const>
>   <Pair>
>     <Var>Y</Var>
>     <Pair>
>       <Const>c</Const>
>       Nil
>     </Pair>
>   </Pair>
> </Pair>
> 
> Besides dealing with these two distinguished symbols, nothing else would
> need
> to be changed (especially, in the semantics).
> 
> Alternatively, n-ary sequences could be directly represented via an
> n-ary list constructor, so Prolog's [a,Y,c] would remain a flat
> 
> <List>
>   <Const>a</Const>
>   <Var>Y</Var>
>   <Const>c</Const>
> </List>
> 
> For this, TERMs, currently defined as
> 
> TERM ::= Const | Var | Uniterm
> 
> could be extended to
> 
> TERM ::= Const | Var | Uniterm | LIST
> 
> with
> 
> LIST ::= 'List' '(' TERM* ')'
> 
> The latter EBNF rule is structurally identical to, e.g.,
> CONJUNCTION ::= 'And' '(' CONDITION* ')'.
> 
> To accommodate a Prolog-like vertical bar, "|", in Lists, we could allow
> a single optional rest element somehow like this:
> 
> LIST ::= 'List' '(' TERM* [rest] ')'  % OK if nothing to the left of "|"
> rest ::= TERM   % normally TERM is just a Var
> 
> Such a <rest> element can be used to express the human-readable
> syntactic equality [?head | ?tail] = [a ?Y c]:
> 
> <List>
>   <Var>head</Var>
>   <rest><Var>tail</Var></rest>
> </List>
> 
> unifies with
> 
> <List>
>   <Const>a</Const>
>   <Var>Y</Var>
>   <Const>c</Const>
> </List>
> 
> by binding
> 
> <Var>head</Var> to <Const>a</Const>
> 
> and
> 
> <Var>tail</Var> to <List><Var>Y</Var><Const>c</Const></List>
> 
> Nested Prolog Lists such as [a,[X,b],c] are allowed:
> 
> <List>
>   <Const>a</Const>
>   <List>
>     <Var>X</Var>
>     <Const>b</Const>
>   </List>
>   <Const>c</Const>
> </List>
> 
> This n-ary List notation can be regarded as syntactic sugar for
> the above Pair notation by statically rewriting each List to a Pair
> nesting, as suggested by the [a,Y,c] examples. So, besides the
> resulting distinguished Pair and Nil symbols, the semantics could
> again be kept unchanged.
> 
> -- Harold
> 
> 
Received on Wednesday, 13 June 2007 15:21:22 GMT

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