EGOML Script

Overview

Any model can be saved as a EGOML document. The resulting file uses the extension “.egoml”1) The old extension “.xml” still supported for backward compatibility. .

Below, it is an example of a EGOML script used to load a map, calculate an image convolution and save the result:

<?xml version="1.0" standalone="yes" ?> <script> <property key="dff.date" value="Fri Apr 22 16:07:49 2011" /> <property key="dff.version" value="1.6.2.20101213" /> <property key="metadata.author" value="Dinamica Team" /> <property key="metadata.description" value="This is an example of map algebra expression written in Dinamica’s Calculate Map functor. This functor also performs contextual image operation, such as edge detection filters using nbConvol expression." /> <property key="metadata.organization" value="CSR / UFMG" /> <property key="metadata.showproperties" value="yes" /> <property key="metadata.title" value="Apply Edge Detection Convolution Easier" /> <functor name="LoadMap"> <property key="dff.functor.alias" value="input map" /> <inputport name="filename">"../../lesson1/amazon_states.tif"</inputport> <inputport name="loadAsSparse">.no</inputport> <inputport name="defineNullValue">.no</inputport> <inputport name="nullValue">0</inputport> <inputport name="suffixDigits">0</inputport> <inputport name="step">.none</inputport> <inputport name="workdir">.none</inputport> <outputport name="map" id="v1" /> </functor> <functor name="SaveMap"> <property key="dff.functor.alias" value="saved map" /> <inputport name="map" peerid="v2" /> <inputport name="filename">"output.ers"</inputport> <inputport name="suffixDigits">0</inputport> <inputport name="step">.none</inputport> <inputport name="useCompression">.yes</inputport> <inputport name="workdir">.none</inputport> </functor> <containerfunctor name="CalculateMap"> <property key="dff.container.collapsed" value="yes" /> <property key="dff.functor.alias" value="edge map" /> <property key="dff.functor.comment" value="Image convolution in Dinamica EGO" /> <inputport name="expression">[ nbConvol(i1, t1, 3, 3) ]</inputport> <inputport name="cellType">.int32</inputport> <inputport name="nullValue">0</inputport> <inputport name="resultIsSparse">.no</inputport> <outputport name="result" id="v2" /> <functor name="NumberMap"> <property key="dff.functor.alias" value="numberMap1215" /> <inputport name="map" peerid="v1" /> <inputport name="mapNumber">1</inputport> </functor> <functor name="NumberTable"> <property key="dff.functor.alias" value="numberTable1216" /> <inputport name="table">[ "Key" "Value", 1 1 .. 4 1, 5 -8, 6 1 .. 9 1 ]</inputport> <inputport name="tableNumber">1</inputport> </functor> </containerfunctor> </script>
EGOML/XML format used to be the only format that could accept incomplete scripts, scripts having functors whose input and output ports are neither bound nor edited. However, since version 2.0, it is possible to save and load an incomplete EGO Script as well. This feature is useful to save models in the first development stages.

Reference

The EGOML file is a XML document written according to the following DTD 2) A good introduction to the DTD description syntax can be found at http://skew.org/xml/tutorial. :

<?xml version="1.0"?> <!DOCTYPE script [ <!ELEMENT script (property*, functor*, containerfunctor*)> <!ELEMENT functor (property*, inputport*, outputport*)> <!ATTLIST functor name CDATA #REQUIRED> <!ELEMENT containerfunctor (property*, inputport*, outputport*, internalinputport*, internaloutputport*, functor*)> <!ATTLIST containerfunctor name CDATA #REQUIRED> <!ELEMENT property EMPTY> <!ATTLIST property key CDATA #REQUIRED value CDATA #REQUIRED> <!ELEMENT inputport (#PCDATA)> <!ATTLIST inputport name CDATA #REQUIRED peerid IDREFS #IMPLIED> <!ELEMENT outputport EMPTY> <!ATTLIST outputport name CDATA #REQUIRED id ID #REQUIRED> <!ELEMENT internalinputport EMPTY> <!ATTLIST internalinputport name CDATA #REQUIRED peerid IDREFS #IMPLIED> <!ELEMENT internaloutputport EMPTY> <!ATTLIST internaloutputport name CDATA #REQUIRED id ID #REQUIRED> ]>

The property keys are always fully expanded. There is no property alias as in the EGO Script format.