Re: [RIF] homework for 10/17 telecon

Dear all,

Francis McCabe wrote:

>
> Gerd:
>  Looking at the example XML encoding, I would predict that you would  
> have some trouble representing generic or polymorphically typed  
> entities.
>  Can you show how you would encode:
>
>  concat:[list[t],list[t]]=>list[t].
>  concat([],L)=>L.
>  concat([E,..L],M)=>[E,..concat(L,M)].
>
> (This is a function, but cold easily be expressed using predications.)
> Frank
>
The standard append Prolog predicate is expressed by two derivation rules.

 append([],L,L).

append([X|L1],L2,[X|L12])  :- append(L1,L2,L12). 

We need just a built-in function i.e. the list constructor and a 
GenericEntityName i.e. the empty list.
In R2ML this it will be:

<r2ml:DerivationRuleSet>

 <r2ml:DerivationRule>

<r2ml:Documentation>

  <r2ml:SourceCode>

 append([],L,L).

 </r2ml:SourceCode>  

  </r2ml:Documentation>

  <r2ml:conclusion>

    <r2ml:GenericAtom r2ml:predicateID="append">

     <r2ml:arguments>

       <r2ml:GenericEntityName r2ml:genericEntityID="ns:emptyList"/>

       <r2ml:GenericVariable r2ml:name="L"/>

       <r2ml:GenericVariable r2ml:name="L"/>

     </r2ml:arguments>

    </r2ml:GenericAtom>

  </r2ml:conclusion>

 </r2ml:DerivationRule>

  <r2ml:DerivationRule>

  <r2ml:Documentation>

 <r2ml:SourceCode>

   append([X|L1],L2,[X|L12]):- append(L1,L2,L12). 

 </r2ml:SourceCode>  

  </r2ml:Documentation>

   <r2ml:conditions>

    <r2ml:GenericAtom r2ml:predicateID="append">

     <r2ml:arguments>

       <r2ml:GenericVariable r2ml:name="L1"/>

       <r2ml:GenericVariable r2ml:name="L2"/>

       <r2ml:GenericVariable r2ml:name="L12"/>

     </r2ml:arguments>

    </r2ml:GenericAtom>

   </r2ml:conditions>

   <r2ml:conclusion>

     <r2ml:GenericAtom r2ml:predicateID="append">

      <r2ml:arguments>

        <r2ml:GenericFunctionTerm r2ml:genericFunctionID="ns:list_constructor">

         <r2ml:arguments>

            <r2ml:GenericVariable r2ml:name="H"/>

            <r2ml:GenericVariable r2ml:name="L1"/>         

         </r2ml:arguments>

        </r2ml:GenericFunctionTerm>      

        <r2ml:GenericVariable r2ml:name="L2"/> 

        <r2ml:GenericFunctionTerm r2ml:genericFunctionID="ns:list_constructor">   

        <r2ml:arguments>

        <r2ml:GenericVariable r2ml:name="H"/>

            <r2ml:GenericVariable r2ml:name="L12"/>         

         </r2ml:arguments>

        </r2ml:GenericFunctionTerm>      

      </r2ml:arguments>

     </r2ml:GenericAtom>

   </r2ml:conclusion>

  </r2ml:DerivationRule>

 </r2ml:DerivationRuleSet>

-Adrian Giurca

>
> On Oct 17, 2006, at 6:20 AM, Gerd Wagner wrote:
>
>>> We expect to plan the bulk of the next telecon discussing the  
>>> technical
>>> proposal [http://www.w3.org/2005/rules/wg/wiki/CORE], especially the
>>> syntax.
>>
>>
>> Here is a proposal how to extend it in order to accommodate typing.
>>
>> -Gerd
>> <REWERSE RIF Condition Language Extension Proposal.html>
>
>
>

Received on Tuesday, 17 October 2006 14:24:30 UTC