design a database to store an expression tree [modified]
-
Hi, I need some help with the database design for storing an expression tree. It should basically store a whole expression. I'd want to query out data (in one or more result sets as necessary) so that I can finally evaluate it somehow in my front-end application. Just kind of need a table(s) structure to store and represent the relationship. The expressions I plan to store in the database will be mostly logical expressions. Meaning they'd evaluate to a true or false mostly. Here is a diagrammatic representation of what I want (as a result set(s)).
modified on Thursday, March 4, 2010 8:31 AM
-
Hi, I need some help with the database design for storing an expression tree. It should basically store a whole expression. I'd want to query out data (in one or more result sets as necessary) so that I can finally evaluate it somehow in my front-end application. Just kind of need a table(s) structure to store and represent the relationship. The expressions I plan to store in the database will be mostly logical expressions. Meaning they'd evaluate to a true or false mostly. Here is a diagrammatic representation of what I want (as a result set(s)).
modified on Thursday, March 4, 2010 8:31 AM
Hi, I often use trees and what you essentially needs is the ID and Parent ID for example: ID | ParentID | Name 1 | 0 | A 2 | 1 | AA 3 | 1 | AB 4 | 0 | B 5 | 4 | BA 6 | 4 | BB looks like: [] | -A --AA --AB -B --BA --BB and so on... ... I hope you mean this :doh: