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