From 3e8700f308cde8c3c84ff49fe2c0167688146ad4 Mon Sep 17 00:00:00 2001 From: Alejandro Villar Date: Thu, 1 Aug 2024 12:58:55 +0200 Subject: [PATCH] Fix validation of Turtle files --- ogc/bblocks/validation/rdf.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ogc/bblocks/validation/rdf.py b/ogc/bblocks/validation/rdf.py index 74ab399..46276fb 100644 --- a/ogc/bblocks/validation/rdf.py +++ b/ogc/bblocks/validation/rdf.py @@ -130,8 +130,8 @@ def __init__(self, bblock: BuildingBlock, register: BuildingBlockRegister): def _load_graph(self, filename: Path, output_filename: Path, report: ValidationReportItem, contents: str | None = None, - base_uri: str | None = None) -> Graph | None: - graph = None + base_uri: str | None = None) -> Graph | None | bool: + graph = False if filename.suffix == '.json': if self.jsonld_error: report.add_entry(ValidationReportEntry( @@ -262,6 +262,7 @@ def _load_graph(self, filename: Path, output_filename: Path, report: ValidationR 'exception': e.__class__.__qualname__, } )) + return return graph @@ -272,8 +273,10 @@ def validate(self, filename: Path, output_filename: Path, report: ValidationRepo **kwargs) -> bool | None: graph = self._load_graph(filename, output_filename, report, contents, base_uri) - if graph is None: + if graph is False: return False + if graph is None: + return if graph is not None and (contents or filename.suffix != '.ttl'): try: