How can I store logical expressions using a RDBMS?
I tag objects and would like to be able to build truth statements based on those tags. (These might be considered as virtual tags.)
Tags
new
for_sale
used
offer
Rule
second_hand_goods = (!new or used) and for_sale
new_offer = new and offer
second_hand_offer = second_hand_goods and offer
- Rules should be able to reference both tags and other rules.
- Schemas that can be easily accessed by hibernate would be preferrable.
- Preferably it will be possible to retrieve the entire rule in one select/call?
How do you guys store expressions and business rules in your databases?
Thanks in advance.
Update
To be clear, the rules are not for use internally by the database but created and used by an external application that needs to persist these tags and rules. Thanks.