Schema
1. Resource hierarchy
(1) Resource
(1.1) Project extends Resource
(1.2) InformationResource extends Resource
It has a parent: Project
(1.2.1) Dataset extends InformationResource
It has children: set of DataTable
(1.2.2) Document extends InformationResource
(1.2.3) CodingSheet extends InformationResource
It has children: set ofCodingRule
(1.2.4) Ontology extends InformationResource
(1.3) DataTable extends Resource
It has a parent: Dataset
It has children: set of DataTableDataTableColumn
(1.4) DataTableColumn extends Resource
It has a parent: DataTable
(1.5) CodingRule is also a resource table, but it does NOT extend Resource because the id sequence is too large.
It has a parent: CodingSheet
(2) Resource terms tables, these are not managed through hibernate.
(2.1) resource_term keeps the keywords in a resource
(2.2.) resource_context_term keeps resources' context keywords
(2.3) resource_context_term_weight stores the similarity value between a resource term and a resource context term.
E.g., resource 1 is a dataset, it is associated with an ontology
Then the keywords in this dataset's metadata and content go to the "resource_term" table.
The keywords in the ontology go to the "resource_context_term" table.
The similarity between keyword pair (k1, k2) where k1 is in resource_term table, and k2 is in resource_context_term table is put into "resource_context_term_weight" table.
Note:
(1) resource_term table is used in basic/advanced search for ranking purpose, so it is very important to maintain this
(2) resource_context_term and resource_context_term_weight are only used in context-aware search.
2. Resource relationships
(1). Generally, the one to many relationships are caught by the Foreign Key relationship in the table.
1.1 InformationResource has FK project_id to reference project(id)
So, automatically, dataset, document, codingsheet and ontology inherits this project_id.
(2) The many to many relationships among resources are captured in the "resource_relationship"
2.1. One coding sheet can be used by many other resources (e.g., data table columns)
2.2. One ontology can be used by many other resources (e.g., data table columns)tDAR's schema is mainly managed by hibernate. An ER-Diagram is attached. A version of the schema may be viewed at https://bitbucket.org/tdar/tdar.src/src/default/src/main/db/tdarmetadata_schema.sql