About Relationships

    Relationships define associations between Entities and are modelled on a database foreign key constraint, but at a higher level of abstraction. Relationships are essential for defining relational data. If you only ever deal with data that fits into a single 'rectangular row and column' paradigm then you will not need Relationships. Relationships were added to Instant JChem in version 2.0. You will need a reasonable level of understanding of relational databases to understand and use Relationships effectively.

    To illustrate the nature of relationships, lets assume that you have some STRUCTURES each of which you have purchased multiple SAMPLES from a small number of SUPPLIERS. The best way to handle this information in Instant JChem would be to create an Entity for each of these (structures, samples and suppliers), with each Entity having the appropriate Fields. Then you would create add a Relationship to define the association between STRUCTURES and SAMPLES (this relationship would define that for each STRUCTURES there could be zero or more SAMPLES (e.g. multiple SAMPLES - this is a one-to-many relationship when viewed from the perspective of the STRUCTURES), and you would add a Relationship to define the association between SAMPLES and SUPPLIERS (this relationship would define that for each SAMPLE there was exactly one SUPPLIER (e.g. multiple SAMPLES - this is a many-to-one relationship when viewed from the perspective of the SAMPLE). These would be defined at the database level using foreign key constraints, but the Relationships are easier to use, mainly because they are bi-directional (both of the Entities involved know about the Relationship and know the ordinality (many-to-one from one direction would be one-to-many from the other end).

    Once you have the Relationships defined, you can then build a Data Tree from the Entities and their Relationships. For instance, one Data Tree that could be built would have STRUCTURES at the root vertex, and have SAMPLES as a child vertex (defining a a master-detail relationship that was one-to-many in the direction of master to detail, and then the SAMPLES vertex would itself have SUPPLIERS as a child vertex (which would be many-to-one in the master to detail direction). In this way you build 2 levels of master detail data. This would be displayed using a Form View.

    See also