Rules in a database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I work in tax and thus have to read legislation - some complex - and I
wanted to store some of the logic in a database so that if I know certain
conditions were true I could look up what results this might have.

Thus I am thinking of having two tables - one of phrases and the other of
how these phrases are linked together as rules.  A rule structure could be:

IF A THEN B
IF A OR A1 OR A2 THEN B
IF A THEN B AND C

I was wondering how to do this.  For instance, each rule could be one record
in the table.  The rules table has fields, IF and THEN. The ID field is the
rule ID.  Assume the phrases are numbered.  One IF record could say:
+/12/41/31/+/90/ meaning if phrases 12, 41 or 31 are true and phrase 90 is
true.  Then if I have a real situation where condition 12 is true, for
instance, I can find it and access it using sub string functions. Does this
scheme seem OK?  Has anyone done anything like this before?

Regards,

John

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux