Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
hekate:heart_howto [2011/06/15 16:27]
kkr
hekate:heart_howto [2012/05/14 13:51]
esimon
Line 134: Line 134:
 ==== Protocol commands ==== ==== Protocol commands ====
   - **[hello, +client_name].** - welcome message that client sends to HeaRT in order to obtain information about version of the protocol implemented on the server, and functionality offered by the protocol.\\ As a result the client gets <​code>​[true,​[heart,​hello,​1.0,​5,​[]]]</​code>​   - **[hello, +client_name].** - welcome message that client sends to HeaRT in order to obtain information about version of the protocol implemented on the server, and functionality offered by the protocol.\\ As a result the client gets <​code>​[true,​[heart,​hello,​1.0,​5,​[]]]</​code>​
-  - **[model, getlist].** - returns list of all models (with users' names that own them) that are store in HeaRT storage area.\\ As a result of the the client gets following answer <​code>​[true,​ [[username1,modelname1],[username1,​modelname2],​ [username2, ​modelname3]]]</​code>​ If there is no models in the storage area following answer is returned: <​code>​[true,​[]]</​code>​. If there are errors during reading a model list, following message is returned: <​code>​[false,​]</​code>​[false,'​Error occured while reading a model list'​]</​code>​ +  - **[model, getlist].** - returns list of all models (with users' names that own them) that are store in HeaRT storage area.\\ As a result of the the client gets following answer <​code>​[true,​ [[modelname1,​username1],[modelname2,username1], [ modelname3,username2]]]</​code>​ If there is no models in the storage area following answer is returned: <​code>​[true,​[]]</​code>​. If there are errors during reading a model list, following message is returned: <​code>​[false,​]</​code>​[false,'​Error occured while reading a model list'​]</​code>​ 
-  - **[model, get, +format, +modelname, +username, [+parts]].** - returns a model in the given format specified by modelname and username. The parts is a list defining which parts of model should be send in the responce. The following values are permitted: **[all]** - all parts, **[atrs]** all attributes, **[tpes]** - all types, **[tbls]** - all tables, **[clbs]** - all callbacks, **[atr,​id]** - attribute with given id, **[tpe,​id]** - type with given id, **[tbl,​id]** - table with given id, **[clb,​id]** - callback with given id. \\ In example, command:<​code>​[model,​ get, hml, +modelname, +username, [[atrs], [tpes], [tbl,​t]]].</​code>​get the all the attributes and types and one table with id ''​t''​ in HML format. \\ As a result client gets following answer: <​code>​[true,'​MODEL'​]</​code>​ where MODEL is the requested model or part of it. \\ If there is no requested model or user, follwing answer is sent: <​code>​[false,​ 'Model or username does not exist.'​]</​code>​+  - **[model, get, +format, +modelname, +username, ​+[+parts]].** - returns a model in the given format specified by modelname and username. The parts is a list defining which parts of model should be send in the responce. The following values are permitted: **[all]** - all parts, **[atrs]** all attributes, **[tpes]** - all types, **[tbls]** - all tables, **[clbs]** - all callbacks, **[atr,​id]** - attribute with given id, **[tpe,​id]** - type with given id, **[tbl,​id]** - table with given id, **[clb,​id]** - callback with given id. \\ In example, command:<​code>​[model,​ get, hml, +modelname, +username, [[atrs], [tpes], [tbl,​t]]].</​code>​get the all the attributes and types and one table with id ''​t''​ in HML format. ​The Heart accepts only:<​code>​[model,​ get, hmr, +modelname, +username, [[all]]]</​code>​\\ As a result client gets following answer: <​code>​[true,'​MODEL'​]</​code>​ where MODEL is the requested model or part of it. \\ If there is no requested model or user, follwing answer is sent: <​code>​[false,​ 'Model or username does not exist.'​]</​code>​
   - **[model,​exists,​+modelname,​ +username].** - checks if a given modelname that belongs to username is present in HeaRT storage area. If it is stored by the interpreter,​ following answer is sent to the client: <​code>​[true,​true]</​code>​ If there is no such file <​code>​[true,​false]</​code>​ is sent back. If there is an error during this procedure, following error message is sent to the client: <​code>​[false,'​Error while checking file existence'​]</​code>​   - **[model,​exists,​+modelname,​ +username].** - checks if a given modelname that belongs to username is present in HeaRT storage area. If it is stored by the interpreter,​ following answer is sent to the client: <​code>​[true,​true]</​code>​ If there is no such file <​code>​[true,​false]</​code>​ is sent back. If there is an error during this procedure, following error message is sent to the client: <​code>​[false,'​Error while checking file existence'​]</​code>​
-  - **[model, add, hmr, +modelname, +username, +'MODEL' ]**. - adds new model to HeaRT storage area, overriding any existing models of the sam ename.\\ If adding succeed, <​code>​[true]</​code>​ is returned. In case of an error following error message is sent to the client:<​code>​[false,'​Error ​while saving model.'​]</​code>​+  - **[model, add, +format, +modelname, +username, +'CONTENT_OF_THE_MODEL_IN_SPECIFIED_FORMAT' ]**. - adds new model to the server ​storage area, overriding any existing models of the sam ename.\\ If adding succeed, <​code>​[true]</​code>​ is returned. In case of an error following error message is sent to the client:<​code>​[false,'​Error ​message.'​]</​code>​
   - **[model,​remove,​ +modelname, +username].** - removes a model specified by modelname and username. After successful deletion fo the model <​code>​[true]</​code>​ is returned. In case of an error, following error message is sent back to the client<​code>​[false,'​Error while deleting model.'​]</​code>​   - **[model,​remove,​ +modelname, +username].** - removes a model specified by modelname and username. After successful deletion fo the model <​code>​[true]</​code>​ is returned. In case of an error, following error message is sent back to the client<​code>​[false,'​Error while deleting model.'​]</​code>​
   - **[model,​run,​ +modelname, +username, +{ddi | gdi | tdi | foi}, +tables, +{statename | statedef} ].** - runs inference process for the specified by specified model in one of the four modes, ddi, gdi, tdi or foi for given tables (schemas) - (see [[gox/3]] for details). State from which the inference should start can be either a name of the state that is located in HMR file, or a full definition of the state. The full definition of the state (statedef) should look as follows: <​code>​[[attribute_name1,​ value],​[attribute_name2,​ value] ... ]</​code>​ If the inference process succeed, the following answer is sent back to the client:<​code>​[true,​system_state,​ system_trajectory]</​code>​ The system_state is final state of the system defined as statedef. The system trajectory is a list of rules that were fired in the form of <​code>​[schema_name,​rule_id,​schema_name,​ rule_id, ...]</​code>​ If there is an error during this procedure, the following error message will be sent back to the user: <​code>​[false,'​Error occurred while running model'​]</​code>​   - **[model,​run,​ +modelname, +username, +{ddi | gdi | tdi | foi}, +tables, +{statename | statedef} ].** - runs inference process for the specified by specified model in one of the four modes, ddi, gdi, tdi or foi for given tables (schemas) - (see [[gox/3]] for details). State from which the inference should start can be either a name of the state that is located in HMR file, or a full definition of the state. The full definition of the state (statedef) should look as follows: <​code>​[[attribute_name1,​ value],​[attribute_name2,​ value] ... ]</​code>​ If the inference process succeed, the following answer is sent back to the client:<​code>​[true,​system_state,​ system_trajectory]</​code>​ The system_state is final state of the system defined as statedef. The system trajectory is a list of rules that were fired in the form of <​code>​[schema_name,​rule_id,​schema_name,​ rule_id, ...]</​code>​ If there is an error during this procedure, the following error message will be sent back to the user: <​code>​[false,'​Error occurred while running model'​]</​code>​
Line 151: Line 151:
  
 ==== Protocol examples ==== ==== Protocol examples ====
-  - Adding a model <​code>​ [model,​add,'​MyName','​Username','​xtype [ name: week_days, base: symbolic, ordered: yes, domain: [moday,​tuesday],​ desc: \'This is only one definition\'​].'​]. </​code>​ +  - Adding a model in hmr format ​<​code>​ [model,add,hml,'​MyName','​Username','​xtype [ name: week_days, base: symbolic, ordered: yes, domain: [moday,​tuesday],​ desc: \'This is only one definition\'​].'​]. </​code>​ 
-  - Getting a model <​code>​ [model,​get,'​MyName','​Username'​].</​code>​As a result following message should be returned:<​code>​[true,​ [xtype[name:​week_days,​ base:​symbolic,​ ordered:​yes,​ domain:​[moday,​ tuesday], desc:'​This is only one definition'​].]]</​code>​ +  - Getting a whole model in hmr format ​<​code>​ [model,get,hmr, '​MyName','​Username'​, [[all]]].</​code>​As a result following message should be returned:<​code>​[true,​ [xtype[name:​week_days,​ base:​symbolic,​ ordered:​yes,​ domain:​[moday,​ tuesday], desc:'​This is only one definition'​].]]</​code>​ 
-  - Getting a list of all models stored by the server: <​code>​ [model,​getlist].</​code>​ Folling answer can be returned:<​code>​[true,​ [[PHP, hqedmodel0][PHP, temostat], [PHPTermostat2], [PHP, therm-rt], [Username, ​MyName], [XTTd, Termostat1]]]</​code>​+  - Getting all the atrributes and types in hml format <​code>​[model,​get,​hml,​ '​MyName','​Username',​ [[atrs], [tpes]]]</​code>​ 
 +  - Getting a two attribute with IDs ''​att_1'',​ ''​att_2''​ and all the callbacks in the hmr format: <​code>​[model,​get,​hmr,​ '​MyName','​Username',​ [[clbs], [atr, atr_1], [atr, atr_2]]]</​code>​ 
 +  - Getting a list of all models stored by the server: <​code>​ [model,​getlist].</​code>​ Folling answer can be returned:<​code>​[true,​ [[hqedmodel0,​ PHP], [temostatPHP], [Termostat2, ​PHP][therm-rt, PHP], [MyName, Username], [Termostat1, XTTd]]]</​code>​
   - Deleting a model: <​code>​ [model,​remove,​ '​MyName','​Username'​].</​code>​   - Deleting a model: <​code>​ [model,​remove,​ '​MyName','​Username'​].</​code>​
   - Running a model <​code>​ [model,​run,'​temostat','​PHP',​ddi,​ [ms,dt], s1].</​code>​This command will run a Data-Driven inference from state //s1// on the model //​temostat//​ belonging to PHP user. Following return message can be sent by the server:<​code>​[true,​ [[day, 3.0], [hour, 3.0], [month, [2.0]], [season, 3.0], [today, 1.0], [operation, 2.0], [thermostat_settings,​ 16.0]], [ms, 4, dt, 1, th, 3, os, 7]]</​code>​ Instead of state name, clinet can send a full state definition over the protocol:<​code>​ [model,​run,'​MyName','​Username',​ddi,​ [ms,​dt,​th,​os],​ [ [day,​monday],​ [hour,13], [month, january] ] ].</​code> ​   - Running a model <​code>​ [model,​run,'​temostat','​PHP',​ddi,​ [ms,dt], s1].</​code>​This command will run a Data-Driven inference from state //s1// on the model //​temostat//​ belonging to PHP user. Following return message can be sent by the server:<​code>​[true,​ [[day, 3.0], [hour, 3.0], [month, [2.0]], [season, 3.0], [today, 1.0], [operation, 2.0], [thermostat_settings,​ 16.0]], [ms, 4, dt, 1, th, 3, os, 7]]</​code>​ Instead of state name, clinet can send a full state definition over the protocol:<​code>​ [model,​run,'​MyName','​Username',​ddi,​ [ms,​dt,​th,​os],​ [ [day,​monday],​ [hour,13], [month, january] ] ].</​code> ​
hekate/heart_howto.txt · Last modified: 2019/06/27 15:49 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0