Suppose we have a folder like this:
/data/example
/data/example.owl Suppose the ontology has IRI:
http://example/data/example/toto.owl
If we do the following:
onto_path.append("/data")
onto = get_ontology("
http://example").load()
This fails. The reason is that the logic in namespace:
def _get_onto_file(base_iri, name, mode = "r", only_local = False):
if base_iri.endswith("#") or base_iri.endswith("/"): base_iri = base_iri[:-1]
if base_iri.startswith("file://"): return urllib.parse.unquote(base_iri[7:])
for dir in onto_path:
filename = os.path.join(dir, base_iri.rsplit("/", 1)[-1])
if os.path.exists(filename): return filename # insufficient check!
for ext in ["", ".nt", ".ntriples", ".rdf", ".owl"]:
filename = os.path.join(dir, "%s%s" % (name, ext))
if os.path.exists(filename): return filename
if (mode.startswith("r")) and not only_local: return base_iri
if (mode.startswith("w")): return os.path.join(onto_path[0], "%s.owl" % name)
raise FileNotFoundError
The test should be:
if os.path.exists(filename) and os.path.isfile(filename): return filename
- Nicolas.