5.7 Semantic Mapping Elements

 < Day Day Up > 



5.7 Semantic Mapping Elements

Content markup describes the logical meaning of mathematical expressions. However, there are many situations in which it is useful to supplement the content markup with additional information. For example, you might want to include the presentation markup for an expression along with the content markup to specify that the expression be rendered in a special form that is different from the default rendering that would be used if the content markup alone were specified by itself.

Alternatively, you might want to include the representation of a mathematical expression in another computer language (such as TeX, C, or Mathematica) for use by particular applications that recognize those languages. This type of additional information is called a semantic mapping. MathML provides three content elements for specifying semantic mappings: semantics, annotation, and annotation-xml.

The semantics element is used as a container element for the MathML expression and all its semantic mappings. This element takes one or more child elements. The first element is the MathML expression for which semantic mappings are to be specified, and the subsequent arguments are the semantic mappings themselves. Each semantic mapping is enclosed in an annotation or annotation-xml element.

The semantics element accepts a definitionURL attribute you can use to specify a URL that contains the semantic mapping for the expression. The presence of the annotation and annotation-xml elements is optional since you can specify the semantic mapping completely by using only the definitionURL attribute.

The annotation element can contain any arbitrary character data. The format of the data is indicated using the value of the encoding attribute. For example, you could include the Mathematica command that corresponds to a given MathML expression by specifying encoding="mathematica" or you could give the TeX equivalent by specifying encoding="TeX".

The annotation-xml element also specifies a semantic mapping but with the additional constraint that its content must be a well-formed XML expression. The format of the mapping is specified using the encoding attribute. Typical values of this attribute are Presentation-MathML (for presentation markup), Content-MathML (for content markup), or OpenMath. The OpenMath consortium is a regulatory body that has developed a platform-independent and vendor-neutral standard for specifying the semantic meaning of mathematical expressions. The OpenMath specification of any mathematical expression is written in XML; hence, OpenMath statements are suitable for inclusion in an annotation-xml element.

The following example shows a content MathML expression with three semantic mappings specified:

     <semantics>       <apply>         <int/>           <bvar><ci>x</ci></bvar>           <lowlimit><cn>0</cn></lowlimit>           <uplimit><pi/></uplimit>           <apply><sin/><ci>x</ci></apply>       </apply>       <annotation-xml encoding="MathML-Presentation">         <mrow>           <munderover>           <mo>&int;</mo><mn>0</mn><mi>&pi;</mi>           </munderover>           <mrow>             <mrow><mi>sin</mi><mo>&ApplyFunction;</mo>             <mo>(</mo><mi>x</mi><mo>)</mo></mrow>             <mo>&InvisibleTimes;</mo><mrow>             <mo>&DifferentialD;</mo><mi>x</mi></mrow>           </mrow>        </mrow>       </annotation-xml>       <annotation encoding="TeX">         $$\int_0^\pi {\sin(x)dx}$$       </annotation>       <annotation encoding="Mathematica">         Integrate[Sin[x],{x,0,Pi}]       </annotation>     </semantics> 

Above, the presentation markup encodings are included in an annotation-xml element, while the TeX and Mathematica encodings are each included in an annotation element. The original expression, along with all three semantic mappings, is enclosed in a semantics element.



 < Day Day Up > 



The MathML Handbook
The MathML Handbook (Charles River Media Internet & Web Design)
ISBN: 1584502495
EAN: 2147483647
Year: 2003
Pages: 127
Authors: Pavi Sandhu

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net