Skip to content

Commit

Permalink
[OntologyManager::load_ontology()] move comment (on creating empty on…
Browse files Browse the repository at this point in the history
…to if not existing) closer to code
  • Loading branch information
duc than committed Aug 21, 2024
1 parent d833bc5 commit bdbde8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pycram/ontology/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bdbde8f

Please sign in to comment.