PRD - errors in presentation syntax example

RIF PRD Recommendation 22 June 2010

There are several errors in the presentation syntax of the ‘running example’ given in Example 9.1.   I have described these in the attached  document together with some additional minor issues concerning the grammar.

Here is a corrected version that parses successfully according to the EBNF productions provided in the specification.

Document(

Prefix( ex1 <http://example.com/2009/prd2> )

(* ex1:CheckoutRuleset *)
Group rif:forwardChaining (
   (* ex1:GoldRule *)
   Group 10 (
     Forall ?customer such that And(?customer # ex1:Customer
                                    ?customer[ex1:status->"Silver"])
       (Forall ?shoppingCart such that ?customer[ex1:shoppingCart->?shoppingCart]
          (If Exists ?value (And(?shoppingCart[ex1:value->?value]
                                 External(pred:numeric-greater-than-or-equal(?value 2000))))
           Then Do(Modify(?customer[ex1:status->"Gold"])))))

   (* ex1:DiscountRule *)
   Group (
     Forall ?customer such that And(?customer # ex1:Customer )
       (If Or( ?customer[ex1:status->"Silver"]
               ?customer[ex1:status->"Gold"])
        Then Do ((?s ?customer[ex1:shoppingCart-> ?s])
                 (?v ?s[ex1:value->?v])
                 Modify(?s [ex1:value->External(func:numeric-multiply (?v 0.95))]))))

   (* ex1:NewCustomerAndWidgetRule *)
   Group (
     Forall ?customer such that And(?customer # ex1:Customer
                                     ?customer[ex1:status->"New"] )
       (If Exists ?shoppingCart ?item
                  (And(?customer[ex1:shoppingCart->?shoppingCart]
                       ?shoppingCart[ex1:containsItem->?item]
                       ?item # ex1:Widget ) )
        Then Do( (?s ?customer[ex1:shoppingCart->?s])
                 (?val ?s[ex1:value->?val])
                 (?voucher ?customer[ex1:voucher->?voucher])
                 Retract(?customer[ex1:voucher->?voucher])
                 Retract(?voucher)
                 Modify(?s[ex1:value->External(func:numeric-multiply(?val 0.90))]))))

   (* ex1:UnknownStatusRule *)
   Group (
     Forall ?customer such that ?customer # ex1:Customer
       (If Not(Exists ?status
                      (And(?customer[ex1:status->?status]
                           External(pred:list-contains(List("New" "Bronze" "Silver" "Gold") ?status)) )))
        Then Do( Execute(act:print(External(func:concat("New customer: " ?customer))))
                 Assert(?customer[ex1:status->"New"]))))
  )
)


Regards

Charles
Charles Young
Principal Consultant

Solidsoft: People ▪ Processes ▪ Systems ■ Connected
[cid:image001.jpg@01CBA90A.00B96BF0]
Microsoft's Global Partner of the Year Finalist 2010 : Custom Development Solutions
Microsoft's Global Partner of the Year Finalist 2008/9 : Business Process and Integration
Microsoft's Global Partner of the Year Winner 2006/7 : Business Process and Integration
• Office

+44 (0) 1256 375 700

• Mobile

+44 (0) 7817 678 783

• Fax

+44 (0) 1256 476 361

•     Web Site

http://www.solidsoft.com<blocked::http://www.solidsoft.com/>

• Registered Office

Grove House, Lutyens Close, Chineham Court, Basingtoke, RG24 8AG

• Registration No

Registered in England Number 2853022

Received on Saturday, 1 January 2011 17:55:30 UTC