From e0db523d6a8da7b4f999e5d220068140a7a6af2b Mon Sep 17 00:00:00 2001 From: anders-albert Date: Thu, 19 Dec 2024 13:02:42 +0100 Subject: [PATCH] refactor; added missing descriptions --- cognite/neat/_rules/exporters/_rules2dms.py | 4 ++++ cognite/neat/_rules/exporters/_rules2excel.py | 4 ++++ .../_rules/exporters/_rules2instance_template.py | 4 ++++ cognite/neat/_rules/exporters/_rules2ontology.py | 14 +++++++++++++- cognite/neat/_rules/exporters/_rules2yaml.py | 4 ++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/cognite/neat/_rules/exporters/_rules2dms.py b/cognite/neat/_rules/exporters/_rules2dms.py index 6d6f57405..76939c76e 100644 --- a/cognite/neat/_rules/exporters/_rules2dms.py +++ b/cognite/neat/_rules/exporters/_rules2dms.py @@ -109,6 +109,10 @@ def __init__( self._schema: DMSSchema | None = None self.remove_cdf_spaces = remove_cdf_spaces + @property + def description(self) -> str: + return "Export verified DMS Model to CDF." + def export_to_file(self, rules: DMSRules, filepath: Path) -> None: """Export the rules to a file(s). diff --git a/cognite/neat/_rules/exporters/_rules2excel.py b/cognite/neat/_rules/exporters/_rules2excel.py index 9eb800391..f16affb6f 100644 --- a/cognite/neat/_rules/exporters/_rules2excel.py +++ b/cognite/neat/_rules/exporters/_rules2excel.py @@ -76,6 +76,10 @@ def __init__( self._styling_level = self.style_options.index(styling) self.new_model_id = new_model_id + @property + def description(self) -> str: + return "Export verified model to Excel." + def export_to_file(self, rules: VerifiedRules, filepath: Path) -> None: """Exports transformation rules to excel file.""" data = self.export(rules) diff --git a/cognite/neat/_rules/exporters/_rules2instance_template.py b/cognite/neat/_rules/exporters/_rules2instance_template.py index 4d13b01f2..c4ab9e0f7 100644 --- a/cognite/neat/_rules/exporters/_rules2instance_template.py +++ b/cognite/neat/_rules/exporters/_rules2instance_template.py @@ -42,6 +42,10 @@ def __init__( self.auto_identifier_type = auto_identifier_type self.add_drop_down_list = add_drop_down_list + @property + def description(self) -> str: + return "Export verified information instance template to Excel." + def export( self, rules: InformationRules, diff --git a/cognite/neat/_rules/exporters/_rules2ontology.py b/cognite/neat/_rules/exporters/_rules2ontology.py index 95ec35f3d..8f3734a53 100644 --- a/cognite/neat/_rules/exporters/_rules2ontology.py +++ b/cognite/neat/_rules/exporters/_rules2ontology.py @@ -46,6 +46,10 @@ class OWLExporter(GraphExporter): def export(self, rules: InformationRules) -> Graph: return Ontology.from_rules(rules).as_owl() + @property + def description(self) -> str: + return "Export verified information model to OWL." + class SHACLExporter(GraphExporter): """Exports rules to a SHACL graph.""" @@ -53,13 +57,21 @@ class SHACLExporter(GraphExporter): def export(self, rules: InformationRules) -> Graph: return Ontology.from_rules(rules).as_shacl() + @property + def description(self) -> str: + return "Export verified information model to SHACL." + class SemanticDataModelExporter(GraphExporter): - """Exports verified information rules to a semantic data model.""" + """Exports verified information model to a semantic data model.""" def export(self, rules: InformationRules) -> Graph: return Ontology.from_rules(rules).as_semantic_data_model() + @property + def description(self) -> str: + return "Export verified information model to a semantic data model." + class OntologyModel(BaseModel): model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True, strict=False, extra="allow") diff --git a/cognite/neat/_rules/exporters/_rules2yaml.py b/cognite/neat/_rules/exporters/_rules2yaml.py index 367077a80..e86fb43df 100644 --- a/cognite/neat/_rules/exporters/_rules2yaml.py +++ b/cognite/neat/_rules/exporters/_rules2yaml.py @@ -43,6 +43,10 @@ def __init__(self, files: Files = "single", output: Format = "yaml"): self.files = files self.output = output + @property + def description(self) -> str: + return "Export verified model to YAML." + def export_to_file(self, rules: VerifiedRules, filepath: Path) -> None: """Exports transformation rules to YAML/JSON file(s).""" if self.files == "single":