diff --git a/ontopy/factpluspluswrapper/owlapi_interface.py b/ontopy/factpluspluswrapper/owlapi_interface.py index c03eee4c..4043566c 100644 --- a/ontopy/factpluspluswrapper/owlapi_interface.py +++ b/ontopy/factpluspluswrapper/owlapi_interface.py @@ -31,9 +31,10 @@ def reason(self, graph): graph (Graph): An rdflib graph to execute the reasoner on. """ - with tempfile.NamedTemporaryFile("wt") as tmpdir: - graph.serialize(tmpdir.name, format="xml") - return self._run(tmpdir.name, command="--run-reasoner") + with tempfile.TemporaryDirectory("wt") as tmpdir: + tmpfile = os.path.join(tmpdir, "tmponto.xml") + graph.serialize(tmpfile, format="xml") + return self._run(tmpfile, command="--run-reasoner") def reason_files(self, *owl_files): """Merge the given owl and generate the inferred axioms.