From bdbde8f06922a6d81a1200ab5edc1e669fc0d82b Mon Sep 17 00:00:00 2001 From: duc than Date: Wed, 21 Aug 2024 10:24:13 +0200 Subject: [PATCH] [OntologyManager::load_ontology()] move comment (on creating empty onto if not existing) closer to code --- src/pycram/ontology/ontology.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pycram/ontology/ontology.py b/src/pycram/ontology/ontology.py index 097673d13..4e7a92d46 100644 --- a/src/pycram/ontology/ontology.py +++ b/src/pycram/ontology/ontology.py @@ -218,9 +218,11 @@ def load_ontology(self, ontology_iri: str) -> Optional[Tuple[Ontology, Namespace rospy.logerr("Ontology IRI is empty") return None - # If `ontology_iri` is a local path -> create an empty ontology file if not existing is_local_ontology_iri = not (ontology_iri.startswith("http:") or ontology_iri.startswith("https:")) + + # If `ontology_iri` is a local path if is_local_ontology_iri and not Path(ontology_iri).exists(): + # -> Create an empty ontology file if not existing with open(ontology_iri, 'w'): pass