All Versions
DSpace Documentation
...
A talk on Configurable Entities was also presented at DSpace 7 at OR2021
The actual type of entity is stored in the "dspace.entity.type" metadata field.
Flyway will create tables to store the entity type and relationship configuration. The entity type table contains a unique ID and name for the entity type. This table typically only contains a few rows. It uses database indexes to easily and quickly find the entity types.
| Code Block | ||
|---|---|---|
| ||
Column | Type | Modifiers
--------+-----------------------+-----------
id | integer | not null
label | character varying(32) | not null |
The relationship type table contains a unique ID, the 2 entity type IDs (foreign keys), the labels for the relation, and the cardinality details (min and max occurrences in each direction). This table typically only contains a few rows. It uses database indexes to easily and quickly find the relations types.
| Code Block | ||
|---|---|---|
| ||
Column | Type | Modifiers
-----------------------+-----------------------+-----------
id | integer | not null
left_type | integer | not null
right_type | integer | not null
left_label | character varying(32) | not null
right_label | character varying(32) | not null
left_min_cardinality | integer |
left_max_cardinality | integer |
right_min_cardinality | integer |
right_max_cardinality | integer | |
The actual relations are stored in another new database table, containing a row per relation between two entities.
| Code Block | ||
|---|---|---|
| ||
Column | Type | Modifiers
-------------+---------+-----------
id | integer | not null
left_id | uuid | not null
type_id | integer | not null
right_id | uuid | not null
left_place | integer |
right_place | integer | |
It contains a unique ID, the ID of the relationship type (a foreign key to the table above), and the left and right item (foreign keys to the actual items), and place values to keep track of the position of the entity for the given relationship type. It uses database indexes to easily and quickly find all relations from the current item.
The “place” columns for relations are similar to the "place" column in the metadatavalue table, which also determines the order of the values. It gets updated automatically with the next number if a relation is created, similar to the current solution to populate the "place" column in the metadatavalue table.
The reason why there's a left and right place separately, is because we don't want the model to restrict which part of the relation has a "place".
For a journal, there are relations to the journal volumes as visible in REST. The relevant section is:
https://demo.dspace.org/entities/journalvolume/f9b89a11-b44e-4a64-a3b4-ab24a33553c7
"leftId": "a23eae5a-7857-4ef9-8e52-989436ad2955",
"rightId": "f9b89a11-b44e-4a64-a3b4-ab24a33553c7",
"leftPlace": 1,
"rightPlace": 1,
https://demo.dspace.org/entities/journalvolume/343d3263-2733-4367-9dc4-216a01b4a461
"leftId": "a23eae5a-7857-4ef9-8e52-989436ad2955",
"rightId": "343d3263-2733-4367-9dc4-216a01b4a461",
"leftPlace": 2,
"rightPlace": 1,
For this particular relation, the leftPlace is relevant because the leftId contains the current item ID. First the item with leftPlace 1 is displayed. Hereafter the item with leftPlace 2 is displayed.
For an article, there are relations to the OrgUnits visible in REST. The relevant section is:
https://demo.dspace.org/entities/orgunit/d30de96b-1e76-40ae-8ef9-ab426b6f9763
"leftId": "96715576-3748-4761-ad45-001646632963",
"rightId": "d30de96b-1e76-40ae-8ef9-ab426b6f9763",
"leftPlace": 1,
"rightPlace": 2,
https://demo.dspace.org/entities/orgunit/c216201f-ed10-4361-b0e0-5a065405bd3e
"leftId": "96715576-3748-4761-ad45-001646632963",
"rightId": "c216201f-ed10-4361-b0e0-5a065405bd3e",
"leftPlace": 2,
"rightPlace": 2,
For this particular relation, the leftPlace is relevant because the leftId contains the current item ID. First the item with leftPlace 1 is displayed. Hereafter the item with leftPlace 2 is displayed.
In the other direction, on the OrgUnit item page there are 6 publications visible in REST. The relevant section is:
https://demo.dspace.org/entities/publication/e98b0f27-5c19-49a0-960d-eb6ad5287067
"leftId": "e98b0f27-5c19-49a0-960d-eb6ad5287067",
"rightId": "d30de96b-1e76-40ae-8ef9-ab426b6f9763",
"leftPlace": 1,
"rightPlace": 1,
https://demo.dspace.org/entities/publication/96715576-3748-4761-ad45-001646632963
"leftId": "96715576-3748-4761-ad45-001646632963",
"rightId": "d30de96b-1e76-40ae-8ef9-ab426b6f9763",
"leftPlace": 1,
"rightPlace": 2,
https://demo.dspace.org/entities/publication/2f4ec582-109e-4952-a94a-b7d7615a8c69
"leftId": "2f4ec582-109e-4952-a94a-b7d7615a8c69",
"rightId": "d30de96b-1e76-40ae-8ef9-ab426b6f9763",
"leftPlace": 2,
"rightPlace": 3,
For this particular relation, the rightPlace is relevant because the rightId contains the current item ID. First the item with rightPlace 1 is displayed. Hereafter the item with rightPlace 2 is displayed, …
The relation with rightPlace 2 is the same relation as mentioned for the article above
The default DSpace database tables will not need to be modified as the entity type is part of the regular metadata.
The tilted relationships are a default DSpace 7 feature, developed in https://github.com/DSpace/DSpace/pull/3134
...