"A metaphysical phenomenon" related to close_world() and/or sync_reasoner() (ignored)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

"A metaphysical phenomenon" related to close_world() and/or sync_reasoner() (ignored)

William
This post was updated on .
Hi~
I really can not explain it. before I check it once more, I'd better inform you.You may not believe it. It is a long story, I try my best to talk about it. If you have no idea, just ignore it.

I made a human-machine dialogue system. I had to call the following function in looping.

def answer(q, memory):
    close_world(myonto)
    print(something, end='...')  # OK
    if in the problematical case:
        sync_reasoner(debug=1)  # try to print the information
    else:
        sync_reasoner(debug=0)
    wtf()    # print('wtf') to check but print nothing
    a = q(memory)  # it seems to be called, successfully, but no return.
    print(a)  # nothing printed
    return q(memory) # try to call it again, nothing happened

q is in other file, and I print the answer in the body of q before return.

More then that, when it appears, in rest looping, it always appears; it appears not in all "problematical cases". I tried to catch the exception, but get nothing. I only had the debug information
* Owlready2 * Running HermiT...
    java -Xmx2000M -cp /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/owlready2/hermit:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/owlready2/hermit/HermiT.jar org.semanticweb.HermiT.cli.CommandLine -c -O -D -I file:////var/folders/md/8kgtqqz12j94hbcvhqz0w7gw0000gp/T/tmpyp9vbdqx
print the result called in the body of q.

Before that, If it succeed, I got debug information as follows.
-- something...* Owlready2 * Running HermiT...
    java -Xmx2000M -cp /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/owlready2/hermit:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/owlready2/hermit/HermiT.jar org.semanticweb.HermiT.cli.CommandLine -c -O -D -I file:////var/folders/md/8kgtqqz12j94hbcvhqz0w7gw0000gp/T/tmpjg4knkf4
* Owlready2 * HermiT took 0.7784318923950195 seconds
* Owlready * Reparenting gimbiseo.Sun: {owl.Thing, gimbiseo.Star} => {gimbiseo.Star}
* Owlready * Reparenting gimbiseo.Earth: {owl.Thing, gimbiseo.Star} => {gimbiseo.Star}
* Owlready * (NB: only changes on entities loaded in Python are shown, other changes are done but not listed)
=*= wtf =*=

Finally, If I commented close_world() or sync_reasoner(), the problem would disappear.


Currently, I use try-clause
try:
        sync_reasoner(debug=0)
    except Exception as e:
        print(e, end=' ')

I seems that it shrew error, but no message. But if it threw error, why the q(memory) was called, while wtf() not.