From 70fa39970e6ff5dc617c546c4dc03d3d38871dbf Mon Sep 17 00:00:00 2001 From: jpizarro Date: Thu, 30 Jan 2025 13:20:44 +0100 Subject: [PATCH] Renamed model_to_rdf for BaseEntity --- bam_masterdata/cli/cli.py | 2 +- bam_masterdata/cli/entities_to_rdf.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bam_masterdata/cli/cli.py b/bam_masterdata/cli/cli.py index ef5966e..11c29d4 100644 --- a/bam_masterdata/cli/cli.py +++ b/bam_masterdata/cli/cli.py @@ -259,7 +259,7 @@ def export_to_rdf(force_delete, python_path): module for module in py_modules if "vocabulary_types.py" not in module ] - # Process each module using the `to_json` method of each entity + # Process each module using the `model_to_rdf` method of each entity graph = Graph() for module_path in py_modules: entities_to_rdf(graph=graph, module_path=module_path, logger=logger) diff --git a/bam_masterdata/cli/entities_to_rdf.py b/bam_masterdata/cli/entities_to_rdf.py index 94d41d7..2803531 100644 --- a/bam_masterdata/cli/entities_to_rdf.py +++ b/bam_masterdata/cli/entities_to_rdf.py @@ -202,12 +202,12 @@ def entities_to_rdf( # ? For OBJECT TYPES # ? `generated_code_prefix`, `auto_generated_codes`? for name, obj in inspect.getmembers(module, inspect.isclass): - # Ensure the class has the `to_json` method - if not hasattr(obj, "defs") or not callable(getattr(obj, "to_rdf")): + # Ensure the class has the `model_to_rdf` method + if not hasattr(obj, "defs") or not callable(getattr(obj, "model_to_rdf")): continue try: # Instantiate the class and call the method entity = obj() - entity.to_rdf(namespace=BAM, graph=graph) + entity.model_to_rdf(namespace=BAM, graph=graph) except Exception as err: click.echo(f"Failed to process class {name} in {module_path}: {err}")