Information
HeaRTDroid
Software
HeaRTDroid is a rule-based inference engine both for Android mobile devices, and desktop solutions
Information
HeaRTDroid
Software
HeaRTDroid Query Notation is a simple language that can be used in an interactive commandline shell to load, modify, run HMR+ models.
Source code can be downloaded from HeaRTDroid repository
Most recent release can be downloaded from here HaQuNa v. 1.0.7.
You should have at least Java 7 to run HaQuNa.
To run HaQuNa in interactive mode go to the directory where you saved haquna.jar
and type in console
java -cp haquna.jar:. haquna.HaqunaMain
You can run a script, which is a set of commands in HQN notation in non-interactive mode. To run a script that will printout the result to standard output run:
java -cp haquna.jar:. haquna.HaqunaMain script.hqn
If you wish to run a script, but after that open a console, run
java -cp haquna.jar:. haquna.HaqunaMain --console (or -c) script.hqn
HaQuNa allows you to run inference for selected models from bash. The result of the reasoning will be printed to standard output. The command-line options of HaQuNa are presented below
java -cp haquna.jar:. haquna.HaqunaMain --model model.hmr \ --tables ['Table1','Table2'] \ # mandatory only for foi --inference [ddi|gdi|foi] \ # optional, default = ddi --initial-state [att-name=value, att-name=value] \ # optional --conflict-resolution [all|last|first] \ # optional, default first --tokens [on|off] \ # optional, default off --uncertainty [on|off] # optional, default on
myModel = new Model('model.hmr')
myModel = new Model('http://example.com/model.hmr')
myModel.save('/path/to/file/')
myModel.run(wm, //optional parameters//)
workinMemory = myModel.run(//optional parameters//)
inference=gdi|ddi|foi // default ddi
tokens=on|off // default on
uncertainty=on|off // default on
conflict_resolution=first|last|all // default first
tables=['tableName1','tableName2', ...] // mandatory only for foi mode
myModel.run(wm, inference=gdi, tables=['Table3'])
wm = myModel.run(inference=foi, tables=['Table1','Table2','Table3'])
For details on running scripts see Non-interactive mode
load('script.hqn')
myModel.showTablesList()
myModel.showAttributesList()
myModel.showTypesList()
myTab = myModel.getTableByName('name') myTab = myModel.getTableById('id')
myAttr = myModel.getAttributeByName('name') myAttr = myModel.getAttributeById('id')
myType = myModel.getTypeByName('name') myType = myModel.getTypeById('id')
myAttr.show()
myType = myAttr.getType()
myCallback = myAttr.getCallback()
myType.show()
myTab.show() myRule = myTab.getRuleByName('name') myRule = myTab.getRuleById('id')
myRule.show()
myCallback.show()
newType = new Type('hmrCode')
newAttr = new Attribute('hmrCode')
newTab = new Table('hmrCode');
newRule= new Rule(<'hmrCode');
Original model stays intact
newModel = oldModel.add(myType)
newModel = oldModel.add(myAttr)
newModel = oldModel.add(myTable)
newModel = oldModel.add(myRule)
newModel = oldModel.remove('typeName')
newModel = oldModel.remove('attrName')
newModel = oldModel.remove('tabName')
newModel = oldModel.remove('ruleName')
wm = new WorkingMemory(myModel)
wm.showValueOf('attrName')
wm.setValueOf('attrName','attrValue') wm.setValueOf('attrName','attrValue#cf')
WM.showValueOf('attrName', -1h)
wm.showCurrentState()