xml spy
Previous  Top  Next

Components and table relationships


Table relationships are easily recognized in the database component. The database component displays each table of a database, as a "root" table with all other related tables beneath it in a tree view.

 

db-tree1

 

Let us call the table names visible in the above diagram "root" tables, i.e. they are the top level, or root of the tree view. Expanding a table name displays all the tables related to it. The "root" tables are usually displayed in alphabetical sort order; this has no bearing on the actual table relationships however.

 

When creating queries/mappings of databases with relations, including flat format SQL/XML databases, make sure that you create mappings between tables that appear under one of the "root" tables, if you want the table relationships to be maintained i.e. when creating queries that make use of joins.

 

The graphic below, shows the expanded Office "root" table of the Altova database. The arrows to the left of the expand/contract icons of each table name, as well as the indentation lines, show the table relationships.

 

Starting from the Office table and going down the tree view:

 

Arrow left, denotes a child table of the table above, Address is a child table of Office.

 

Department is also a child of Office, as well as a "sibling" table of Address, both have the same indentation line. Person is also a child table of Department.

 

Arrow right, denotes a parent of the table above, Altova is the parent of the Office table.

 

       tbl-relations

 

Which "root" tables should I use when I am mapping data?

When creating mappings to database tables, make sure you create mappings using the specific "root" table as the top level table.

 

E.g.

suppose you only want to insert or update Person table data. You should then create mappings using the Person table as the "root" table, and create mappings between the source and target items of the Person fields you want to update.

 

If you want to update Department and Person data, while retaining database relationships between them, use the Department table as the "root" table, and create mappings between the source and target items of both tables.


Previous  Top  Next

© 2008 Altova