Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
hekate:hekate_markup_language [2009/03/25 11:01] gjn |
hekate:hekate_markup_language [2019/06/27 15:49] (current) |
| |
====== Hekate Markup Language ====== | ====== Hekate Markup Language ====== |
| |
The Hekate Markup Language (HML) is based on the [[hekatedev:attributive language]], [[hekatedev:xtt development]] and [[hekatedev:ard development]] concepts. | The //Hekate Markup Language (HML)// is provided for the machine readable XML serialization of the HeKatE rule base described in a human-readable [[HMR]] format. |
There are the folowing subsets of the Hekate Markup Language defined: | |
* ''attml'' -- Attribute Markup Language | The rules are formalized with the use of the [[hekate:ALSVFD]] logic |
* ''ardml'' -- Attribute Relationship Markup Language | and [[hekate:XTT2]] rules |
* ''xttml'' -- Rule Markup Language (not ready for deployment yet). | prototyped with the [[hekate:ARDplus]] method. |
| |
| There are the following subsets of the HeKatE Markup Language defined: |
| * ''attml'' -- Attribute Markup Language for describing rule [[hekate:attributes]] |
| * ''ardml'' -- Attribute Relationship Markup Language for the [[hekate:ARDplus]] prototype |
| * ''xttml'' -- XTT2 Rule Markup Language for the [[hekate:XTT2]] structured rule representation |
| |
The languages can be used according to the following scenarios: | The sublanguages can be used according to the following scenarios: |
- ''attml'' -- just attributes, nothing more | - ''attml'' -- only attribute definition, the minimalistic case |
- ''attml'' + ''ardml'' -- attributes and dependencies | - ''attml'' + ''ardml'' -- attributes and ARD dependencies |
- ''attml'' + ''ardml'' + ''xttml'' -- attributes, dependencies and rulesin XML :!: | - ''attml'' + ''ardml'' + ''xttml'' -- attributes, dependencies and XTT2 rules |
- ''attml'' + ''xttml'' -- attribute and rules, ARD process is skipped | - ''attml'' + ''xttml'' -- attributes and rules, (without the ARD prototype) |
| |
The big picture of a single HML application is as follows: | A HML application using all sublanguages is as follows: |
| |
<code xml> | <code xml> |
<hml> | <hml> |
<!-- attml starts here --> | <!-- attml starts here --> |
<type_set> | <types> |
... | ... |
</type_set> | </types> |
| |
<attribute_set> | <attributes> |
... | ... |
</attribute_set> | </attributes> |
<!-- attml ends here --> | <!-- attml ends here --> |
| |
<!-- ardml starts here --> | <!-- ardml starts here --> |
<property_set> | <properties> |
... | ... |
</property_set> | </properties> |
| |
<tph> | <tph> |
| |
<!-- xttml starts here --> | <!-- xttml starts here --> |
<xtt...TBD> | <xtt> |
... TBD | ... |
</xtt...TBD> | </xtt> |
<!-- xttml ends here --> | <!-- xttml ends here --> |
| |
| <!-- extra system state specification --> |
| <states> |
| </states> |
</hml> | </hml> |
</code> | </code> |
| |
| The current version is referred to as //HML2// |
| (the first one is [[HML1]], see below). |
| |
| ===== HeKatE markup history===== |
| |
| The markup for the various knowledge representations now present in HeKatE has been evolving. |
| * 2004 - first markup for XTT in GJN PhD -> XTTML0 |
| * 2007 - first markup for ARD+ in VARDA |
| * 2007 - second version of markup for XTT in early versions of HQEd -> XTTML |
| * 2007 - third version of markup for XTT in HQEd M5_* -> XTTML2 |
| * 2008 - first version markup proposal for HeKatE, ARD+, XTT+ -> [[HML1]]: ATTML1, ARDML1, XTTML3 (proposal for XTT+, partially supported by design tools) |
| * 2009 - second version of HML, ARD+ XTT2 -> HML2: ATTML2, ARDML2, XTTML4 (supported by HQEd M6_* from 05.2009) |
| |
| |
| ===== HML syntax ===== |
| |
| HeKatE markup language DTD: (for HML2). |
| |
===== DTD ===== | For syntax test purposes there is an example XML file:{{:hekate:hml-test-hekate_case_thermostat.xml|}} |
| A minimalistic file is: {{:hekate:hml-test-min.xml}} |
| |
Hekate markup language DTD: {{hml.dtd}}. | //(Note: the above files are versioned in the HaDEs CVS repo in the [[HatHoR]] module.)// |
For sytax test purposes there is example XML file: {{hml-test.xml}} (its semantics does not make any sense though, for syntax testing only). | |
| |
Important elements are indexed wit an attribute ''id''. | Important elements are indexed with an attribute ''id''. |
''id'' value has to be unique (enforced by DTD) and should start with (depending on particular element): | ''id'' value has to be unique (enforced by DTD) and should start with (depending on particular element): |
* types: ''id="tpe_..."'' | * types: ''id="tpe_..."'' |
* attributes: ''id="att_..."'' | * attributes: ''id="att_..."'' |
* properties: ''id="prp_..."'' | * properties: ''id="prp_..."'' |
* groups: ''id="grp_..."'' | * type groups: ''id="tgr_..."'' |
* dependencies: ''id="tra_..."'' | * attribute groups: ''id="agr_..."'' |
* transformations: ''id="dep_..."'' | * dependencies: ''id="dep_..."'' |
| * ARD history (TPH): ''id="hst_..."'' |
| //All id numbers start with 1// |
| |
An additional attribute (''id'') is introduced to guarantee that types, attributes, properties and groups can be uniquely referenced. | An additional attribute (''id'') is introduced to guarantee that types, attributes, properties and groups can be uniquely referenced. |
Making attribute names unique identifiers prevents naming a group, or type, with the same name as the attribute, since unique identifiers are unique within entire document regardless of the element they regard to. | Making attribute names unique identifiers prevents naming a group, or type, with the same name as the attribute, since unique identifiers are unique within entire document regardless of the element they regard to. |
| |
You can validate any HML file using a validator i.e. xmlstarlet: | It is possible to validate a HML file using a validator i.e. ''xmlstarlet'': |
| |
xmlstarlet val -d hml.dtd hml-test.xml | xmlstarlet val -e -d hml.dtd hml-test.xml |
| |
===== ATTML ===== | ===== ATTML ===== |
| |
For information on attributes [[hekate:xtt#attributive_language|see here]], | For information on attributes [[hekate:attributes|see here]]. |
as well as the [[hekate:bib:hekate_bibliography|gjn2008ruleapps]] FIXME. | |
| |
<code xml> | <code xml> |
| |
<type_set> | <types> |
<type id="tpe_0" name="Temperature" base="numeric" length="5" scale="0"> | <type id="tpe_1" name="Temperature" base="numeric" length="5" scale="0"> |
<desc>represents a temperature</desc> | <desc>represents a temperature</desc> |
<domain type="ordered"> | <domain> |
<range from="1" to="5"/> | <value from="1" to="5"/> |
<value>7</value> | <value is="7" /> |
<range from="20" to="22"/> | <value from="20" to="22"/> |
<value>26</value> | <value is="26" /> |
<value>27</value> | <value is="27" /> |
</domain> | </domain> |
</type> | </type> |
</type_set> | <type id="tpe_2" name="Integer" base="numeric" length="5" scale="0"> |
| <desc>represents an integer number</desc> |
| <domain> |
| <value from="-10000" to="10000"/> |
| </domain> |
| </type> |
| </types> |
| |
<attribute_set> | <attributes> |
<att id="att_0" type="tpe_0" name="temp" abbrev="t1" value="single" class="ro"> | <attr id="att_1" type="tpe_1" name="temp" abbrev="t1" class="simple" comm="in"> |
<desc>input temperature from sensor number 1</desc> | <desc>input temperature from sensor number 1</desc> |
</att> | </attr> |
<att id="att_1" type="tpe_0" name="temp-aux" abbrev="t1a" value="multiple" class="ro"> | <attr id="att_2" type="tpe_1" name="temp-aux" abbrev="t1a" class="general" comm="in"> |
<desc>input temperature from sensor number 1, aux reading, including historic data</desc> | <desc>input temperature from sensor number 1, aux reading, including historic data</desc> |
</att> | </attr> |
| |
<group id="grp_0" name="sensors" abbrev="sns"> | <agroup id="grp_1" name="sensors" abbrev="sns"> |
<desc>temperatures from sensors</desc> | <desc>temperatures from sensors</desc> |
<attref ref="att_0"/> | |
<attref ref="att_1"/> | <attref ref="att_1"/> |
</group> | <attref ref="att_2"/> |
</attribute_set> | </agroup> |
| |
| </attributes> |
</code> | </code> |
| |
A group can always store multiple tuples (formed from the attributes within the group); it's non-atomic. | Both in the case of //types// and //attributes// groups can be specified. |
Atomic groups do not make any sense. | Example: types day, hour, month can form a type group //date//. |
In the example above there is an ordered set of tuples which are formed out of values of temp and corresponding temp-aux. | The same could apply to specific attributes. |
The group concept is similar to the relation concept in the relational Model. | In the example above there is set of attributes describing sensor readings formed out of values of temp and corresponding temp-aux. |
Attributes in a group are //ordered//. | Attributes in groups and types are //ordered//. |
--- //[[wojnicki@agh.edu.pl|Igor Wojnicki]] 2008/02/14 21:51// | |
| |
''att'' tag, ''class'' attribute values: //ro,rw,wo,state//, legacy values //input,output,middle// | |
| |
| |
**question**: where to put #digitis, #decimal point digits for numeric values?\\ | |
**answer**: length=#of digits, scale=#of digits after the decimal point | |
| |
| |
===== ARDML ===== | ===== ARDML ===== |
For ARD see [[hekate:ardplus]] FIXME | For ARD see [[hekate:ardplus]] |
and | and |
[[hekate:bib:hekate_bibliography#gjn2008flairs-ardformal]] | [[hekate:bib:hekate_bibliography#gjn2008flairs-ardformal]] |
| |
<hml> | <hml> |
<type_set> | <types> |
... | ... |
</type_set> | </types> |
| |
<attribute_set> | <attributes> |
<att name="Thermostat" id="att_0"...> | <attr name="Thermostat" id="att_0"/> |
... | <attr name="Time" ... /> |
</att> | </attributes> |
<att name="Time" ...> | |
... | |
</att> | |
</attribute_set> | |
| |
<property_set> | <properties> |
<property id="prp_1"> | <property id="prp_1"> |
<attref ref="att_0"/> | <attref ref="att_0"/> |
<attref ref="att_0"/> | <attref ref="att_0"/> |
</property> | </property> |
</property_set> | </properties> |
| |
<tph> | <tph> |
<trans id="tra_01" src="prp_1" dst="prp_2"/> | <hist id="hst_01" src="prp_1" dst="prp_2"/> |
<trans id="tra_02" src="prp_2" dst="prp_3"/> | <hist id="hst_02" src="prp_2" dst="prp_3"/> |
<trans id="tra_03" src="prp_2" dst="prp_4"/> | <hist id="hst_03" src="prp_2" dst="prp_4"/> |
<trans id="tra_04" src="prp_4" dst="prp_5"/> | <hist id="hst_04" src="prp_4" dst="prp_5"/> |
</tph> | </tph> |
| |
<ard> | <ard> |
<dep id="dep_01" independent="prp_1" dependent="prp_2"/> | <dep id="dep_01" independent="prp_1" dependent="prp_2"/> |
<dep id="dep_01" independent="prp_2" dependent="prp_3"/> | <dep id="dep_02" independent="prp_2" dependent="prp_3"/> |
<dep id="dep_01" independent="prp_3" dependent="prp_4"/> | <dep id="dep_03" independent="prp_3" dependent="prp_4"/> |
<dep id="dep_01" independent="prp_2" dependent="prp_4"/> | <dep id="dep_04" independent="prp_2" dependent="prp_4"/> |
</ard> | </ard> |
| |
... | ... |
</hml> | </hml> |
| |
</code> | </code> |
| |
==== Defining Properties ==== | ==== Defining ARD+ Properties ==== |
| |
Basic syntax: | Basic syntax: |
<code xml> | <code xml> |
<property_set> | <properties> |
<property id="prp_1"> | <property id="prp_1"> |
<attref ref="att_0"/> | <attref ref="att_0"/> |
<attref ref="att_2"/> | <attref ref="att_2"/> |
</property> | </property> |
</property_set> | </properties> |
</code> | </code> |
| |
* Properties are defined in ''<property_set>...</property_set>'' section. This section must contain all properties which are being used in an ARD diagram. | * Properties are defined in ''<properties>...</properties>'' section. This section must contain all properties which are being used in an ARD diagram. |
* Single property is defined by ''<property>'' tag | * Single property is defined by ''<property>'' tag |
* Single property contains any number of attributes. A list of attributes is defined by ''<attref>'' | * Single property contains any number of attributes. A list of attributes is defined by ''<attref>'' |
<code xml> | <code xml> |
<tph> | <tph> |
<trans src="prp_1" dst="prp_2"/> | <hist src="prp_1" dst="prp_2"/> |
<trans src="prp_2" dst="prp_3"/> | <hist src="prp_2" dst="prp_3"/> |
<trans src="prp_2" dst="prp_4"/> | <hist src="prp_2" dst="prp_4"/> |
... | ... |
<trans src="prp_n" dst="prp_m"/> | <hist src="prp_n" dst="prp_m"/> |
</tph> | </tph> |
</code> | </code> |
| |
| |
* TPH diagram is definied in ''<tph>...</tph>'' section. TPH diagram contains relationships called transformations. | * TPH diagram is definied in ''<tph>...</tph>'' section. TPH diagram contains relationships called transformations. |
* A transformation is defined with the ''<trans>'' tag and it describes a transformation between a source (''src'') and destination (''dst'') properties. | * A transformation is defined with the ''<hist>'' tags and it describes the development between a source (''src'') and destination (''dst'') properties. |
| |
==== Defining Dependencies ==== | ==== Defining Dependencies ==== |
**Basic syntax:** | Basic syntax: |
| |
<code xml> | <code xml> |
</code> | </code> |
| |
* Dependencies begin with the ''<ard>'' tag. The tag does not have attributes. Each dependence is defined with a a pair of properties: an ''independent'' and a ''dependent'' one. | * ARD dependencies begin with the ''<ard>'' tag. The tag does not have attributes. Each dependence is defined with a a pair of properties: an ''independent'' and a ''dependent'' one. |
| |
| |
| |
| |
===== XTTML ===== | ===== XTTML ===== |
| |
For information on the XTT itself [[hekate:xtt|see here]], | For information on the XTT itself [[hekate:xtt2|see here]]. |
for the XTTML [[hekate:xtt#rule_syntax|the rule syntax part]] is especially important. | |
| |
The following is just a proposal, subject to verification/discussion etc. | |
There is no visual data regarding spatial distribution of XTT tables in XTTML. | |
| |
<code xml> | <code xml> |
<xtt> | <xtt> |
<xtt_table id="xtt_1"> | <table id="tab_1" name="first"> |
<schema> | <schm> |
<independent> | <precondition> |
<attref ref="att_0"/> | <attref ref="att_1"/> |
</independent> | </precondition> |
<dependent> | <conclusion> |
<attref ref="att_1"/> | <attref ref="att_0"/> |
</dependent> | </conclusion> |
</schema> | </schm> |
<rule id="rul_1"> | <rule id="rul_1"> |
<condition> | <condition> |
<logop name="in"> | <relation name="in"> |
<attref ref="att_0"/> | <attref ref="att_0"/> |
<domain> | <set> |
<range from="1" to="5"/> | <value from="1" to="5"/> |
<value>8</value> | <value is="8"/> |
</domain> | </set> |
</logop> | </relation> |
</condition> | </condition> |
<decision> | <decision> |
<modop name="assign"> | <trans> |
<attref ref="att_1"/> | <attref ref="att_1"/> |
<evalop name="add"> | <expr name="add"> |
<attref ref="att_0"/> | <attref ref="att_1"/> |
<domain> | <value is="1"/> |
<value>1</value> | </expr> |
</domain> | </trans> |
</evalop> | <trans> |
</modop> | <attref ref="att_1"/> |
<modop name="assign"> | <expr name="add"> |
<attref ref="att_1"/> | <value is="5"/> |
<evalop name="add"> | <expr name="sin"> |
<domain> | <attref ref="att_0"/> |
<value>5</value> | </expr> |
</domain> | </expr> |
<evalop name="sin"> | </trans> |
<attref ref="att_0"/> | </decision> |
</evalop> | <link> |
</evalop> | <tabref ref="tab_1"/> |
</modop> | </link> |
</decision> | |
<link xtt="xtt_1"/> | |
</rule> | </rule> |
| </table> |
</xtt_table> | |
</xtt> | </xtt> |
</code> | </code> |
| |
An XTT diagram (''xtt'' element) consists of some number of XTT tables (''xtt_table'' element). | An XTT diagram (''xtt'' element) consists of some number of XTT tables (the ''table'' element). |
The above example can be read as: | The above example can be read as: |
| |
==== Schema ==== | ==== Schema ==== |
| |
Element ''schema'' describes dependent and independent attributes that are allowed to be used in a particular XTT table. | Element ''schem'' describes precondition and conclusion attributes that are allowed to be used in a particular XTT table. |
There are dependent (''dependent'') and independent (''independent'') attributes. | |
The schema is generated by the ARD->XTT transition algorithm directly from ARD. | The schema is generated by the ARD->XTT transition algorithm directly from ARD. |
| |
| |
A rule (''rule'') consists of a condition (''condition'') part and a decision part (''decision''). | A rule (''rule'') consists of a condition (''condition'') part and a decision part (''decision''). |
The condition part uses logical operators (''logop'') which evaluate as true or false. | The condition is composed of the [[hekate:ALSVFD]] formulas, that specify certain''relation''s between attribute values and given set of values. |
| |
The decision part applies a modification operator (''modpop'') in order to change the attribute value. | The decision part is decomposed into two parts: |
The value can be given explicitly (as numeric, or symbol) or it can calculated as a result of an evaluative operator ''evalop''. | * state ''trans''istion that can specify new state (attribute values), and |
| * external ''action'' to be executed; it is assumed it does //not// infulences the state in any way. |
| |
| Each rule can explicitly transef the inference to a next table (possibly also a rule). |
| |
| ===== State specification ===== |
| |
| Number of named system states can also be specified. |
| A single state is a vector of attribute values. |
| |
| <code xml> |
| <states> |
| <state id="sta_1" name="start"> |
| <attref ref="att_0"/> |
| <set> |
| <value from="1" to="5"/> |
| <value is="8"/> |
| </set> |
| <attref ref="att_1"/> |
| <set> |
| <value from="1" to="5"/> |
| </set> |
| </state> |
| </states> |
| </code> |
| |
Each rule can explicitly select the next table to be investigated if fired. | ===== HML implementation and support ===== |
| HML is used to serialize the knowledge in the HeKatE project in a machne redable format. |
| It is used to interchange knowledge between the tools forming the [[HaDEs]] framework. |
| |
===== Implementation ===== | HML syntax has been designed to: |
| * correspond to the logical system formulation with [[hekate:XTT2]] based on the [[hekate:ALSVfd]] logics, and |
| * match the syntax of //HMR// (the HeKatE Meta Representation) as supported by //[[hekate:HeART]]// - the HeKatE runTime environment. |
| |
* [[hekatedev:Hekate Markup Language Prolog]] -- implementation of a parser for HML (for developers only for now...). | |
| |