Contribute to the DSpace Development Fund
The newly established DSpace Development Fund supports the development of new features prioritized by DSpace Governance. For a list of planned features see the fund wiki page.
Since DSpace 5, all DSpace objects (bitstream, bundle, item, collection, community, site, group, eperson) can have metadata (in DSpace 4 and earlier, this applied only to items). The advantage is that such metadata can have a flexible schema, which can be changed dynamically (e.g. from the administration web interface), without altering the underlying database schema (DDL). This will allow an easy implementation of future changes like:
- collection/community names in multiple languages
- bundles could be implemented as metadata on bitstreams
- arbitrary metadata for authors (if authors are made into a first-class object)
All metadata has the following form: namespace.element.qualifier = value
This page outlines the changes to the database schema between DSpace 4 and DSpace 5 that reflect this change. The terms object, resource and entity are used interchangeably.
Changes
A consequence of the implementation of Metadata on all DSpace objects is that most entity (e.g. bitstream, eperson, ...) attributes (e.g. ) moved into the metadatavalue table.
e.g.:
SELECT lastname FROM eperson;
is now:
SELECT text_value FROM metadatavalue WHERE metadata_field_id = ( SELECT metadata_field_id FROM metadatafieldregistry mfr, metadataschemaregistry msr WHERE mfr.metadata_schema_id = msr.metadata_schema_id AND short_id = 'eperson' AND element = 'lastname' AND qualifier IS NULL );
Column names like item_id or community_id have been mostly replaced with the tuple (resource_id, resource_type_id) where resource_type_id is a constant specifying object type:
| constant | object type |
|---|---|
| 0 | bitstream |
| 1 | bundle |
| 2 | item |
| 3 | collection |
| 4 | community |
| 5 | site |
| 6 | group |
| 7 | eperson |
SELECT text_value FROM metadatavalue JOIN handle as h ON h.resource_id = metadatavalue.dspace_object_id WHERE metadata_field_id = ( SELECT metadata_field_id FROM metadatafieldregistry mfr, metadataschemaregistry msr WHERE mfr.metadata_schema_id = msr.metadata_schema_id AND short_id = 'dc' AND element = 'title' AND qualifier IS NULL ) AND resource_type_id=2;
Example change
Example eperson table in DSpace 4 (simplified to show only relevant parts):
| eperson_id | firstname | lastname |
|---|---|---|
| 1001 | John | Smith |
| 1002 | Jane | Doe |
Example eperson and metadatavalue tables in DSpace 5 (simplified to show only relevant parts):
eperson:
| eperson_id |
|---|
| 1001 |
| 1002 |
metadatavalue:
| resource_type_id | resource_id | metadata_field_id | text_value |
|---|---|---|---|
| 7 | 1001 | 123 | John |
| 7 | 1001 | 124 | Smith |
| 7 | 1002 | 123 | Jane |
| 7 | 1002 | 124 | Doe |
See also
Relevant DB schema changes: V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql
DSpace 5 DB schema: Storage Layer#RDBMS/DatabaseStructure