Re: Pellet error - AttributeError: 'CompletedProcess' object has no attribute 'decode'
Posted by
cknoll on
URL: http://owlready.306.s1.nabble.com/Pellet-error-AttributeError-CompletedProcess-object-has-no-attribute-decode-tp2701p2704.html
Hi Stelios,
you are experiencing now the desired behavior now (at least as far I understand it): You get an `OwlReadyInconsistentOntologyError`.
Explanaition:
Owlready calls the reasoner via `subproces` module. This allows python to call other programs, java in our case. The reasoner discovers an inconsistent ontology and this process exits with an nonzero status code. As this is usually indicating that something went wrong. Thus, a CalledProcessError is raised. However, owlready catches this error with try ... except clause and handles it. This handling consists in calling the reasoner again (now with the `explain` argument. It caputures the output of this call and then raises an `OwlReadyInconsistentOntologyError` – as briefly mentioned in my last message. Thus owlready is telling you: Your ontology is inconsistent and here is some output from the pellet reasonser that might help you in debugging. This is better then raising an AttributeError as it was before).
Your initial intention was to find out the pellet explanation. Now you have it. If its not helpful, then it is probably an issue of pellet.
I truncated your output below to the most relevant part which hopefully illustrates my above explanation.
One last tip: You can use `sync_reasoner_pellet(debug=4, keep_tmp_file=True)` to prevent the temporary ontology file from deleting. This allows you to call the reasoner directly from the command line (with the command which is shown by the debug output) without owlready postprocessing it. This might be also useful for debugging.
stelios wrote
I added your fix to my setup but another error is thrown.
Specifically:
...
Traceback (most recent call last):
File "/home/stelios/VirtualPythonEnvironments/ProverPlayground/lib/python3.9/site-packages/owlready2/reasoning.py", line 271, in sync_reasoner_pellet
output = subprocess.run(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE, check = True, **_subprocess_kargs).stdout
File "/usr/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '...'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/stelios/VirtualPythonEnvironments/ProverPlayground/lib/python3.9/site-packages/owlready2/reasoning.py", line 281, in sync_reasoner_pellet
raise OwlReadyInconsistentOntologyError("Java error message is: %s" % msg)
owlready2.base.OwlReadyInconsistentOntologyError: Java error message is: log4j:WARN No appenders could be found for logger (com.hp.hpl.jena.sparql.mgt.ARQMgt).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
ERROR: Ontology is inconsistent, run "pellet explain" to get the reason
This is the output of `pellet explain`:
log4j:WARN No appenders could be found for logger (com.hp.hpl.jena.sparql.mgt.ARQMgt).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.semanticweb.owlapi.model.OWLRuntimeException: No explanation computed
at com.clarkparsia.owlapi.explanation.GlassBoxExplanation.convertExplanation(GlassBoxExplanation.java:258)
at com.clarkparsia.owlapi.explanation.GlassBoxExplanation.getPelletExplanation(GlassBoxExplanation.java:228)
at com.clarkparsia.owlapi.explanation.GlassBoxExplanation.getExplanation(GlassBoxExplanation.java:191)
at com.clarkparsia.owlapi.explanation.HSTExplanationGenerator.getExplanation(HSTExplanationGenerator.java:113)
at com.clarkparsia.owlapi.explanation.HSTExplanationGenerator.getExplanations(HSTExplanationGenerator.java:137)
at pellet.PelletExplain.explainAxiom(PelletExplain.java:269)
at pellet.PelletExplain.explainSubClass(PelletExplain.java:371)
at pellet.PelletExplain.explainUnsatisfiableClass(PelletExplain.java:385)
at pellet.PelletExplain.run(PelletExplain.java:233)
at pellet.Pellet.run(Pellet.java:105)
at pellet.Pellet.main(Pellet.java:59)