Your system sounds more like BNF (Backus-Naur Form) expression evaluator 
than a regular expression evaluator. Both are similar in that you can 
specify sequences of things (letters or words or symbols) to appear in 
certain orders and in certain quantities. Once a BNF or regex expression 
is parsed, it is usually represented internally as a decision tree (I once 
had to port a regex library from one language to another) so it sounds 
like you want to store that parsed structure in the database, thus saving 
the parsing step on repeat uses?

If you look at the source code for a BNF or regex evaluator (several are 
open sourced), you should get some excellent clues about how to structure 
each node (with one node = one row of data, a node's structure will 
closely resemble your table structure). Then after you add to each node 
the two or three extra fields you need for a modified preorder traversal 
data structure you should be very close to what you will need.

Sorry I can't be more specific but if you understand the needs of your 
sequence evaluator and you understand the theory of the MPT tables then 
you already have the pieces you need to get this working.

best of luck!

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Chris <[EMAIL PROTECTED]> wrote on 10/28/2004 02:04:34 PM:

> Heh, I don't think you're being dense. I can barely understand what I 
> meant. I'll try to clarify I bit more.
> 
> What I have is a sequence of entities (for this example the entities 
> will be letters).  I'm trying to use MySQL to hold the possible 
> combinations of entities.
> 
> The unique entities in a sequence always appear in the same order, but 
> they have different rules as to when they are allowed to be present.
> For example:
> 
> The poissble entities/order for this example is ABCDEF
> 
> 'A' must always begin the sequence, and can only occur once, 'B', if 
> present, must occur immediately after 'A' and be followed immediately by 

> 'C' and, finally, 'D', if present must come next, then be immediately 
> follwed by 'EF'.
> 
> The BC 'group' is allowed to be repeated indefinitely. So here are some 
> possible sequences:
> 
> A
> ABC
> ABCDEF
> ABCBCBCBCBCBC
> ABCBCDEF
> 
> And some illegal sequences
> 
> BC (A is not present)
> ADEFDEF (DEF isn't allowed to be repeated)
> ABCB (B muyst be followed by C, always)
> 
> So this isn't exactly a tree per se, but I am trying to put those 
> instructions in a database.
> 
> Here is how I think it would look in the DB, I'll use Perl Regex syntax 
> to show repetition
> 
> A{1}
> B{0,}
>    C{1}
> D{0,1}
>    E{1}
>    F{1}
> 
> Heh, I'm not sure if anyone will understand that, but I think it's a lot 

> clearer in my head now.
> 
> If you want any more clarification, I'd be glad to, though it seems like 

> I'm on the right track now.
> 
> Chris
> 
> [EMAIL PROTECTED] wrote:
> 
> >Maybe I am just being dense this morning but I am confused why you 
think 
> >that your nodes are different things depending on how many children 
they 
> >have (nodes, groups, entities, auuuugggghhh!)...
> >
> >If you have  two sets of hierarchies that share the same nodes, you may 

> >want to build two trees rather than trying to make one tree pull double 

> >duty. Keep each tree in their own table and reference a record or 
records 
> >in the Nodes table from each node in the tree. That way both trees have 

> >their own structure and you only have one copy of each node. Perhaps a 
> >"normal" tree and a "groups" tree. Do your groups even need a tree? 
Could 
> >it be a table of groups and a second table that relates nodes to 
groups? 
> >
> >Like I said, I could have really missed the point and if I did I humbly 

> >apologize.
> >
> >Shawn Green
> >Database Administrator
> >Unimin Corporation - Spruce Pine
> >
> > 
> >
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 

Reply via email to