Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
xml_script [2011/04/22 19:14] hermann created |
xml_script [2013/07/30 23:59] (current) admin [Reference] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== XML Script ===== | + | ====== EGOML Script ====== |
- | Model can be saved as a XML document. The resulting file uses the extension ".xml". | + | ===== Overview ===== |
- | Using the XML format is possible to write incomplete script having functors whose input and output ports are not completely bound. This allows saving models in the first development stages. | + | 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.)). |
- | The XML document is written according to the following DTD ((A good introduction to the DTD description syntax can be found at http://skew.org/xml/tutorial.)): | + | Below, it is an example of a EGOML script used to load a map, calculate an image convolution and save the result: |
- | <code dtd> | + | <file xml apply-edge-detection-convolution.egoml> |
- | <?xml version="1.0"?> | + | <?xml version="1.0" standalone="yes" ?> |
- | <!DOCTYPE script [ | + | <script> |
- | <!ELEMENT script (property*, functor*, containerfunctor*)> | + | <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> | ||
+ | </file> | ||
- | <!ELEMENT functor (property*, inputport*, outputport*)> | + | <note tip> |
- | <!ATTLIST functor | + | 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. |
- | name CDATA #REQUIRED> | + | </note> |
- | <!ELEMENT containerfunctor (property*, inputport*, outputport*, internalinputport*, internaloutputport*, functor*)> | + | ===== Reference ===== |
- | <!ATTLIST containerfunctor | + | |
- | name CDATA #REQUIRED> | + | |
- | <!ELEMENT property EMPTY> | + | 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.)): |
- | <!ATTLIST property | + | |
- | key CDATA #REQUIRED | + | |
- | value CDATA #REQUIRED> | + | |
- | <!ELEMENT inputport (#PCDATA)> | + | <code dtd> |
- | <!ATTLIST inputport | + | <?xml version="1.0"?> |
- | name CDATA #REQUIRED | + | <!DOCTYPE script [ |
- | peerid IDREFS #IMPLIED> | + | <!ELEMENT script (property*, functor*, containerfunctor*)> |
- | <!ELEMENT outputport EMPTY> | + | |
- | <!ATTLIST outputport | + | <!ELEMENT functor (property*, inputport*, outputport*)> |
- | name CDATA #REQUIRED | + | <!ATTLIST functor |
- | id ID #REQUIRED> | + | name CDATA #REQUIRED> |
- | <!ELEMENT internalinputport EMPTY> | + | |
- | <!ATTLIST internalinputport | + | <!ELEMENT containerfunctor (property*, inputport*, outputport*, internalinputport*, internaloutputport*, functor*)> |
- | name CDATA #REQUIRED | + | <!ATTLIST containerfunctor |
- | peerid IDREFS #IMPLIED> | + | name CDATA #REQUIRED> |
- | <!ELEMENT internaloutputport EMPTY> | + | |
- | <!ATTLIST internaloutputport | + | <!ELEMENT property EMPTY> |
- | name CDATA #REQUIRED | + | <!ATTLIST property |
- | id ID #REQUIRED> | + | 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 resulting document is not formated using tabs, spaces or newlines. Those characters are written only when they are inside the definition content, not in the content boundaries. | + | The property keys are always fully expanded. There is no property alias as in the [[EGO Script]] format. |