#22 BC rules with nonexistent dependencies

release 0.5
closed-fixed
pyke (39)
5
2008-12-01
2008-11-24
No

I've run into an issue in using the knowledge engine to try and prove
non-existing facts from the database. This fails with an exception
such as the following:

Traceback (most recent call last):
File "test.py", line 7, in <module>
print engine.prove_1("test", "nonexistent", (), 1)
File "/usr/lib/python2.5/site-packages/pyke-0.5-py2.5.egg/pyke/
knowledge_engine.py", line 207, in prove_1
File "/usr/lib/python2.5/site-packages/pyke-0.5-py2.5.egg/pyke/
knowledge_engine.py", line 189, in gen
AttributeError: 'tuple' object has no attribute '__exit__'

Otherwise this would be not be such a huge issue, but the same problem
seems to make it impossible to define BC rules that reference facts
which may or may not be in the database. For example:

test.kfb
# commented out
#bar(123)

test_rules.krb:

test_rule
____use foo($x)
____when
________test.bar($x)

test.py:

from pyke import knowledge_engine
engine = knowledge_engine.engine()
engine.activate("test_rules")
engine.prove_1("test_rules", "foo", (), 1)

This test works when bar(123) is uncommented in the database, but
otherwise it fails with the same exception as shown above. I would
expect prove_1 to instead fail with CanNotProve.

Discussion

  • Bruce Frederiksen

    • milestone: --> release 0.5
    • status: open --> closed-fixed
     
  • Bruce Frederiksen

    Fixed in subversion rev 161. This fix will be incorporated into release 0.6.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks