ruff fix
This commit is contained in:
parent
6c576883b9
commit
6d55da00af
2 changed files with 13 additions and 7 deletions
|
|
@ -36,7 +36,7 @@ def get_ontology_resolver_from_env(
|
||||||
file_paths = [path.strip() for path in ontology_file_path.split(",")]
|
file_paths = [path.strip() for path in ontology_file_path.split(",")]
|
||||||
else:
|
else:
|
||||||
file_paths = ontology_file_path
|
file_paths = ontology_file_path
|
||||||
|
|
||||||
return RDFLibOntologyResolver(
|
return RDFLibOntologyResolver(
|
||||||
matching_strategy=FuzzyMatchingStrategy(), ontology_file=file_paths
|
matching_strategy=FuzzyMatchingStrategy(), ontology_file=file_paths
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,10 @@ class RDFLibOntologyResolver(BaseOntologyResolver):
|
||||||
elif isinstance(ontology_file, list):
|
elif isinstance(ontology_file, list):
|
||||||
files_to_load = ontology_file
|
files_to_load = ontology_file
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"ontology_file must be a string, list of strings, or None. Got: {type(ontology_file)}")
|
raise ValueError(
|
||||||
|
f"ontology_file must be a string, list of strings, or None. Got: {type(ontology_file)}"
|
||||||
|
)
|
||||||
|
|
||||||
if files_to_load:
|
if files_to_load:
|
||||||
self.graph = Graph()
|
self.graph = Graph()
|
||||||
loaded_files = []
|
loaded_files = []
|
||||||
|
|
@ -54,16 +56,20 @@ class RDFLibOntologyResolver(BaseOntologyResolver):
|
||||||
"Ontology file '%s' not found. Skipping this file.",
|
"Ontology file '%s' not found. Skipping this file.",
|
||||||
file_path,
|
file_path,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not loaded_files:
|
if not loaded_files:
|
||||||
logger.info("No valid ontology files found. No owl ontology will be attached to the graph.")
|
logger.info(
|
||||||
|
"No valid ontology files found. No owl ontology will be attached to the graph."
|
||||||
|
)
|
||||||
self.graph = None
|
self.graph = None
|
||||||
else:
|
else:
|
||||||
logger.info("Total ontology files loaded: %d", len(loaded_files))
|
logger.info("Total ontology files loaded: %d", len(loaded_files))
|
||||||
else:
|
else:
|
||||||
logger.info("No ontology file provided. No owl ontology will be attached to the graph.")
|
logger.info(
|
||||||
|
"No ontology file provided. No owl ontology will be attached to the graph."
|
||||||
|
)
|
||||||
self.graph = None
|
self.graph = None
|
||||||
|
|
||||||
self.build_lookup()
|
self.build_lookup()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Failed to load ontology", exc_info=e)
|
logger.error("Failed to load ontology", exc_info=e)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue