diff --git a/cmem_plugin_reason/plugin_reason.py b/cmem_plugin_reason/plugin_reason.py index 8349faf..0fadf2d 100644 --- a/cmem_plugin_reason/plugin_reason.py +++ b/cmem_plugin_reason/plugin_reason.py @@ -375,6 +375,12 @@ def _execute(self, inputs: Sequence[Entities], context: ExecutionContext) -> Non def execute(self, inputs: Sequence[Entities], context: ExecutionContext) -> None: """Validate input, execute plugin with temporary directory""" + context.report.update( + ExecutionReport( + operation="reason", + operation_desc="ontologies and data graphs processed.", + ) + ) if self.input_profiles: errors = "" values = next(inputs[0].entities).values diff --git a/cmem_plugin_reason/plugin_validate.py b/cmem_plugin_reason/plugin_validate.py index 4ea6ec8..79bdf16 100644 --- a/cmem_plugin_reason/plugin_validate.py +++ b/cmem_plugin_reason/plugin_validate.py @@ -131,6 +131,16 @@ def __init__( # noqa: PLR0913 self.schema = self.generate_output_schema() self.output_port = FixedSchemaPort(self.schema) + def generate_output_schema(self) -> EntitySchema: + """Generate the output schema.""" + paths = [EntityPath(path="markdown"), EntityPath(path="ontology")] + if self.validate_profile: + paths.append(EntityPath(path="profile")) + return EntitySchema( + type_uri="https://eccenca.com/plugin_validateontology/type", + paths=paths, + ) + def get_graphs(self, graphs: dict, context: ExecutionContext) -> None: """Get graphs from CMEM""" for graph in graphs: @@ -189,16 +199,6 @@ def add_profiles(self, valid_profiles: list) -> list: post_profiles(self, valid_profiles) return valid_profiles - def generate_output_schema(self) -> EntitySchema: - """Generate the output schema.""" - paths = [EntityPath(path="markdown"), EntityPath(path="ontology")] - if self.validate_profile: - paths.append(EntityPath(path="profile")) - return EntitySchema( - type_uri="https://eccenca.com/plugin_validateontology/type", - paths=paths, - ) - def make_entities(self, text: str, valid_profiles: list) -> Entities: """Make entities""" values = [[text], [self.ontology_graph_iri]] @@ -240,11 +240,13 @@ def _execute(self, context: ExecutionContext) -> Entities: context.report.update( ExecutionReport( operation="validate", - error="Inconsistencies found in ontology", + error="Inconsistencies found in ontology.", + operation_desc="ontologies processed.", + entity_count=1, ) ) else: - self.log.warning("Inconsistencies found in ontology") + self.log.warning("Inconsistencies found in ontology.") else: context.report.update( ExecutionReport( @@ -258,5 +260,11 @@ def _execute(self, context: ExecutionContext) -> Entities: def execute(self, inputs: tuple, context: ExecutionContext) -> Entities: # noqa: ARG002 """Remove temp files on error""" + context.report.update( + ExecutionReport( + operation="validate", + operation_desc="ontologies validated.", + ) + ) with TemporaryDirectory() as self.temp: return self._execute(context)