[RuleML-all] Page-Level Validation
David Dossot
david at dossot.net
Wed Aug 8 15:29:54 ADT 2007
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"
> 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>
> _______________________________________________
> RuleML-all mailing list
> RuleML-all at ruleml.org
> http://mail.ruleml.org/mailman/listinfo/ruleml-all
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ruleml.org/pipermail/ruleml-all/attachments/20070808/26d47a87/attachment.htm
More information about the RuleML-all
mailing list