Relationships between tables (or entities) in a database describe how records in one table reference or are linked to records in another. In Specify, these relationships are classified as either dependent or independent, which affects how data is handled during editing, especially in tools like Batch Edit or WorkBench.
You can see the types of relationships in the Data Model Viewer from the User Tools menu in any Specify 7 instance.
Dependent Relationship
A dependent relationship means that the existence of a record in the “child” table depends on the existence of a record in the “parent” table. If the parent is deleted, the dependent (child) should also be deleted. In editing scenarios, if all fields of a dependent record are cleared, the record can be safely deleted, since it cannot exist without its parent.
- Example:
Collection Object
→Determination
- A Collection Object Determination cannot exist without a Collection Object.
- If you delete a Collection Object, the dependent Determinations will also be deleted.
- The
Taxon
records linked to the Determination will remain, as they are independent.
When using the WorkBench, you can upload new dependent records to existing records in the database (i.e. new Determinations
, Preparations
, etc.).
Independent Relationship
An independent relationship means that the related record can exist on its own, regardless of whether it is referenced by another record. The “child” is not owned by or tied to the “parent” in a way that its existence depends on it. In editing scenarios, clearing a reference to an independent record does not delete that record; it only removes the link.
- Example:
Collection Object
→Cataloger
(Agent)- The Cataloger (an Agent) can exist independently of any Collection Object referencing it.
- If you remove the Cataloger from a Collection Object, the Agent record is not deleted from the database.
You cannot update links to independent records using the WorkBench; instead, you must use the Batch Edit tool.
Examples of Dependent and Independent Relationships in Specify
Dependent Relationships
Parent Table | Child/Related Table | Direction | Is the child record deleted if the parent is deleted? | Can the child exist without the parent? | Example Scenario |
---|---|---|---|---|---|
Collection Object | Collection Object Attribute | To-one dependent | Yes | No | Deleting a Collection Object deletes its Collection Object Attribute. |
Collection Object | Determination | To-many dependent | Yes | No | Determinations are removed if the Collection Object is deleted. |
Determination | Determiner | To-one dependent | Yes | No | A Determiner record is deleted if its Determination is deleted. |
Collecting Event | Locality | To-one dependent | Yes | No | Locality is deleted if Collecting Event is deleted (when Locality is used as dependent). |
Taxon | Taxon Citation | To-many dependent | Yes | No | If a Taxon is deleted, its Taxon Citations are also deleted. |
Agent | Address | To-many dependent | Yes | No | Addresses linked as dependents to Agent are deleted if Agent is deleted. |
Loan | Loan Return | To-many dependent | Yes | No | Deleting a Loan deletes its associated Loan Returns. |
Collection Object | Preparation | To-many dependent | Yes | No | Preparations are deleted if their Collection Object is deleted. |
Locality | Geography | To-one dependent | Yes | No | Geography is deleted if its Locality is deleted (when used as dependent in schema). |
Preparation | Storage | To-one dependent | Yes | No | Storage is deleted if Preparation is deleted (if Storage is modeled as dependent). |
Event | Event Attribute | To-many dependent | Yes | No | All Event Attributes are deleted if the parent Event is deleted. |
Collection Object | Accession Object | To-many dependent | Yes | No | Accession Objects are deleted if the parent Collection Object is deleted. |
Independent Relationships
Parent Table | Child/Related Table | Direction | Is the child record deleted if the parent is deleted? | Can the child exist without the parent? | Example Scenario |
---|---|---|---|---|---|
Collection Object | Cataloger (Agent) | To-one independent | No | Yes | Cataloger remains in database if Collection Object is deleted; only the link is removed. |
Collection Object | Collector (Agent) | To-many independent | No | Yes | Collector Agent records persist after Collection Object is deleted. |
Collection Object | Storage | To-one independent | No | Yes | Storage location exists independently of Collection Object references. |
Determination | Agent (Determiner) | To-one independent | No | Yes | Agent (Determiner) remains even if Determination is deleted. |
Collection Object | Collecting Event | To-one independent | No | Yes | Collecting Event is not deleted when a Collection Object is deleted. |
Loan | Borrower (Agent) | To-one independent | No | Yes | Agent (Borrower) is not deleted if Loan is deleted. |
Locality | Geography | To-one independent | No | Yes | Geography is not deleted if Locality is deleted (when Geography is independent in schema). |
Collection Object | Accession | To-one independent | No | Yes | Accession record remains after Collection Object is deleted. |
Preparation | Storage | To-one independent | No | Yes | Storage remains after Preparation is deleted (if Storage is independent in schema). |
Collection Object | Taxon (via Determination) | To-one independent | No | Yes | Taxon node remains in tree even if all Collection Objects referencing it are deleted. |
Collection Object | Preparation Type | To-one independent | No | Yes | Preparation Type persists after Collection Object is deleted. |
Collection Object | Collection | To-one independent | No | Yes | Collection record persists after all its Collection Objects are deleted. |