[RuleML-all] Page-Level Validation

Colnaghi Junior, Roberto (R&D Brazil) roberto.junior at hp.com
Wed Aug 8 11:30:45 ADT 2007


Hi there,

Does anyone use RuleML to do page level validation like required fields,
regex compliance, range validation, etc. ? Is it recommended (or even
viable)?


I'm trying to figure out how to explain through ruleml (using NxBRE) the
following:

E-mail Address:  simple regex, like (w+@[w+\.]+w+)
 
Display Name:  required field, can not be blank/null
 
Subject: max lenght of 255 chars
 
Message: max length of 4000 chars


I guess a binder would do this, but I'm not sure about how to express
the implications and facts in a reasonable manner.

Any help or tip would be great.
Thanks!



<?xml version="1.0" encoding="utf-8"?> 
<RuleML xmlns="http://www.ruleml.org/0.9/xsd"
xsi:schemaLocation="http://www.ruleml.org/0.9/xsd
ruleml-0_9-nafdatalog.xsd "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <oid>
   <Ind>E-mail Settings KB</Ind>
 </oid>
 <Assert>
   <!--  Implication: E-mail field is valid if complying with regex -->
   <Implies>
     <head>
       <Atom>
         <Rel>Valid</Rel>
         <Var>Setting</Var>
       </Atom>
     </head>
     <body>
       <Atom>
         <Rel>Email</Rel>
         <Var>Setting</Var>
         <Ind uri="nxbre://binder">regex(w+@[w+\.]+w+)</Ind>
       </Atom> 
     </body>
   </Implies>
   <!--  E-mail field on page is doingTests at ruleml.org -->
   <Atom>
     <Rel>Email</Rel>
     <Ind>PageSetting01</Ind>
     <Ind>doingTests at ruleml.org</Ind>
   </Atom> 
 </Assert>
 <!--  Query: Find out all (non) valid settings -->
 <Query>
   <oid>
     <Ind>Invalid Settings</Ind>
   </oid>
   <Atom>
     <Rel>!valid</Rel> ???how to express negation?
     <Var>Setting</Var>
   </Atom>
 </Query>
</RuleML>


More information about the RuleML-all mailing list