Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #313 modification of owl temporary file in save function #314

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions ontopy/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,12 @@ def save(
revmap = {value: key for key, value in FMAP.items()}
super().save(file=filename, format=revmap[format], **kwargs)
else:
with tempfile.NamedTemporaryFile(suffix=".owl") as handle:
super().save(file=handle.name, format="rdfxml", **kwargs)
graph = rdflib.Graph()
graph.parse(handle.name, format="xml")
graph.serialize(destination=filename, format=format)
fileTemp = os.path.join(tempfile.gettempdir(), os.urandom(24).hex())
super().save(fileTemp, format="rdfxml", **kwargs)
graph = rdflib.Graph()
print(fileTemp)
sygout marked this conversation as resolved.
Show resolved Hide resolved
graph.parse(fileTemp, format="xml")
graph.serialize(destination=filename, format=format)

def get_imported_ontologies(self, recursive=False):
"""Return a list with imported ontologies.
Expand Down