HeaRTDroid

HeaRTDroid is a rule-based inference engine both for Android mobile devices, and desktop solutions

User Tools

Site Tools


pub:software:heartdroid:tutorials:haquna

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pub:software:heartdroid:tutorials:haquna [2017/01/09 10:59]
admin [HaQuNa]
pub:software:heartdroid:tutorials:haquna [2019/04/10 06:54]
Line 1: Line 1:
-====== HaQuNa ====== 
-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 [[https://​bitbucket.org/​sbobek/​heartdroid/​downloads|HeaRTDroid repository]] 
- 
-Most recent release can be downloaded from here {{:​pub:​software:​heartdroid:​tutorials:​haquna-1.0.6.jar|HaQuNa}} v. 1.0.6. 
- 
-You should have at least Java 7 to run HaQuNa. 
- 
- 
-===== Interactive mode ===== 
-To run HaQuNa in interactive mode go to the directory where you saved ''​haquna.jar''​ and type in console 
-<code bash> 
-java -cp haquna.jar:​. haquna.HaqunaMain 
-</​code>​ 
-===== Non-interactive mode===== 
-====Running scripts==== 
-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: 
-<code bash> 
-java -cp haquna.jar:​. haquna.HaqunaMain script.hqn ​ 
-</​code>​ 
- 
-If you wish to run a script, but after that open a console, run 
-<code bash> 
-java -cp haquna.jar:​. haquna.HaqunaMain --console (or -c) script.hqn 
-</​code>​ 
-====Running inference mode==== 
-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 
- 
-<code bash>​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 
-</​code>​ 
- 
- 
- 
- 
-===== Language specification ===== 
-====Loading model from file==== 
-<​code>​myModel = new Model('​model.hmr'​)</​code>​ 
-====Loading model from URL==== 
-<​code>​myModel = new Model('​http://​example.com/​model.hmr'​)</​code> ​ 
-====Saving model to file==== 
-<​code>​myModel.save('/​path/​to/​file/'​)</​code>​ 
-====Running inference====  ​ 
-    * With WorkingMemory object that stores initial state passed as a parameter:<​code>​myModel.run(wm,​ //optional parameters//​)</​code>​ 
-    * Without WorkingMemory (initial state has to be loaded by attributes'​ callbacks): <​code>​workinMemory = myModel.run(//​optional parameters//​)</​code>​ 
-    * Optional parameters may be arbitrary permutation of the following 
-      * Inference strategy: <​code>​inference=gdi|ddi|foi ​  // default ddi</​code>​ 
-      * Token passing: <​code>​tokens=on|off ​  // default on</​code>​ 
-      * Uncertainty handling with CF algebra: <​code>​uncertainty=on|off ​  // default on</​code>​ 
-      * Conflict resolution strategy: <​code>​conflict_resolution=first|last|all ​  // default first</​code>​ 
-      * List of tables to process: <​code>​tables=['​tableName1','​tableName2',​ ...] // mandatory only for foi mode</​code> ​ 
-    * Examples: 
-      * <​code>​myModel.run(wm,​ inference=gdi,​ tables=['​Table3'​])</​code>​ 
-      * <​code>​wm = myModel.run(inference=foi,​ tables=['​Table1','​Table2','​Table3'​])</​code>​ 
-====Running scripts==== 
-For details on running scripts see [[#​non-interactive_mode|Non-interactive mode]] ​ 
-<​code>​load('​script.hqn'​)</​code>​ 
-====Getters for model objects==== 
-  * List all the tables in XTT2 model: <​code>​ myModel.showTablesList() </​code>​ 
-  * List all attributes names form XTT2 mdoel: <​code>​ myModel.showAttributesList() </​code>​ 
-  * List all types from XTT2 model: <​code>​myModel.showTypesList()</​code>​ 
-  * Getting XTT2 table from a model: <​code>​myTab = myModel.getTableByName('​name'​) 
-myTab = myModel.getTableById('​id'​)</​code>​ 
-  * Getting attribute from a model: <​code>​myAttr = myModel.getAttributeByName('​name'​) 
-myAttr = myModel.getAttributeById('​id'​)</​code> ​ 
-  * Getting type from a model:<​code>​myType = myModel.getTypeByName('​name'​) 
-myType = myModel.getTypeById('​id'​)</​code>​ 
-====Getters for particular elements of XTT2 model==== 
-  * For Attribute objects: 
-    *<​code>​ myAttr.show()</​code>​ 
-    *<​code>​ myType = myAttr.getType()</​code> ​ 
-    *<​code>​ myCallback = myAttr.getCallback()</​code> ​ 
-  * For Type objects: <​code>​ myType.show()</​code>  ​ 
-  * For Table objects:<​code>​myTab.show() 
-myRule = myTab.getRuleByName('​name'​) 
-myRule = myTab.getRuleById('​id'​)</​code> ​ 
-  * For Rule objects:<​code>​myRule.show()</​code> ​ 
-  * For Callback objects: <​code>​ myCallback.show()</​code>  ​ 
-====Creating components==== 
-  * Types: <​code>​newType = new Type('​hmrCode'​)</​code>  ​ 
-  * Attributes: <​code>​newAttr = new Attribute('​hmrCode'​)</​code>  ​ 
-  * Tables: <​code>​newTab = new Table('​hmrCode'​);</​code>​ 
-  * Rules: <​code>​newRule= new Rule(<'​hmrCode'​);</​code> ​     ​ 
-====Modifying XTT2 model==== 
-Original model stays intact 
-  * Adding components: 
-    * Types: <​code>​newModel = oldModel.add(myType)</​code>​ 
-    * Attributes: <​code>​newModel = oldModel.add(myAttr)</​code>​ 
-    * Tables: <​code>​newModel = oldModel.add(myTable)</​code> ​     
-    * Rules: <​code>​newModel = oldModel.add(myRule)</​code>​ 
-  * Removing components: 
-    * Types: <​code>​newModel = oldModel.remove('​typeName'​)</​code>​ 
-    * Attribtues: <​code>​newModel = oldModel.remove('​attrName'​)</​code>​ 
-    * Tables: <​code>​newModel = oldModel.remove('​tabName'​)</​code>​ 
-    * Rules: <​code>​newModel = oldModel.remove('​ruleName'​)</​code> ​     
-====State management via Working Memory object==== 
-  * Creating Working Memory object: <​code>​wm = new WorkingMemory(myModel)</​code>​ 
-  * Getting all values of attributes stored by WM: <​code>​wm.showValueOf('​attrName'​)</​code>​ 
-  * Setting values of attributes stored in WM (the value after **#** represents a certainty factor assigned to the value): <​code>​wm.setValueOf('​attrName','​attrValue'​) 
-wm.setValueOf('​attrName','​attrValue#​cf'​)</​code>​ 
-  * Getting attribute value from a given point in history: <​code>​WM.showValueOf('​attrName',​ -1h)</​code>​ 
-  * Printing current state (current values of all attributes):​ <​code>​wm.showCurrentState()</​code>​ 
- 
- 
- 
  
pub/software/heartdroid/tutorials/haquna.txt ยท Last modified: 2019/04/10 06:54 (external edit)