Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
xml_script [2013/07/30 23:59] admin [Reference] |
xml_script [2026/07/22 20:27] (current) hermann |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Overview ===== | ===== Overview ===== | ||
| - | Any model can be saved as a EGOML document. The resulting file uses the extension ".egoml"((The old extension ".xml" still supported for backward compatibility.)). | + | Any model can be saved as an EGOML document. The resulting file uses the extension ".egoml" (the old extension ".xml" is still supported for backward compatibility). See [[basic_data_flow|Basic Data Flow]] for the execution model shared by EGOML and [[ego_script|EGO Script]]; this page covers the XML notation specifically. |
| - | Below, it is an example of a EGOML script used to load a map, calculate an image convolution and save the result: | + | The EGOML file is an XML document written according to the following DTD; see [[https://www.w3schools.com/xml/xml_dtd_intro.asp|w3schools' DTD tutorial]] for a good introduction to the DTD description syntax: |
| - | <file xml apply-edge-detection-convolution.egoml> | + | <code dtd> |
| + | <?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|containerfunctor)*)> | ||
| + | <!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> | ||
| + | ]> | ||
| + | </code> | ||
| + | |||
| + | ==== Elements ==== | ||
| + | |||
| + | Each element in the DTD corresponds directly to a piece of the underlying functor graph described in [[basic_data_flow|Basic Data Flow]]: | ||
| + | |||
| + | * ''script'' is the model as a whole — the root element, holding the model's own properties plus every top-level functor and container. | ||
| + | * ''functor'' is a single functor call, identified by its ''name'' attribute (such as ''LoadMap''). It holds its own properties, its input ports, and its output ports. | ||
| + | * ''containerfunctor'' is a functor that also holds nested functors and containers — the same element type can nest inside itself, since containers can be placed inside other containers. | ||
| + | * ''property'' attaches metadata to whatever element contains it, as a ''key''/''value'' pair. Keys are always written fully expanded — there is no property alias as in the [[ego_script|EGO Script]] format. | ||
| + | * ''inputport'' and ''outputport'' are a functor's connection points. An ''outputport'' declares an ''id''; an ''inputport'' elsewhere in the document references that ''id'' through its own ''peerid'' attribute to form a connection — the XML equivalent of two functors sharing a variable name in EGO Script. | ||
| + | * ''internalinputport'' and ''internaloutputport'' work the same way, but connect a container to the functors nested inside it, rather than connecting two ordinary functors to each other. | ||
| + | |||
| + | The DTD defines no equivalent of EGO Script's abbreviated calculator syntax. Every functor in the Calculate family — ''CalculateMap'', ''CalculateLookupTableValues'', and the others — is represented the same way as any other container: its operands are connected through explicit ''NumberMap''/''NumberTable''/''NumberValue'' hook functors, as shown in the ''CalculateMap'' example below. See [[ego_script#calculator_functor_shorthand|Calculator functor shorthand]] for the two syntactic forms EGO Script provides for this same underlying structure. | ||
| + | |||
| + | ==== Example ==== | ||
| + | |||
| + | Below is an example of an EGOML script used to load a map, calculate an image convolution, and save the result: | ||
| + | |||
| + | <code xml> | ||
| <?xml version="1.0" standalone="yes" ?> | <?xml version="1.0" standalone="yes" ?> | ||
| <script> | <script> | ||
| - | <property key="dff.date" value="Fri Apr 22 16:07:49 2011" /> | + | <property key="dff.charset" value="UTF-8" /> |
| - | <property key="dff.version" value="1.6.2.20101213" /> | + | <property key="dff.date" value="2026-Jul-21 14:32:07" /> |
| - | <property key="metadata.author" value="Dinamica Team" /> | + | <property key="dff.version" value="8.12.0.20260626" /> |
| + | <property key="metadata.author" value="Dinamica EGO 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.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.organization" value="CSR / UFMG" /> | ||
| Line 18: | Line 73: | ||
| <property key="metadata.title" value="Apply Edge Detection Convolution Easier" /> | <property key="metadata.title" value="Apply Edge Detection Convolution Easier" /> | ||
| <functor name="LoadMap"> | <functor name="LoadMap"> | ||
| - | <property key="dff.functor.alias" value="input map" /> | + | <property key="dff.functor.alias" value="Input Map" /> |
| - | <inputport name="filename">"../../lesson1/amazon_states.tif"</inputport> | + | <inputport name="filename">"C:/Desenvolvimento/Centro-De-Sensoriamento-Remoto/lesson1/amazon_states.tif"</inputport> |
| - | <inputport name="loadAsSparse">.no</inputport> | + | <inputport name="nullValue">.none</inputport> |
| - | <inputport name="defineNullValue">.no</inputport> | + | <inputport name="storageMode">.default</inputport> |
| - | <inputport name="nullValue">0</inputport> | + | |
| <inputport name="suffixDigits">0</inputport> | <inputport name="suffixDigits">0</inputport> | ||
| + | <inputport name="firstWindowCoordinateX">.none</inputport> | ||
| + | <inputport name="firstWindowCoordinateY">.none</inputport> | ||
| + | <inputport name="secondWindowCoordinateX">.none</inputport> | ||
| + | <inputport name="secondWindowCoordinateY">.none</inputport> | ||
| <inputport name="step">.none</inputport> | <inputport name="step">.none</inputport> | ||
| <inputport name="workdir">.none</inputport> | <inputport name="workdir">.none</inputport> | ||
| <outputport name="map" id="v1" /> | <outputport name="map" id="v1" /> | ||
| + | </functor> | ||
| + | <functor name="LookupTable"> | ||
| + | <inputport name="constant">[ "Key" "Value", 1 1 .. 4 1, 5 -8, 6 1 .. 9 1 ]</inputport> | ||
| + | <outputport name="object" id="v2" /> | ||
| </functor> | </functor> | ||
| <functor name="SaveMap"> | <functor name="SaveMap"> | ||
| - | <property key="dff.functor.alias" value="saved map" /> | + | <inputport name="map" peerid="v3" /> |
| - | <inputport name="map" peerid="v2" /> | + | <inputport name="filename">"C:/Desenvolvimento/Centro-De-Sensoriamento-Remoto/dinamica/Release/output.ers"</inputport> |
| - | <inputport name="filename">"output.ers"</inputport> | + | |
| <inputport name="suffixDigits">0</inputport> | <inputport name="suffixDigits">0</inputport> | ||
| <inputport name="step">.none</inputport> | <inputport name="step">.none</inputport> | ||
| <inputport name="useCompression">.yes</inputport> | <inputport name="useCompression">.yes</inputport> | ||
| <inputport name="workdir">.none</inputport> | <inputport name="workdir">.none</inputport> | ||
| + | <inputport name="ignoreCostlySparseCategories">.yes</inputport> | ||
| </functor> | </functor> | ||
| <containerfunctor name="CalculateMap"> | <containerfunctor name="CalculateMap"> | ||
| - | <property key="dff.container.collapsed" value="yes" /> | + | <property key="dff.functor.alias" value="Edge Map" /> |
| - | <property key="dff.functor.alias" value="edge map" /> | + | |
| <property key="dff.functor.comment" value="Image convolution in Dinamica EGO" /> | <property key="dff.functor.comment" value="Image convolution in Dinamica EGO" /> | ||
| <inputport name="expression">[ nbConvol(i1, t1, 3, 3) ]</inputport> | <inputport name="expression">[ nbConvol(i1, t1, 3, 3) ]</inputport> | ||
| Line 45: | Line 106: | ||
| <inputport name="nullValue">0</inputport> | <inputport name="nullValue">0</inputport> | ||
| <inputport name="resultIsSparse">.no</inputport> | <inputport name="resultIsSparse">.no</inputport> | ||
| - | <outputport name="result" id="v2" /> | + | <inputport name="resultFormat">.none</inputport> |
| + | <outputport name="result" id="v3" /> | ||
| <functor name="NumberMap"> | <functor name="NumberMap"> | ||
| - | <property key="dff.functor.alias" value="numberMap1215" /> | ||
| <inputport name="map" peerid="v1" /> | <inputport name="map" peerid="v1" /> | ||
| <inputport name="mapNumber">1</inputport> | <inputport name="mapNumber">1</inputport> | ||
| </functor> | </functor> | ||
| <functor name="NumberTable"> | <functor name="NumberTable"> | ||
| - | <property key="dff.functor.alias" value="numberTable1216" /> | + | <inputport name="table" peerid="v2" /> |
| - | <inputport name="table">[ "Key" "Value", 1 1 .. 4 1, 5 -8, 6 1 .. 9 1 ]</inputport> | + | |
| <inputport name="tableNumber">1</inputport> | <inputport name="tableNumber">1</inputport> | ||
| </functor> | </functor> | ||
| </containerfunctor> | </containerfunctor> | ||
| </script> | </script> | ||
| - | </file> | + | </code> |
| - | <note tip> | + | The same model, expressed in EGO 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. | + | |
| - | </note> | + | |
| - | ===== Reference ===== | + | <code> |
| + | @charset = UTF-8 | ||
| + | @date = 2026-Jul-21 14:32:07 | ||
| + | @version = 8.12.0.20260626 | ||
| + | @author = Dinamica EGO Team | ||
| + | @description = 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. | ||
| + | @organization = CSR / UFMG | ||
| + | @showproperties = yes | ||
| + | @title = Apply Edge Detection Convolution Easier | ||
| + | Script {{ | ||
| + | inputMap := LoadMap "C:/Desenvolvimento/Centro-De-Sensoriamento-Remoto/lesson1/amazon_states.tif" .none .default 0 .none .none .none .none .none .none; | ||
| - | The EGOML file is a XML document written according to the following DTD ((A good introduction to the DTD description syntax can be found at http://skew.org/xml/tutorial.)): | + | lookupTable0 := LookupTable [ |
| + | "Key" "Value", | ||
| + | 1 1 .. 4 1, | ||
| + | 5 -8, | ||
| + | 6 1 .. 9 1 | ||
| + | ]; | ||
| - | <code dtd> | + | // Image convolution in Dinamica EGO |
| - | <?xml version="1.0"?> | + | edgeMap := # [ |
| - | <!DOCTYPE script [ | + | nbConvol(#inputMap, %lookupTable0, 3, 3) |
| - | <!ELEMENT script (property*, functor*, containerfunctor*)> | + | ] .int32 0 .no .none; |
| - | + | ||
| - | <!ELEMENT functor (property*, inputport*, outputport*)> | + | SaveMap edgeMap "C:/Desenvolvimento/Centro-De-Sensoriamento-Remoto/dinamica/Release/output.ers" 0 .none .yes .none .yes; |
| - | <!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> | + | |
| - | ]> | + | |
| </code> | </code> | ||
| - | |||
| - | The property keys are always fully expanded. There is no property alias as in the [[EGO Script]] format. | ||
| - | |||