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

Re: [TED] Worked Examples of Use Cases Updated According to RIF Core WD1

From: Adrian Giurca <giurca@tu-cottbus.de>
Date: Tue, 22 May 2007 10:21:57 +0200
Message-ID: <4652A825.4050709@tu-cottbus.de>
To: "Boley, Harold" <Harold.Boley@nrc-cnrc.gc.ca>
CC: RIF WG <public-rif-wg@w3.org>

I don't understand the reasons why the final translation is a RDF 
document. I guess some explanations are desirable. Indeed JenaRules use 
RDF(S) as a vocabulary language. Is this the intention of RIF?

1. First I guess that properties like "hasNIC" or "hasIP" must be  "NIC" 
or "IP". If they are named "hasNIC"  then this denotes a boolean 
property which is not the case here. 
I propose the following markup for rule 1 in  source rules 
<http://www.w3.org/2005/rules/wg/wiki/UC8_Worked_Example#head-31e6e6f127874865b611fa0516c76e96fb9abcc1>

<rif:Rule rif:id="r1-computeNodeToServer">
<rif:If>
 <rif:And>
<!-- (?x rdf:type it:ComputeNode) -->
 <rif:Uniterm>
  <rif:Predicate rif:id="it:ComputeNode"/>
  <rif:Var rif:name="?x"/>
 </rif:Uniterm>
 <!-- (?x it:hasNIC ?i)  -->
 <rif:Uniterm>
  <rif:Predicate rif:id="it:NIC"/>
   <rif:Var rif:name="?x"/>
   <rif:Var rif:name="?i"/>
 </rif:Uniterm>
 <!-- (?i it:hasIP ?p) -->
  <rif:Uniterm>
  <rif:Predicate rif:id="it:IP"/>
   <rif:Var rif:name="?i"/>
   <rif:Var rif:name="?p"/>
 </rif:Uniterm>
 </rif:And>
  </rif:If>
  <rif:Then>
   <rif:And>
    <!-- (?x rdf:type t:Server) -->
     <rif:Uniterm>
  <rif:Predicate rif:id="t:Server"/>
  <rif:Var rif:name="?x"/>
 </rif:Uniterm>
    <!--(?x t:address ?p) -->
  <rif:Uniterm>
  <rif:Predicate rif:id="t:address"/>
   <rif:Var rif:name="?x"/>
   <rif:Var rif:name="?p"/>
 </rif:Uniterm>
   </rif:And>
   </rif:Then>
</rif:Rule>

3. In rule R3 discussing blanc nodes I don't see why the rule is not 
written as:

[r3-applicationHost:
     (?a rdf:type bp:Application) 
     (?a bp:discoveredAtIP ?p)
     (?n rdf:type t:Server)
    ->
     (?n t:address ?p)  (?n t:hosts ?a)]

Why we need the blank node here?

4. About built-ins:
In rule r4-discount I guess that, according with Jena Rules syntax , we 
have product(?c, '0.75', ?cd) or  product(?c, '0.75'^^xs:float, ?cd). In 
the second case the markup may be:

  <rif:Uniterm>
 <!-- if we allow RIF built-ins -->
  <rif:Predicate rif:id="rif:product"/>
   <rif:Var rif:name="?c"/>
   <rif:Const rif:type="xs:float">0.75</rif:Const>
   <rif:Var rif:name="?cd"/>
 </rif:Uniterm>

5. the triple (?a ?P ?subApp)  may be represented as:

  <rif:Uniterm>
   <rif:Var rif:name="?P"/>
   <rif:Var rif:name="?a"/>
   <rif:Var rif:name="?subApp"/>
 </rif:Uniterm>

while (?P rdfs:subPropertyOf bp:comprises) may be:

  <rif:Uniterm>
  <rif:Predicate rif:id="rdfs:subPropertyOf"/>
   <rif:Var rif:name="?P"/>
   <rif:Predicate rif:id="bp:comprises"/>
 </rif:Uniterm>

For example you can move the rule 1 from Jena to JBossRules (using RIF ) as:

package jenaRules
     // carefully to transforming URI in Java path expressions. Not all 
the time possible
   import com.hp.hp1.jena.rifUC08.ITDatabase.ComputeNode;
   import com.hp.hp1.jena.rifUC08.target.Server;

   rule "r1-computeNodeToServer"
    when
     //(?x rdf:type it:ComputeNode)  (?x it:NIC ?i) (?i it:IP ?p) 
translates to the following column
     $x: ComputeNode( $i: nic -> ($p: $i.ip() ) ) 
    then
     // (?x rdf:type t:Server)
     $x = (Server)$x;
     // (?x t:address ?p)
     $x.setAddress($p);
   // update the working memory
     modify( $x);
   end


We have a running use case (UServ Product Derby 2005 Use Case 
<http://www.businessrulesforum.com/2005_Product_Derby.pdf>) with 
JenaRules and JBoss Rules (using R2ML) at:
http://oxygen.informatik.tu-cottbus.de/rewerse-i1/?q=node/33

The Jena Rules  application is: 
http://oxygen.informatik.tu-cottbus.de/userv/jsp/jena/index.jsp

At the end of insurance calculation you can see rules that were applies, 
RDF data and so on.


Regards,
Adrian

Boley, Harold wrote:
> I've updated the Worked Examples of the Use Cases available at
> <http://www.w3.org/2005/rules/wg/wiki/D._Evaluation%3A_Use_Cases>
> according to RIF Core WD1 (UC6 Worked Example not yet available).
>
> -- Harold
>
>   


-- 
Dr. Adrian Giurca
http://www.informatik.tu-cottbus.de/~agiurca/
Received on Tuesday, 22 May 2007 08:22:12 GMT

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