All this talk of parent and child nodes makes me wonder if my
SQLAlchemy-based persistence add-on (pNetworkX) to the NetworkX graph
package might be of interest. You could use pNetworkX with your chosen
database to maintain a directed graph that represents the parent-child
relationships between your XML nodes, and use a separate table to
contain per-node attributes.

http://foss.eepatents.com/pNetworkX/

Best regards,
Ed Suominen

Luís Bruno wrote:
> Florian Boesch wrote:
>> Table('children', engine,
>> Column('children_id', Integer, Sequence('children_seq'),
>>     primary_key=True),
>> Column('tag_node_id', Integer, ForeignKey('tag_node.id'),
>>     nullable=False),
>> Column('node_id', Integer, ForeignKey('node.id'), nullable=False),
>> Column('ordering', Integer, nullable=False),
>> )
> 
> I'd prefer to have a list of parent nodes; one of the properties of
> these trees is that each node has one parent only (except root, which
> has none):
> 
> CREATE TABLE parents (
>     node_id   INTEGER NOT NULL REFERENCES node(id),
>     parent_id INTEGER NOT NULL REFERENCES node(id),
>     ordering  INTEGER NOT NULL,
>     
>     PRIMARY KEY (node_id, parent_id),
>     UNIQUE (node_id, ordering) -- probably screwed the syntax here
> );
> 
> This way, you can select all of a node's children (by checking if it's
> referenced in the parent_id column) or select all parents (by getting
> the list of parent's for a node).
> 
> Thank you once again Mike, for providing that article; I still can't
> wrap my brain around it properly, but this model seems quite nice.
> 


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to