I would like to use facts asserted by fc rules in another application (not Python). The input for another application is simple text file which structure reminds fact base (.kfb). in Pyke. Therefore I'm looking for the way how can I save asserted facts in the file, in other words I wanna write result of command engine.get_kb(__name__).dump_specific_facts() to the file. So far I only come up with solution when I add python statements in my fc rules, smth like this
foreach
eventlog.timelength($id, $time)
eventlog.averagetime($averagetime)
check $time > $averagetime
assert
eventlog.late($id,$time,$averagetime)
python import string
python s = 'late('+$id+','+ str($time) + ','+ str($averagetime)+')'
python f = open( "derivedfacts.pkl", "r+" )
python old = f.read()
python f.seek(0)
python f.write(s +"\n"+ old)
python f.close()
Are there any other ways? In current approach I write to file many excess facts.