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.
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: or .
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: .
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.
|Two levels of hierarchy: Each STRUCTURE has many SAMPLEs, and each SAMPLE comes from one SUPPLIER.|
|Two levels of hierarchy: A SUPPLIER has many SAMPLEs, and each SAMPLE contains one STRUCTURE.|
|One level of hierarchy: A SAMPLE contains one STRUCTURE and it comes from one SUPPLIER.|
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.
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.