Translator z XTTML do R2ML

Kod translatora znajduje się w pliku: xttml2r2ml.xml

Konwersji dokonywałem programem oxygene. Należy utworzyć sobie schemat konwertowania przy użyciu powyższego pliku.

Poniżej przedstawiam efekt działania translatora na przykładzie.

Plik wejściowy:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xtttorif.xsl"?>
<hml>
<xtt>
 <xtt_table id="xtt_1">
  <schema>
	 <independent>
	  <attref ref="att_0"/>	  
	 </independent>
	 <dependent>
	  <attref ref="att_1"/>
	 </dependent>
  </schema>
  <rule id="rul_1">
	 <condition>
	  <logop name="in">
	   <attref ref="att_0"/>
	   <domain>
	    <range from="1" to="5"/>
	    <value>8</value>
	   </domain>
	  </logop>
	 </condition>
	 <decision>
	  <modop name="assign">
	   <attref ref="att_1"/>
	   <evalop name="add">
	    <attref ref="att_0"/>
	    <domain>
		   <value>1</value>
	    </domain>
	   </evalop>
	  </modop>
	  <modop name="assign">
	   <attref ref="att_1"/>
	   <evalop name="add">
	    <domain>
		   <value>5</value>
	    </domain>
	    <evalop name="sin">
		   <attref ref="att_0"/>
	    </evalop>
	   </evalop>
	  </modop>
	 </decision>
	 <link xtt="xtt_1"/>
  </rule>
 </xtt_table>
</xtt>
</hml>

plik wyjściowy:

<?xml version="1.0" encoding="UTF-8"?>
<r2ml:RuleBase xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:dc="http://purl.org/dc/elements/1.1/"
               xmlns:r2mlv="http://www.rewerse.net/I1/2006/R2ML/R2MLV"
               xmlns:r2ml="http://www.rewerse.net/I1/2006/R2ML"
               xmlns:soap="http://www.w3.org/2001/12/soap-envelope">
   <r2mlv:Vocabulary>
      <r2mlv:Class r2mlv:ID="xtt_1">
         <r2mlv:Attribute r2mlv:ID="att_0"/>
         <r2mlv:Attribute r2mlv:ID="att_1"/>
      </r2mlv:Class>
   </r2mlv:Vocabulary>
   <r2ml:ProductionRuleSet>
      <r2ml:ProductionRule r2ml:ruleID="rul_1">
         <r2ml:conditions>
            <r2ml:qf.Disjunction>
               <r2ml:qf.Conjunction>
                  <r2ml:DatatypePredicateAtom r2ml:datatypePredicateID="swrlb:greaterThan">
                     <r2ml:dataArguments>
                        <r2ml:AttributeFunctionTerm r2ml:attributeID="att_0">
                           <r2ml:contextArgument>
                              <r2ml:ObjectVariable r2ml:name="xtt_1" r2ml:classID="xtt_1"/>
                           </r2ml:contextArgument>
                        </r2ml:AttributeFunctionTerm>
                        <r2ml:TypedLiteral r2ml:datatypeID="xs:integer" r2ml:lexicalValue="1"/>
                     </r2ml:dataArguments>
                  </r2ml:DatatypePredicateAtom>
                  <r2ml:DatatypePredicateAtom r2ml:datatypePredicateID="swrlb:lessThan">
                     <r2ml:dataArguments>
                        <r2ml:AttributeFunctionTerm r2ml:attributeID="att_0">
                           <r2ml:contextArgument>
                              <r2ml:ObjectVariable r2ml:name="xtt_1" r2ml:classID="xtt_1"/>
                           </r2ml:contextArgument>
                        </r2ml:AttributeFunctionTerm>
                        <r2ml:TypedLiteral r2ml:datatypeID="xs:integer" r2ml:lexicalValue="5"/>
                     </r2ml:dataArguments>
                  </r2ml:DatatypePredicateAtom>
               </r2ml:qf.Conjunction>
               <r2ml:DatatypePredicateAtom r2ml:datatypePredicateID="swrlb:equal">
                  <r2ml:dataArguments>
                     <r2ml:AttributeFunctionTerm r2ml:attributeID="att_0">
                        <r2ml:contextArgument>
                           <r2ml:ObjectVariable r2ml:name="xtt_1" r2ml:classID="xtt_1"/>
                        </r2ml:contextArgument>
                     </r2ml:AttributeFunctionTerm>
                     <r2ml:TypedLiteral r2ml:datatypeID="xs:integer" r2ml:lexicalValue="8"/>
                  </r2ml:dataArguments>
               </r2ml:DatatypePredicateAtom>
            </r2ml:qf.Disjunction>
         </r2ml:conditions>
         <r2ml:producedAction>
            <r2ml:AssignActionExpression>
               <r2ml:contextArgument>
                  <r2ml:ObjectVariable r2ml:name="xtt_1" r2ml:classID="xtt_1"/>
               </r2ml:contextArgument>
               <r2ml:value>
                  <r2ml:TypedLiteral r2ml:datatypeID="xs:integer" r2ml:lexicalValue="add att_0 1"/>
               </r2ml:value>
            </r2ml:AssignActionExpression>
            <r2ml:AssignActionExpression>
               <r2ml:contextArgument>
                  <r2ml:ObjectVariable r2ml:name="xtt_1" r2ml:classID="xtt_1"/>
               </r2ml:contextArgument>
               <r2ml:value>
                  <r2ml:TypedLiteral r2ml:datatypeID="xs:integer" r2ml:lexicalValue="add 5 sin att_0"/>
               </r2ml:value>
            </r2ml:AssignActionExpression>
         </r2ml:producedAction>
      </r2ml:ProductionRule>
   </r2ml:ProductionRuleSet>
</r2ml:RuleBase>
pl/miw/miw08_xtt_r2ml/translator.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
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