[RuleML-all] Page-Level Validation

Colnaghi Junior, Roberto (R&D Brazil) roberto.junior at hp.com
Fri Aug 10 11:30:27 ADT 2007


Hello David,
 
So, the ruleml file should turn into something like this >>
 
* But where will the "Valid" deduction be made here? I feel like I'm
missing this part.
* Also, how can I add the other page fields (defaultSubject,
defaultMessage,...)? I need to duplicate the <Implies> section for each
one?


 

<?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>SMTP Settings KB</Ind>
  </oid>
  <Assert>
    <!--  Implication: E-mail field is valid if complying with regex -->
    <Implies>
      <head>
        <Atom>
          <Rel>Setting</Rel>
          <Var>Name</Var>
          <Var>Value</Var>
        </Atom>
      </head>
      <body>
        <Atom>
          <Rel>Name</Rel>
          <Var>DefaultEmailAddress</Var>
          <Ind uri="nxbre://binder">regex(w+@[w+\.]+w+)</Ind>
        </Atom>
      </body>
    </Implies>
  </Assert>
  <!--  Query: Find out all (non) valid settings -->
  <Query>
    <oid>
      <Ind>Invalid Settings</Ind>
    </oid>
    <And>
      <Atom>
        <Rel>Setting</Rel>
        <Var>Name</Var>
        <Var>Value</Var>
      </Atom>
      <Naf>
        <Atom>
          <Rel>Valid</Rel>
          <Var>Name</Var>
        </Atom>
      </Naf>
    </And>
  </Query>
</RuleML>



 

________________________________

From: ddossot at gmail.com [mailto:ddossot at gmail.com] On Behalf Of David
Dossot
Sent: Wednesday, August 08, 2007 6:30 PM
To: Colnaghi Junior, Roberto (R&D Brazil)
Cc: ruleml-all at ruleml.org
Subject: Re: [RuleML-all] Page-Level Validation


Hi Roberto,

Conceptually, validation rules are as good candidates as any other
business rules. The viability of the solution might in fact be
determined by the expected performance of the resulting application and
how it is impacted by the particular engine implementation you intend to
use. 

Concerning your query question, you can look for settings facts that
have no valid facts associated: that would give you the invalid ones.
For this, I would refactor the setting fact like this:

      <Atom> 
        <Rel>Setting</Rel>
        <Var>Name</Var>
        <Var>Value</Var>

      </Atom>

and will query the invalid ones like that: 

<Query>
   <oid>
     <Ind>Invalid Settings</Ind>
   </oid>
   <And>
      <Atom>
        <Rel>Setting</Rel>
        <Var>Name</Var>
        <Var>Value</Var>

      </Atom>
      <Naf>

        <Atom>
          <Rel>Valid</Rel>
          <Var>Name</Var>
        </Atom>
      </Naf>
   </And>
</Query>



On 8/8/07, Colnaghi Junior, Roberto (R&D Brazil) <roberto.junior at hp.com>
wrote: 

	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
<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
<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>
	_______________________________________________
	RuleML-all mailing list
	RuleML-all at ruleml.org
	http://mail.ruleml.org/mailman/listinfo/ruleml-all
	




More information about the RuleML-all mailing list