Bill Naylor Stephen Watt
Ontario Research Center for Computer
Algebra
University of Western Ontario
London Ontario CANADA N6A
5B7
{bill,watt}@orcca.on.ca
semantics elements and using the
definitionURL attribute.
A ``semantics'' element has a number of children. The first child is
the element which is having semantic information attached to it. The
second and subsequent children must be either annotation-xml or
annotation elements.
In the first case it contains XML data which specifies the semantics
of the first child, for example a section of OpenMath. In the second
case it may be non-XML data for example a Maple command.
Example
The MathML segment
below attaches the meaning of the BesselJ symbol from the
specialFunctions content dictionary to the element <ci>J</ci>.
<semantics>
<ci>J</ci>
<annotation-xml encoding="OpenMath">
<OMS cd="specialFunctions" name="BesselJ"
xmlns="http://www.openmath.org/OpenMath"/>
</annotation-xml>
</semantics>
A ``definitionURL'' attribute may be used with the elements
csymbol, declare, semantics and any operator
element. We may set the definitionURL to point at a symbol in an
OpenMath content dictionary using the element csymbol, in the
following way:
If the new symbol we wish to define is denoted by
<mi>new</mi> and the OpenMath symbol is defined at the
URL http://www.openmath.org/cdName#newSymbol
then we could use the following XML fragment:
<csymbol encoding="OpenMath"
definitionURL="http://www.openmath.org/cdName#newSymbol">
<mi>new</mi>
</csymbol>
Example
The MathML element below could usefully be taken to have the same meaning as the BesselJ
symbol in the specialFunctions content dictionary.
<csymbol encoding="OpenMath"
definitionURL="http://www.openmath.org/specialFunctions#BesselJ">
<mi>J</mi>
</csymbol>
An OpenMath Content Dictionary specifies meanings for a
collection of names, such as the Bessel function J of the examples
above. In an OpenMath fragment, each symbol appearing indicates both
the name of the symbol and the content dictionary in which it
occurs. That is, in order to specify an OpenMath symbol (this will be
represented by an OMS element, with attributes set as follows) with
name symbol_name from a content dictionary called
cd_name, one could use the XML fragment:
<OMS name="symbol_name" cd="cd_name"/>In the most common use of a symbol (to represent the application of a function to a number of arguments) this would be enclosed in an
OMA element (standing for OpenMath Application), and the following
children would be its arguments in a specified order. We use this to
provide either an appropriate OpenMath XML fragment for a
semantics annotation or URI for a definitionURL attribute.
semantics elements. The semantics
elements could have an annotation part which referenced a symbol in
an OpenMath content dictionary thus endowing the element with semantic
meaning.
In the following example we replace a new element by the element
<m:semantics>, as was done in [9]. Assuming that the required
content dictionary (see Appendix [1]) were available
this element would be semantically meaningful.
Example Suppose we were to be given the following section of extended MathML, which contains the element <xm:BesselJ/>, undefined
in the standard MathML:
(we assume that m is the MathML namespace [7],
xsl is the namespace for the XSLT elements,
xm is a namespace which contains the names of the new elements
and om is the namespace containing the names of the OpenMath
elements).
<m:apply>
<xm:BesselJ/><m:cn>1</m:cn><m:cn type="rational">1<m:sep/>2</m:cn>
</m:apply>
If we apply an XSLT style sheet containing the following rule, then we
shall replace all applications of <xm:BesselJ/> with appropriate
<m:semantics> markup.
<xsl:template match="m:apply[m:BesselJ]">
<m:apply>
<m:semantics>
<m:ci><m:mo>J</m:mo></m:ci>
<m:annotation-xml encoding="OpenMath">
<om:OMS cd="specialFunctions" name="BesselJ"/>
</m:annotation-xml>
</m:semantics>
<xsl:apply-templates select="*[2]"/>
<xsl:apply-templates select="*[3]"/>
</m:apply>
</xsl:template>}
These ``templates'' are effectively re-write rules which transform the
input and, on application, may activate further re-write rules.
Assuming that there were templates available which copied through
(verbatim) <m:cn> elements, then this would transform the preceding
extended MathML into the semantically
meaningful element (assuming that the required content dictionary
see Appendix [1] was available):
<m:apply>
<m:semantics>
<m:ci><m:mo>J</m:mo></m:ci>
<m:annotation-xml encoding="OpenMath">
<om:OMS cd="specialFunctions" name="BesselJ"/>
</m:annotation-xml>
</m:semantics>
<m:cn>1</m:cn><m:cn type="rational">1<m:sep/>2</m:cn>
</m:apply>
We may have intended different behavior, for example, that the
presentation information should render as
<xsl:template match="m:apply[m:BesselJ]">
<m:apply>
<m:semantics>
<m:mrow>
<m:msub><m:mi>J</m:mi><xsl:apply-templates select="*[2]"/></m:msub>
<m:mfenced>
<xsl:apply-templates select="*[3]"/>
</m:mfenced>
</m:mrow>
<m:annotation-xml encoding="OpenMath">
<om:OMS cd="specialFunctions" name="BesselJ"/>
</m:annotation-xml>
</m:semantics>
<xsl:apply-templates select="*[2]"/>
<xsl:apply-templates select="*[3]"/>
</m:apply>
</xsl:template>
<m:apply> <xm:BesselJ/><m:cn>1</m:cn><m:cn type="rational">1<m:sep/>2</m:cn> </m:apply>We add semantics using the
definitionURL attribute in the
manner discussed earlier. Valid semantically meaningful code for this
example using this technique is:
<m:apply> <m:csymbol definitionURL="http://www.openmath.org/specialFunctions#BesselJ"/> <m:cn>1</m:cn><m:cn type="rational">1<m:sep/>2</m:cn> </m:apply>We could achieve this using the following style sheet:
<xsl:template match="m:apply[m:BesselJ]"> <m:csymbol definitionURL="http://www.openmath.org/specialFunctions#BesselJ"/> <xsl:apply-templates select="*[2]"/> <xsl:apply-templates select="*[3]"/> </xsl:template>We see that given a library of XSLT style sheets together with some resource which allows the storage of mathematical knowledge, for example a library of OpenMath Content Dictionaries, extension and indeed personalisation (relative to a set of XSLT stylesheets) of MathML is indeed possible.
<mx:BesselJ>,
are expanded prior to TeX generation, then the result will potentially
lose usefull information. It is not unlikely that an author shall have
TeX definitions corresponding to these functions, e.g. \BesselJ.
The translation between TeX and MathML, with an automated
correspondence between TeX definitions and XSLT rules has been
investigated in [9]. We investigate how information may be
stored in order to allow this translation in our paper [8].
<Description> element be extended to
contain two new subelements, <CommonName>" and \verb"<Notation>.
The contents of the notation element(s) would be expressed as MathML.
Secondly, we note that each definition element may have Commented Mathematical Properties
(<CMP> elements). These commented mathematical properties are intended
for human readers, not proof systems, and could be expressed naturally in MathML
to facilitate browsing.1
Example Here we show MathML in use in the proposed <Notation> element.
<CD>
<CDName>Bessel</CDName>
<CDURL>http://www.openmath.org/CDs/bessel.ocd</CDURL>
<CDReviewDate>2001-07-22</CDReviewDate>
<CDStatus>experimental</CDStatus>
<CDDate>2001-07-22</CDDate>
<CDVersion>1</CDVersion>
<CDRevision>0</CDRevision>
<CDUses> </CDUses>
<Description>
This content dictionary contains symbols to describe
the bessel functions and associated functions.
</Description>
<CDDefinition>
<Name>BesselJ</Name>
<Description>
<CommonName>Bessel Functions of Integer Order</CommonName>
<Notation>
<version>
<img src="besseleqn.jpg"/>
<tex>J_\xref{arg1}{\nu}(\xref{arg2}{z})</tex>
<math>
<mrow>
<msub>
<mi>J<mi>
<mi xref="arg1">ν</mi>
</msub>
<mo>⁡</mo>
<mfenced>
<mi xref="arg2">z</mi>
</mfenced>
</mrow>
</math>
</version>
<FMP>
<OMOBJ>
<OMA>
<OMS name="BesselJ" cd="bessel"/>
<OMV id="arg1" name="nu"/>
<OMV id="arg2" name="z"/>
</OMA>
</OMOBJ>
</FMP>
</Notation>
The solutions to the differential equation ...
</Description>
...
</CDDefinition>
...
</CD>
These elements give various possibilities for how a symbol is intended to
appear textually. Within a Notation element we shall allow
gif file) giving some sort of generic form of the notation (to
be used in pull-down menus and the like).
<Notation> elements in more detail in our paper
[8].
<semantics>
elements or to produce definitionURL attributes in <csymbol>
elements. This allows semantically meaningful expressions to use extended
mathematical concepts as though they were in the base MathML definition.
We expect that writing expressions in this way shall be more readily adopted by
human and machine authors of MathML than explicit, detailed <semantics>
or <csymbol> markup. This may in fact be the only way that a significant
proportion of MathML documents contain meaningful content in some years' time.
Secondly, MathML notations may be usefully incorporated in OpenMath Content
Dictionaries in such a way as to allow OpenMath objects to be rendered in
different notational variants using MathML.


