diff --git a/config/model/class_groups.py b/config/model/class_groups.py index 67afa6755..f28f4a73f 100644 --- a/config/model/class_groups.py +++ b/config/model/class_groups.py @@ -18,7 +18,8 @@ 'name': 'event', 'label': _('event'), 'classes': [ - 'activity', 'acquisition', 'modification', 'move', 'production'], + 'activity', 'acquisition', 'creation', 'modification', 'move', + 'production'], 'table_columns': ['name', 'class', 'type', 'begin', 'end', 'description'], 'icon': 'mdi-calendar'}, diff --git a/config/model/classes/event.py b/config/model/classes/event.py index ea404454b..8b352e061 100644 --- a/config/model/classes/event.py +++ b/config/model/classes/event.py @@ -111,6 +111,17 @@ 'mode': 'direct', 'multiple': True}} +creation: dict[str, Any] = copy.deepcopy(class_) +creation['label'] = _('creation') +creation['display']['tooltip'] = _('creation of conceptual items') +creation['relations'] = creation['relations'] | { + 'created_source': { + 'label': _('created source'), + 'classes': ['source'], + 'property': 'P94', + 'multiple': True, + 'mode': 'direct'}} + modification: dict[str, Any] = copy.deepcopy(class_) modification['label'] = _('modification') modification['display']['tooltip'] = _('modification of items') diff --git a/config/model/classes/source.py b/config/model/classes/source.py index 0b4d93258..7806200e4 100644 --- a/config/model/classes/source.py +++ b/config/model/classes/source.py @@ -61,7 +61,14 @@ 'buttons': ['link', 'insert'], 'tooltip': _('mentioned in the source')}}, 'reference': standard_relations['reference'], - 'file': standard_relations['file']}, + 'file': standard_relations['file'], + 'source_creation': { + 'label': _('creation event'), + 'classes': ['creation'], + 'property': 'P94', + 'inverse': True, + 'mode': 'direct', + 'tooltip': _('Links the creation event of the source')}}, 'display': { 'buttons': ['copy'], 'form_buttons': ['insert_and_continue'], diff --git a/config/model/model.py b/config/model/model.py index 8c1830014..a8799942e 100644 --- a/config/model/model.py +++ b/config/model/model.py @@ -13,6 +13,7 @@ 'alias': {'attributes': {}}, 'artifact': item.artifact, 'bibliography': reference.bibliography, + 'creation': event.creation, 'edition': reference.edition, 'external_reference': reference.external_reference, 'feature': place.feature, diff --git a/install/4_data_type.sql b/install/4_data_type.sql index 0dae6de9b..0b1799c7d 100644 --- a/install/4_data_type.sql +++ b/install/4_data_type.sql @@ -345,6 +345,7 @@ INSERT INTO model.openatlas_class (name, cidoc_class_code, new_types_allowed, wr ('alias', 'E41', false, 'contributor', NULL), ('artifact', 'E22', true, 'contributor', (SELECT id FROM model.entity WHERE name = 'Artifact' AND openatlas_class_name = 'type' ORDER BY id ASC LIMIT 1)), ('bibliography', 'E31', true, 'contributor', (SELECT id FROM model.entity WHERE name = 'Bibliography' AND openatlas_class_name = 'type' ORDER BY id ASC LIMIT 1)), + ('creation', 'E65', true, 'contributor', (SELECT id FROM model.entity WHERE name = 'Event' AND openatlas_class_name = 'type' ORDER BY id ASC LIMIT 1)), ('edition', 'E31', true, 'contributor', (SELECT id FROM model.entity WHERE name = 'Edition' AND openatlas_class_name = 'type' ORDER BY id ASC LIMIT 1)), ('external_reference', 'E31', true, 'contributor', (SELECT id FROM model.entity WHERE name = 'External reference' AND openatlas_class_name = 'type' ORDER BY id ASC LIMIT 1)), ('feature', 'E18', true, 'contributor', (SELECT id FROM model.entity WHERE name = 'Feature' AND openatlas_class_name = 'type' ORDER BY id ASC LIMIT 1)), diff --git a/install/upgrade/9.5.0.sql b/install/upgrade/9.5.0.sql index d63d99ac9..ba328ddfe 100644 --- a/install/upgrade/9.5.0.sql +++ b/install/upgrade/9.5.0.sql @@ -3,10 +3,15 @@ BEGIN; -- Raise database version UPDATE web.settings SET value = '9.5.0' WHERE name = 'database_version'; --- Remove cidoc_class_code FROM model.entity -ALTER TABLE model.entity DROP COLUMN IF EXISTS cidoc_class_code; +-- Add creation event for sources (#2743) +INSERT INTO model.openatlas_class (name, cidoc_class_code, new_types_allowed, write_access_group_name, standard_type_id) VALUES + ('creation', 'E65', true, 'contributor', (SELECT id FROM model.entity WHERE name = 'Event' AND openatlas_class_name = 'type' ORDER BY id ASC LIMIT 1)); +INSERT INTO web.hierarchy_openatlas_class (hierarchy_id, openatlas_class_name) VALUES + ((SELECT id FROM web.hierarchy WHERE name='Event'), 'creation'); +-- Remove cidoc_class_code FROM model.entity (#2875) +ALTER TABLE model.entity DROP COLUMN IF EXISTS cidoc_class_code; DROP FUNCTION IF EXISTS model.delete_entity_related() CASCADE; CREATE FUNCTION model.delete_entity_related() RETURNS trigger