About Data Trees

Data Trees are the way that Instant JChem organises data into a master detail arrangement so that it can be displayed in a View. The View needs to know when data (e.g. you run a query or change the sort directives) or a selection from that data changes (e.g. you move to a new record in the form or select a row in a table) so that the related data can be updated. The Data Tree provides this hierarchical arrangement of data and allows the view to know how all the data is related.

A Data Tree is a tree like structure with Entities as the vertexes and Relationships as the edges of the tree. As such it can easily be displayed and understood by a user. The underlying arrangement in the database can be much more complex, but the purpose of the DataTree is to provide a particular simplified perspective on the data. Multiple perspectives can be provided by creating multiple Data Trees. For instance, in a chemical registration database you could have DataTrees that provided Structure, Sample and Supplier perspectives. Each Data Tree would have a a different Entity at the root of the tree.

Data Trees are shown in the Projects window and all the views that a user has created for that Data Tree are shown as child nodes. There are two basic types of Data Tree, simple and complex.

1. Simple Data Trees

These only contain a single Entity, and so can only contain a 'flat' representation of data from that Entity. In this case the Data Tree itself is providing relatively little. These types of Data Trees cannot express relational data. These will be generated when, for instance, you import an SD file into IJC. They are represented by Data Tree icons that indicate the nature of the underlying Entity: images/download/attachments/47417138/datatree-simple-std.png or images/download/attachments/47417138/datatree-simple-jcb.png .

Data from a simple Data Tree can be effectively viewed with Form Views or Grid Views.

2. Complex Data Trees

Like simple Data Trees, these contain a single root Entity, but this root entity contains further Entities as children (connected through edges that reflect the Relationship between the 2 entities). These child entities can further contain their own children. This allows a hierarchical representation of data from multiple Entities that express relational data. They are represented by Data Tree icons that indicate that this is a tree like structure: images/download/attachments/47417138/datatree.png .

An Entity can only be a child of a parent if it has a direct Relationship to the parent, though the direction of this Relationship can be in either direction (e.g one-to-many or many-to-one). By this means different Data Trees can be created that provide the different perspectives on the data. For instance, for our imaginary relational Schema (see the About Relationships document) you could create a Data Trees that viewed the data from the perspective of STRUCTURES, or SAMPLES or SUPPLIERS. Note, for instance, that in the STRUCTURES perspective the edge to SAMPLES is one-to-many whereas in the SAMPLES perspective the edge to STRUCTURES is many-to-one. The same Relationship is involved, but as the direction is reversed.

images/download/attachments/47417138/datatree-structures.png

Two levels of hierarchy: Each STRUCTURE has many SAMPLEs, and each SAMPLE comes from one SUPPLIER.

images/download/attachments/47417138/datatree-suppliers.png

Two levels of hierarchy: A SUPPLIER has many SAMPLEs, and each SAMPLE contains one STRUCTURE.

images/download/attachments/47417138/datatree-samples.png

One level of hierarchy: A SAMPLE contains one STRUCTURE and it comes from one SUPPLIER.

A complex Date Tree is naturally more complex than a simple one, and is typically viewed with a Form View. A Grid View can be used, but you would only be able to see data from the root Entity.

Projects window

Data trees are displayed in the projects window, under the schema to which they belong. The child elements of the data tree are the views that belong to the data tree. The following screen shot shows the data trees for the schema named localdb, and the views that have been defined for the Pubchem demo data tree.

images/download/attachments/47417138/project-explorer.png

Editing a Data Tree

To view or edit the hierarchical structure of a data tree you should use the schema editor. Open this by double clicking on the schema node in the projects window. See the Editing data trees page for more details.