Database schema for storing rules?

103 views
Skip to first unread message

Brian G

unread,
Feb 19, 2008, 3:54:04 PM2/19/08
to Validat
Jeff,

In your blog series on the alagad site, you refer to storing rules in
the database as opposed to XML. I was wondering if you had a sample
schema you might share here to help jumpstart something I'm working
on?

It looks like a table for rulesets, a table for rules and messages, a
table for rule arguments, a way to relate rule types to CFCs (could be
code or config). Am I missing anything?

I am working on a custom form builder where the user can take a number
of widget-types and put them on the form and then validate them in any
way desired. I'm looking for Validat to be the validation piece of my
puzzle here.

Thanks!


Brian

Jeff Chastain

unread,
Feb 19, 2008, 9:01:33 PM2/19/08
to val...@googlegroups.com
Brian,

I have not implemented this as a database schema at this point, however
doing so should not be hard. Validat is setup to either take an XML
configuration file, or use its programmatic API for configuration. So, it
you use the programmatic API, you could really store the rules etc. any way
that you want. There are some obvious relations already ... data sets have
data elements, which have assertions ... but even then, there is no hard and
fast rule that they need to be stored in a database that way.

Point being, you can use the API however you like. Most of the time I have
started with at least a basic XML config ... maybe just containing all of
the basic rules ... and then use the API to programmatically add and remove
elements and assertions.

Hopefully that helps a little bit.

-- Jeff

Jeff Chastain
Senior Software Architect

Alagad, Inc.
www.alagad.com

Brian G

unread,
Feb 21, 2008, 3:10:26 PM2/21/08
to Validat

On Feb 19, 6:01 pm, "Jeff Chastain" <jchast...@alagad.com> wrote:
> that you want. There are some obvious relations already ... data sets have
> data elements, which have assertions ... but even then, there is no hard and
> fast rule that they need to be stored in a database that way.

Thanks Jeff. Out of curiosity, can a dataElement have 0 assertions if
you only want to "require" it?


Brian

Jeff Chastain

unread,
Feb 21, 2008, 3:20:38 PM2/21/08
to val...@googlegroups.com
Brian,

Assertions are only required for a data element if you want to check the
contents of that data element. If you just want to verify that it contains
something, then using the required argument of the dataElement tag, plus the
message argument will be good enough without any assertions.

Thanks
-- Jeff

Jeff Chastain
Senior Software Architect


Alagad, Inc.
www.alagad.com


-----Original Message-----
From: val...@googlegroups.com [mailto:val...@googlegroups.com] On Behalf
Of Brian G
Sent: Thursday, February 21, 2008 2:10 PM
To: Validat

Reply all
Reply to author
Forward
0 new messages