Skip to content

Commit

Permalink
refactor; added missing descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino committed Dec 19, 2024
1 parent f69bf09 commit e0db523
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cognite/neat/_rules/exporters/_rules2dms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 4 additions & 0 deletions cognite/neat/_rules/exporters/_rules2excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions cognite/neat/_rules/exporters/_rules2instance_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 13 additions & 1 deletion cognite/neat/_rules/exporters/_rules2ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,32 @@ 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."""

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")
Expand Down
4 changes: 4 additions & 0 deletions cognite/neat/_rules/exporters/_rules2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit e0db523

Please sign in to comment.