From 9d8041a37eac48bab92f093d2d9f544a9a6bc379 Mon Sep 17 00:00:00 2001 From: Sierra Taylor Moxon Date: Fri, 26 Jan 2024 16:58:18 -0800 Subject: [PATCH] add dep stub --- .../datamodel/transformer_model.yaml | 6 ++++++ .../transformer/object_transformer.py | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/linkml_transformer/datamodel/transformer_model.yaml b/src/linkml_transformer/datamodel/transformer_model.yaml index b8d1387..a278dc2 100644 --- a/src/linkml_transformer/datamodel/transformer_model.yaml +++ b/src/linkml_transformer/datamodel/transformer_model.yaml @@ -246,6 +246,12 @@ classes: range: string stringification: range: StringificationConfiguration + deprecated: + range: boolean + description: >- + If a slot is deprecated, it will not be included in the target schema yaml file, and all references + in the source schema to that slot will be removed. However, the deprecated slot will be added to an + "obsolete" yaml file that will be generated along with the target schema yaml file. EnumDerivation: is_a: ElementDerivation diff --git a/src/linkml_transformer/transformer/object_transformer.py b/src/linkml_transformer/transformer/object_transformer.py index 74ba290..6b42817 100644 --- a/src/linkml_transformer/transformer/object_transformer.py +++ b/src/linkml_transformer/transformer/object_transformer.py @@ -55,6 +55,14 @@ def index(self, source_obj: Any, target: str = None): else: self.object_index = ObjectIndex(source_obj, schemaview=self.source_schemaview) + def deprecate(self, source_obj: Any, target: str = None): + """ + Deprecate an object. + + :param source_obj: source data structure to be deprecated + :param target: class to convert source object into + """ + def transform( self, source_obj: OBJECT_TYPE, @@ -65,8 +73,9 @@ def transform( Transform a source object into a target object. :param source_obj: source data structure - :param source_type: source_obj instantiates this (may be class, type, or enum) - :param target_type: target_obj instantiates this (may be class, type, or enum) + + :param source_type: source_obj instantiates this (source_type value may be class, type, or enum) + :param target_type: target_obj instantiates this (target_type value may be class, type, or enum) :return: transformed data, either as type target_type or a dictionary """ sv = self.source_schemaview