5 数式に対するマークアップ言語の混在
Mixing Markup Languages for Mathematical Expressions

概要: 数学用マークアップ言語 (MathML) ヴァージョン 3.0 第2版
Overview: Mathematical Markup Language (MathML) Version 3.0 2nd Edition
前へ: 4 コンテントマークアップ
Previous: 4 Content Markup
次へ: 6 ホスト環境との相互作用
Next: 6 Interactions with the Host Environment

5 数式に対するマークアップ言語の混在
Mixing Markup Languages for Mathematical Expressions
    5.1 付加情報の枠組み
    Annotation Framework
        5.1.1 付加情報要素
        Annotation elements
        5.1.2 付加情報の鍵
        Annotation keys
        5.1.3 代替表現
        Alternate representations
        5.1.4 同一内容
        Content equivalents
        5.1.5 付加情報参照
        Annotation references
    5.2 意味付加情報のための要素
    Elements for Semantic Annotations
        5.2.1 <semantics>要素
        The <semantics> element
            5.2.1.1 説明
            Description
            5.2.1.2 属性
            Attributes
        5.2.2 <annotation>要素
        The <annotation> element
            5.2.2.1 説明
            Description
            5.2.2.2 属性
            Attributes
        5.2.3 <annotation-xml>要素
        The <annotation-xml> element
            5.2.3.1 説明
            Description
            5.2.3.2 属性
            Attributes
            5.2.3.3 HTML文書でannotation-xmlを利用する
            Using annotation-xml in HTML documents
    5.3 プレゼンテーションマークアップとコンテントマークアップを混在させる
    Combining Presentation and Content Markup
        5.3.1 コンテントマークアップの中のプレゼンテーションマークアップ
        Presentation Markup in Content Markup
        5.3.2 プレゼンテーションマークアップの中のコンテントマークアップ
        Content Markup in Presentation Markup
    5.4 並列のマークアップ
    Parallel Markup
        5.4.1 並列のマークアップの一番上の要素
        Top-level Parallel Markup
        5.4.2 相互参照を通した並列のマークアップ
        Parallel Markup via Cross-References

MathMLマークアップは, 他のマークアップ言語と組合せられ, それらの組合せる構造は, 意味付加情報要素によって実現されます. 意味付加情報要素は, 式の代替表現どうしを結び付けたり, MathMLの式に意味特性や他の帰属を結び付けたりする重要な手段です. これらの要素は, プレゼンテーションマークアップとコンテントマークアップに, 様々な異なった方法で組合せることを認めています. 混在したマークアップとして知られるある方法は, コンテント要素とプレゼンテーション要素を, 特に単独の何らかのツリー構造の中に点在させるものです. 並列のマークアップとして知られる他の方法は, はっきりしたプレゼンテーションマークアップとコンテントマークアップを, 単独のsemantics要素によって組合せられたマークアップ表現の組の形で提供することです.

MathML markup can be combined with other markup languages, and these mixing constructions are realized by the semantic annotation elements. The semantic annotation elements provide an important tool for making associations between alternate representations of an expression, and for associating semantic properties and other attributions with a MathML expression. These elements allow presentation markup and content markup to be combined in several different ways. One method, known as mixed markup, is to intersperse content and presentation elements in what is essentially a single tree. Another method, known as parallel markup, is to provide both explicit presentation markup and content markup in a pair of markup expressions, combined by a single semantics element.

5.1 付加情報の枠組み
Annotation Framework

MathMLの重大な関心事は, 式に対するプレゼンテーションマークアップ形式とコンテントマークアップ形式の間の結び付きを表現することです. MathMLの式と他の種類のデータの結び付きを表現することも, たくさんの状況で重要です. この理由から, MathMLは付加情報に対する一般的な枠組みを提供します. MathMLの式は, 付加情報の鍵として知られる付加情報の種類を示す記号と, 付加情報の値として知られる結び付けられたデータから成る一連の組で, 装飾されるかもしれません.

An important concern of MathML is to represent associations between presentation and content markup forms for an expression. Representing associations between MathML expressions and data of other kinds is also important in many contexts. For this reason, MathML provides a general framework for annotation. A MathML expression may be decorated with a sequence of pairs made up of a symbol that indicates the kind of annotation, known as the annotation key, and associated data, known as the annotation value.

5.1.1 付加情報要素
Annotation elements

semantics, annotation, annotation-xml要素は, MathMLで付加情報を表現するのに一緒に利用されます. semantics要素は, 式とその付加情報をまとめる要素を提供します. annotation要素は, 文字列の付加情報をまとめる要素であり, annotation-xml要素は, 構造化された付加情報に用いられます. semantics要素は, 最初の子要素として付加情報を付けた式, それに続く一連の1つ以上のannotationannotation-xml要素を含みます.

The semantics, annotation, and annotation-xml elements are used together to represent annotations in MathML. The semantics element provides the container for a expression and its annotations. The annotation element is the container for text annotations, and the annotation-xml element is used for structured annotations. The semantics element contains the expression being annotated as its first child, followed by a sequence of zero or more annotation and/or annotation-xml elements.

<semantics>
  <mrow>
    <mrow>
      <mi>sin</mi>
      <mo>&#x2061;<!--FUNCTION APPLICATION--></mo>
      <mfenced><mi>x</mi></mfenced>
    </mrow>
    <mo>+</mo>
    <mn>5</mn>
  </mrow>
  <annotation encoding="application/x-tex">
    \sin x + 5
  </annotation>
  <annotation-xml encoding="application/openmath+xml">
    <OMA xmlns="http://www.openmath.org/OpenMath">
      <OMS cd="arith1" name="plus"/>
      <OMA><OMS cd="transc1" name="sin"/><OMV name="x"/></OMA>
      <OMI>5</OMI>
    </OMA>
  </annotation-xml>
</semantics>

この例は, MathMLのXML構文でのみ利用可能な名前空間の拡張を利用していることに注意して下さい. この例がHTML文書に含まれている場合, 無効であると見なされ, OpenMath要素はMathML名前空間でない要素として処理されるでしょう. 詳しくは第5.2.3.3節 HTML文書でのannotation-xml の利用を参照して下さい.

Note that this example makes use of the namespace extensibility that is only available in the XML syntax of MathML. If this example is included in an HTML document then it would be considered invalid and the OpenMath elements would be parsed as elements un the MathML namespace. See Section 5.2.3.3 Using annotation-xml in HTML documents for details.

semantics要素は, プレゼンテーション要素とコンテント要素の両方であると見なされ, どちらの文脈でも利用されるでしょう. 全てのMathMLソフトウェアは, MathMLのそれらの2つのマークアップのうち一方しか処理しないとしても, semantics要素を処理すべきです.

The semantics element is considered to be both a presentation element and a content element, and may be used in either context. All MathML processors should process the semantics element, even if they only process one of these two subsets of MathML.

5.1.2 付加情報の鍵
Annotation keys

付加情報の鍵は, 式と付加情報の関係を指定します. たくさんの種類の関係が指定可能です. 例としては, 代替表現, 意味の指定もしくは明確化, 型情報, 描画の手助けとなる情報, 特定の処理ソフトウェアを想定したデータを含みます. 付加情報の鍵は, 処理ソフトウェアが付加情報を処理するかどうか決める主な方法です.

An annotation key specifies the relationship between an expression and an annotation. Many kinds of relationships are possible. Examples include alternate representations, specification or clarification of semantics, type information, rendering hints, and private data intended for specific processors. The annotation key is the primary means by which a processor determines whether or not to process an annotation.

式と付加情報の論理的な関係は, 式の適切な処理に重要な意味を持っています, 例えば, 意味の帰属と呼ばれる特定の付加情報の形は, とにかく何らかの処理をされる文脈で, 付加情報の付いた式の意味を変えることなく, 無視することはできません. 別の点で, 代替表現は式の意味を変えることはしませんが, 描画の手助けとなる情報を提供するためによく利用されるといった具合に, 式の表現を変更するかもしれません. それでもなお, 他の付加情報が特定の文脈で使い勝手の良い, 特定のソフトウェア用のデータやメタデータを提供するでしょうが, 式の意味も表現も変えないでしょう.

The logical relationship between an expression and an annotation can have a significant impact on the proper processing of the expression. For example, a particular annotation form, called semantic attributions, cannot be ignored without altering the meaning of the annotated expression, at least in some processing contexts. On the other hand, alternate representations do not alter the meaning of an expression, but may alter the presentation of the expression as they are frequently used to provide rendering hints. Still other annotations carry private data or metadata that are useful in a specific context, but do not alter either the semantics or the presentation of the expression.

MathML3において, 付加情報の鍵はコンテント辞書の中の記号として定義され, annotationannotation-xml要素のcdname属性を用いて指定されます. MathML2との下位互換性のため, 付加情報の鍵は, cdname属性の代わりとなるdefinitionURL属性を用いて参照されることもあるでしょう. コンテント辞書で参照している記号の詳細については, 第4.2.3節 コンテントマークアップの記号 <csymbol>で議論しています. 付加情報の鍵のためのコンテント辞書での記号の定義は, roleプロパティを持つでしょう. 特に2つの役割が付加情報に関係します. "帰属"の役割は, 付加された部分の意味を変えずに無視できる一般的な付加情報を特定します. また, "意味属性"の役割は, 付加情報が意味の付加情報であることを意図しており, すなわち, 付加情報は, 潜在的に式の意味を変更することなく無視されることはありません.

In MathML 3, annotation keys are defined as symbols in Content Dictionaries, and are specified using of the cd and name attributes on the annotation and annotation-xml elements. For backward compatibility with MathML 2, an annotation key may also be referenced using the definitionURL attribute as an alternative to the cd and name attributes. Further details on referencing symbols in Content Dictionaries are discussed in Section 4.2.3 Content Symbols <csymbol>. The symbol definition in a Content Dictionary for an annotation key may have a role property. Two particular roles are relevant for annotations: a role of "attribution" identifies a generic annotation that can be ignored without altering the meaning of the annotated term, and a role of "semantic-attribution" indicates that the annotation is a semantic annotation, that is, the annotation cannot be ignored without potentially altering the meaning of the expression.

MathML3は, 付加情報の最も一般的な種類に対し, 2つの定義済の付加情報の鍵を提供します. mathmlkeysコンテント辞書で定義されているalternate-representationcontentequivです. 付加情報の鍵alternate-representationは, 付加情報の値が, 式に対する他のマークアップ言語による代わりの表現を提供することを指定しています. また, 付加情報の鍵contentequivは, 付加情報の値が, 付加情報の付けられた式の意味的に等しい代わりの表現を提供することを指定しています. これらの鍵の利用について, より詳細に後の節で示しています.

MathML 3 provides two predefined annotation keys for the most common kinds of annotations: alternate-representation and contentequiv defined in the mathmlkeys content dictionary. The alternate-representation annotation key specifies that the annotation value provides an alternate representation for an expression in some other markup language, and the contentequiv annotation key specifies that the annotation value provides a semantically equivalent alternative for the annotated expression. Further details about the use of these keys is given in the sections below.

付加情報の鍵が何も明確に指定されていない場合, annotationまたはannotation-xml要素の, 付加情報の鍵の既定値はalternate-representationです.

The default annotation key is alternate-representation when no annotation key is explicitly specified on an annotation or annotation-xml element.

典型的に, 付加情報の鍵は, 式と付加情報の関係の論理的な性質のみを指定しています. 付加情報のデータ形式は, encoding属性で示されます. MathML2では, encoding属性は, 処理ソフトウェアが付加情報を解釈できるかどうか決めるのに利用できる第一の情報でした. 下位互換性のために, 処理ソフトウェアは, 付加情報の鍵とencoding属性の両方を調べることを促されています. 特に, MathML2は, 定義済のコード化手法の値MathML, MathML-Content, MathML-Presentationを指定していました. コード化手法の値MathMLは, annotation-xml要素がMathMLの式を含んでいることを示すのに利用されます. 他の値の利用については, より細かく次の節で論じています.

Typically, annotation keys specify only the logical nature of the relationship between an expression and an annotation. The data format for an annotation is indicated with the encoding attribute. In MathML 2, the encoding attribute was the primary information that a processor could use to determine whether or not it could understand an annotation. For backward compatibility, processors are encouraged to examine both the annotation key and encoding attribute. In particular, MathML 2 specified the predefined encoding values MathML, MathML-Content, and MathML-Presentation. The MathML encoding value is used to indicate an annotation-xml element contains a MathML expression. The use of the other values is more specific, as discussed in following sections.

定義済の鍵alternate-representationcontentequivは, たくさんの一般的な利用状況に対応している一方, 利用者の団体は, 必要に応じて追加のコンテント辞書を定義し標準化することを促されています. 公式のコンテント辞書の利用者の定義した付加情報の鍵は, ソフトウェア特有のencoding属性の値を利用するより好まれます. なぜなら, コンテント辞書は, ソフトウェア特有のendcoding属性に比べ, より表現豊かで, より開かれていて, より管理しやすいからです. しかしながら, MathML2との下位互換性から, encoding属性も利用されるでしょう.

While the predefined alternate-representation and contentequiv keys cover many common use cases, user communities are encouraged to define and standardize additional content dictionaries as necessary. Annotation keys in user-defined, public Content Dictionaries are preferred over private encoding attribute value conventions, since content dictionaries are more expressive, more open and more maintainable than private encoding values. However, for backward compatibility with MathML 2, the encoding attribute may also be used.

5.1.3 代替表現
Alternate representations

代替表現の付加情報は, 式の描画を提供したり, 他のマークアップ言語で同じ表現を提供したりするために最もよく利用されます. 一般に, 代替表現の付加情報は, 付加情報の付けられた式の意味を変更しませんが, 表現は変更するかもしれません.

Alternate representation annotations are most often used to provide renderings for an expression, or to provide an equivalent representation in another markup language. In general, alternate representation annotations do not alter the meaning of the annotated expression, but may alter its presentation.

特に重要な状況としては, プレゼンテーションMathMLの式を, コンテントMathMLの式の好ましい描画を示すのに利用することです. この状況は, encoding属性の値をapplication/mathml-presentation+xmlとして付加情報を分類することで表されるでしょう. MathML2.0との下位互換性のために, この状況はまた, encoding属性の値を同じ意味のMathML-Presentationとして表されるかもしれません. プレゼンテーションMathMLの付加情報がsemantics要素の中に存在する場合, 最初の子要素の通常の描画の代わりに, プレゼンテーションMathMLの付加情報がsemanticsの通常の描画として利用されるであろうことに注意して下さい.

A particularly important case is the use of a presentation MathML expression to indicate a preferred rendering for a content MathML expression. This case may be represented by labeling the annotation with the application/mathml-presentation+xml value for the encoding attribute. For backward compatibility with MathML 2.0, this case can also be represented with the equivalent MathML-Presentation value for the encoding attribute. Note that when a presentation MathML annotation is present in a semantics element, it may be used as the default rendering of the semantics element, instead of the default rendering of the first child.

下の例では, semantics要素が, コンテントMathMLの式に対する様々な代わりの表現を一緒にまとめています. プレゼンテーションMathMLの付加情報は, 他の付加情報が他のマークアップ言語での表現を示している限り, 通常の描画として用いられるでしょう. 帰属の鍵が何も明確に指定されていないことから, 付加情報の鍵の既定値であるalternate-representationが, それぞれの付加情報に適用されます.

In the example below, the semantics element binds together various alternate representations for a content MathML expression. The presentation MathML annotation may be used as the default rendering, while the other annotations give representations in other markup languages. Since no attribution keys are explicitly specified, the default annotation key alternate-representation applies to each of the annotations.

<semantics>
  <apply>
    <plus/>
    <apply><sin/><ci>x</ci></apply>
    <cn>5</cn>
  </apply>
  <annotation-xml encoding="MathML-Presentation">
    <mrow>
      <mrow>
        <mi>sin</mi>
        <mo>&#x2061;<!--FUNCTION APPLICATION--></mo>
        <mfenced open="(" close=")"><mi>x</mi></mfenced>
      </mrow>
      <mo>+</mo>
      <mn>5</mn>
    </mrow>
  </annotation-xml>
  <annotation encoding="application/x-maple">
    sin(x) + 5
  </annotation>
  <annotation encoding="application/vnd.wolfram.mathematica">
    Sin[x] + 5
  </annotation>
  <annotation encoding="application/x-tex">
    \sin x + 5
  </annotation>
  <annotation-xml encoding="application/openmath+xml">
    <OMA xmlns="http://www.openmath.org/OpenMath">
      <OMA>
        <OMS cd="arith1" name="plus"/>
        <OMA><OMS cd="transc1" name="sin"/><OMV name="x"/></OMA>
        <OMI>5</OMI>
      </OMA>
    </OMA>
  </annotation-xml>
</semantics>

この例は, MathMLのXML構文でのみ利用可能な名前空間の拡張を利用していることに注意して下さい. この例がHTML文書に含まれている場合, この例は無効と見なされ, OpenMath要素はMathML名前空間でない要素として処理されるでしょう. 詳しくは, 第5.2.3.3節 HTML文書でannotation-xmlを利用するを参照して下さい.

Note that this example makes use of the namespace extensibility that is only available in the XML syntax of MathML. If this example is included in an HTML document then it would be considered invalid and the OpenMath elements would be parsed as elements un the MathML namespace. See Section 5.2.3.3 Using annotation-xml in HTML documents for details.

5.1.4 同一内容
Content equivalents

同一内容の付加情報は, 式に対する追加のコンピュータ処理上の情報を提供します. 鍵contentequivを持つ付加情報は, 潜在的に式のふるまいを変えない限り無視することはできません.

Content equivalent annotations provide additional computational information about an expression. Annotations with the contentequiv key cannot be ignored without potentially changing the behavior of an expression.

重要な状況として, コンテントMathMLの付加情報を, プレゼンテーションMathMLの式の意味のあいまいさを無くすために利用することが挙げられます. この状況は, encoding属性の値をapplication/mathml-content+xmlとして付加情報を分類することで表されるでしょう. MatML2では, 付加情報の型は, encoding属性を同じ意味のMathML-Contentとして表されていたので, 処理ソフトウェアは, 下位互換性のためにこの利用に対応するよう促されます. MathML2または3でのコンテントMathMLの付加情報は, 他の種類の意味の伝達といったような他の意味でも使われるでしょう. 結果として, MathML3では, 付加情報が式と同一の最終的なコンテントマークアップを提供することを明確に伝達できるように, 付加情報の鍵contentequivが利用されるべきです.

An important case arises when a content MathML annotation is used to disambiguate the meaning of a presentation MathML expression. This case may be represented by labeling the annotation with the application/mathml-content+xml value for the encoding attribute. In MathML 2, this type of annotation was represented with the equivalent MathML-Content value for the encoding attribute, so processors are urged to support this usage for backward compatibility. A content MathML annotation, whether in MathML 2 or 3, may be used for other purposes as well, such as for other kinds of semantic assertions. Consequently, in MathML 3, the contentequiv annotation key should be used to make an explicit assertion that the annotation provides a definitive content markup equivalent for an expression.

下の例では, あいまいなプレゼンテーションMathMLの式にMathML-Content付加情報を付け加えることで, 正確な意味を明確にしています.

In the example below, an ambiguous presentation MathML expression is annotated with a MathML-Content annotation clarifying its precise meaning.

<semantics>
  <mrow>
    <mrow>
      <mi>a</mi>
      <mfenced open="(" close=")">
        <mrow><mi>x</mi><mo>+</mo><mn>5</mn></mrow>
      </mfenced>
    </mrow>
  </mrow>
  <annotation-xml cd="mathmlkeys" name="contentequiv"
                  encoding="MathML-Content">
    <apply>
      <ci>a</ci>
      <apply><plus/><ci>x</ci><cn>5</cn></apply>
    </apply>
  </annotation-xml>
</semantics>

5.1.5 付加情報参照
Annotation references

通常の場合, それぞれの付加情報要素は, 付加情報の値を表す, 文字データの内容(annotationの場合)またはXMLマークアップのデータ(annotation-xmlの場合)のどちらかを含みます. semantics要素の中に現れるであろう付加情報の型には何ら制限はありません. 例えば, 付加情報は, TEXのコード, 数式処理システムからの一連の入力, 描画された画像, 詳細な数学の型情報を提供することもできます.

In the usual case, each annotation element includes either character data content (in the case of annotation) or XML markup data (in the case of annotation-xml) that represents the annotation value. There is no restriction on the type of annotation that may appear within a semantics element. For example, an annotation could provide a TEX encoding, a linear input form for a computer algebra system, a rendered image, or detailed mathematical type information.

場合によっては, semantics要素の代替表現の子要素が, 付加された式のふるまいの本質的な部分ではなく, 特定のソフトウェアで利用可能なものかもしれません. 効果的な方法で様々な付加情報の形式を利用可能にするのに, semantics要素は, 付加情報と結び付けられた値に対する外部の場所を指定するencodingsrc属性を提供する, 空のannotationannotation-xml要素を含むでしょう.

In some cases the alternative children of a semantics element are not an essential part of the behavior of the annotated expression, but may be useful to specialized processors. To enable the availability of several annotation formats in a more efficient manner, a semantics element may contain empty annotation and annotation-xml elements that provide encoding and src attributes to specify an external location for the annotation value associated with the annotation. This type of annotation is known as an annotation reference.

<semantics>
  <mfrac><mi>a</mi><mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow></mfrac>
  <annotation encoding="image/png" src="333/formula56.png"/>
  <annotation encoding="application/x-maple" src="333/formula56.ms"/>
</semantics>

出力されたマークアップの利用者が, そのような付加情報が参照している外部実体を検索できないだろうと予測した処理プログラムは, 示された場所にある外部実体の内容を要求し, 展開された形式で付加情報を置き換えるべきです.

Processing agents that anticipate that consumers of exported markup may not be able to retrieve the external entity referenced by such annotations should request the content of the external entity at the indicated location and replace the annotation with its expanded form.

付加情報参照は, 他の付加情報に適用される, 付加情報が付けられたものと付加情報の関係を指定する付加情報の鍵を決めるのと同じ決まりに従います.

An annotation reference follows the same rules as for other annotations to determine the annotation key that specifies the relationship between the annotated object and the annotation value.

5.2 意味付加情報のための要素
Elements for Semantic Annotations

この節は, 意味を結び付ける要素semantics, annotation, annotation-xmlについて説明します. これらの要素は, プレゼンテーションマークアップまたはコンテントマークアップの式に代替表現を結び付けたり, 付加情報が付けられた式の意味を修飾する意味情報や他の帰属情報を結び付けたりします.

This section explains the semantic mapping elements semantics, annotation, and annotation-xml. These elements associate alternate representations for a presentation or content expression, or associate semantic or other attributions that may modify the meaning of the annotated expression.

5.2.1 <semantics>要素
The <semantics> element

5.2.1.1 説明
Description

semantics要素は, MathMLの式に付加情報を結び付ける入れ物となる要素です. semantics要素は, 最初の子要素として付加情報が付けられる式を持ちます. どんなMathMLの式でもsemantics要素の最初の子要素として現れるでしょう. 後に続く子要素annotationannotation-xmlは, 付加情報を囲います. XMLで表される付加情報はannotation-xml要素で囲われます. 文字データで表される付加情報はannotation要素で囲われます.

The semantics element is the container element that associates annotations with a MathML expression. The semantics element has as its first child the expression to be annotated. Any MathML expression may appear as the first child of the semantics element. Subsequent annotation and annotation-xml children enclose the annotations. An annotation represented in XML is enclosed in an annotation-xml element. An annotation represented in character data is enclosed in an annotation element.

前に注意したように, semantics要素は, 内容に従って, プレゼンテーション要素とコンテント要素のどちらとしても動作するため, それらの両方の要素と見なされます. 結果として, MathML処理ソフトウェアは, プレゼンテーションマークアップのみか, コンテントマークアップのみしか処理しないとしても, semantics要素を処理すべきです.

As noted above, the semantics element is considered to be both a presentation element and a content element, since it can act as either, depending on its content. Consequently, all MathML processors should process the semantics element, even if they process only presentation markup or only content markup.

semantics要素の通常の描画は, 最初の子要素の通常の描画です. 描画ソフトウェアは, 付加情報の付けられた要素の描画を変更するのに, 付加情報の中に含まれる情報を利用するかもしれません.

The default rendering of a semantics element is the default rendering of its first child. A renderer may use the information contained in the annotations to customize its rendering of the annotated element.

<semantics>
  <mrow>
    <mrow>
      <mi>sin</mi>
      <mo>&#x2061;<!--FUNCTION APPLICATION--></mo>
      <mfenced><mi>x</mi></mfenced>
    </mrow>
    <mo>+</mo>
    <mn>5</mn>
  </mrow>
  <annotation-xml cd="mathmlkeys" name="contentequiv" encoding="MathML-Content">
    <apply>
      <plus/>
      <apply><sin/><ci>x</ci></apply>
      <cn>5</cn>
    </apply>
  </annotation-xml>
  <annotation encoding="application/x-tex">
    \sin x + 5
  </annotation>
</semantics>

5.2.1.2 属性
Attributes

名前
Name

values
既定値
default
definitionURL URI 無し
none
意味情報の外部媒体の場所
The location of an external source for semantic information
encoding 文字列
string
無し
none
外部の意味情報のコード化手法
The encoding of the external semantic information

semantics要素は, 付加情報によって修飾する際に, 付加情報の付けられた要素に対する一部または全体の意味情報について外部媒体を参照する, definitionURLencoding属性を持ちます. semantics要素におけるこれらの属性の利用は, MathML3では非推奨です.

The semantics element takes the definitionURL and encoding attributes, which reference an external source for some or all of the semantic information for the annotated element, as modified by the annotation. The use of these attributes on the semantics element is deprecated in MathML3.

5.2.2 <annotation>要素
The <annotation> element

5.2.2.1 説明
Description

annotation要素は, 意味付加情報の入れ物となる要素で, その表現がXMLでない文字データとして処理されるものです. annotation要素は, 付加情報として文字データを含むべきで, XMLマークアップ要素を含むべきではありません. 付加情報がXMLの予約済の文字&, <の1つを含んでいる場合, それらの文字は, 実体参照または(XML構文の)XML CDATAセクションを使ってコード化されなければなりません.

The annotation element is the container element for a semantic annotation whose representation is parsed character data in a non-XML format. The annotation element should contain the character data for the annotation, and should not contain XML markup elements. If the annotation contains one of the XML reserved characters &, < then these characters must be encoded using an entity reference or (in the XML syntax) an XML CDATA section.

5.2.2.2 属性
Attributes

名前
Name

values
既定値
default
definitionURL URI 無し
none
付加情報の鍵の記号の場所
The location of the annotation key symbol
encoding 文字列
string
無し
none
付加情報における意味情報のコード化手法
The encoding of the semantic information in the annotation
cd 文字列
string
mathmlkeys
付加情報の鍵の記号を含むコンテント辞書
The content dictionary that contains the annotation key symbol
name 文字列
string
alternate-representation
付加情報の鍵の記号の名前
The name of the annotation key symbol
src URI 無し
none
意味情報の外部媒体の場所
The location of an external source for semantic information

まとめると, cdname属性は, 付加情報の付けられた要素と付加情報の関係を特定する, 第5.1.1節 付加情報要素で述べた, 付加情報の記号を指定します. definitionURL属性は, 単独の属性で付加情報の鍵を参照する代わりの方法を提供します. これらの属性が存在しない場合, 付加情報の鍵は, mathmlkeysコンテント辞書のalternate-representation記号です.

Taken together, the cd and name attributes specify the annotation key symbol, which identifies the relationship between the annotated element and the annotation, as described in Section 5.1.1 Annotation elements. The definitionURL attribute provides an alternate way to reference the annotation key symbol as a single attribute. If none of these attributes are present, the annotation key symbol is the symbol alternate-representation from the mathmlkeys content dictionary.

encoding属性は, 付加情報の中身の型を説明します. encoding属性の値は, コード化されたデータのデータ形式を特定するメディアタイプを含むでしょう. 結び付けられたメディアタイプを持たないデータ形式に対して, 実装者は, そのデータの中身の型を特定するデータ自体を説明する文字列を選ぶでしょう.

The encoding attribute describes the content type of the annotation. The value of the encoding attribute may contain a media type that identifies the data format for the encoding data. For data formats that do not have an associated media type, implementors may choose a self-describing character string to identify their content type.

src属性は, MathMLの式に付加情報として, 外部実体を付け加える仕組みを提供します.

The src attribute provides a mechanism to attach external entities as annotations on MathML expressions.

<annotation encoding="image/png" src="333/formula56.png"/>

annotation要素は, semantics要素の子要素としてのみ利用できるであろう, 意味を結び付ける要素です. annotation要素に対する通常の描画が無いと同時に, 描画ソフトウェアは, 付加情報に含まれている情報を, それが付けられた要素の描画を変更するのに利用するかもしれない.

The annotation element is a semantic mapping element that may only be used as a child of the semantics element. While there is no default rendering for the annotation element, a renderer may use the information contained in an annotation to customize its rendering of the annotated element.

5.2.3 <annotation-xml>要素
The <annotation-xml> element

5.2.3.1 説明
Description

annotation-xml要素は, 意味付加情報の入れ物となる要素で, その表現が構造化されたマークアップのものです. annotation-xml要素は, 付加情報としてマークアップ要素, 属性, 文字データを含むべきです.

The annotation-xml element is the container element for a semantic annotation whose representation is structured markup. The annotation-xml element should contain the markup elements, attributes, and character data for the annotation.

5.2.3.2 属性
Attributes

名前
Name

values
既定値
default
definitionURL URI 無し
none
付加情報の鍵の記号の場所
The location of the annotation key symbol
encoding 文字列
string
無し
none
付加情報における意味情報のコード化手法
The encoding of the semantic information in the annotation
cd 文字列
string
mathmlkeys
付加情報の鍵の記号を含むコンテント辞書
The content dictionary that contains the annotation key symbol
name 文字列
string
alternate-representation
付加情報の鍵の記号の名前
The name of the annotation key symbol
src URI 無し
none
意味情報の外部媒体の場所
The location of an external source for semantic information

まとめると, cdname属性は, 付加情報の付けられた要素と付加情報の関係を特定する, 第5.1.1節 付加情報要素で述べた, 付加情報の記号を指定します. definitionURL属性は, 単独の属性で付加情報の鍵を参照する代わりの方法を提供します. これらの属性が存在しない場合, 付加情報の鍵は, mathmlkeysコンテント辞書のalternate-representation記号です.

Taken together, the cd and name attributes specify the annotation key symbol, which identifies the relationship between the annotated element and the annotation, as described in Section 5.1.1 Annotation elements. The definitionURL attribute provides an alternate way to reference the annotation key symbol as a single attribute. If none of these attributes are present, the annotation key symbol is the symbol alternate-representation from the mathmlkeys content dictionary.

encoding属性は, 付加情報の中身の型を説明します. encoding属性の値は, コード化されたデータのデータ形式を特定するメディアタイプを含むでしょう. 結び付けられたメディアタイプを持たないデータ形式に対して, 実装者は, そのデータの中身の型を特定するデータ自体を説明する文字列を選ぶでしょう. 特に, 前の方の節で説明したり, 第6.2.4節 MathMLのコード化された名前にあったりするように, MathMLは, MathML, MathML-Presentation, MathML-Contentを, encoding属性の定義済の値として指定しています. 最後に, src属性は, MathMLの式に付加情報としてXMLの外部実体を付け加える仕組みを指定します.

The encoding attribute describes the content type of the annotation. The value of the encoding attribute may contain a media type that identifies the data format for the encoding data. For data formats that do not have an associated media type, implementors may choose a self-describing character string to identify their content type. In particular, as described above and in Section 6.2.4 Names of MathML Encodings, MathML specifies MathML, MathML-Presentation, and MathML-Content as predefined values for the encoding attribute. Finally, The src attribute provides a mechanism to attach external XML entities as annotations on MathML expressions.

<annotation-xml cd="mathmlkeys" name="contentequiv" encoding="MathML-Content">
  <apply>
    <plus/>
    <apply><sin/><ci>x</ci></apply>
    <cn>5</cn>
  </apply>
</annotation-xml>

<annotation-xml encoding="application/openmath+xml">
  <OMA xmlns="http://www.openmath.org/OpenMath">
    <OMS cd="arith1" name="plus"/>
    <OMA><OMS cd="transc1" name="sin"/><OMV name="x"/></OMA>
    <OMI>5</OMI>
  </OMA>
</annotation-xml>

MathMLがXMLとして処理され, 付加情報の値がMathML以外のXML言語で表されている場合, 付加情報に対するXMLマークアップの名前空間は, 名前空間属性や名前空間接頭辞といった方法で特定されるべきです. 例えば, 次のようにです.

When the MathML is being parsed as XML and the annotation value is represented in an XML dialect other than MathML, the namespace for the XML markup for the annotation should be identified by means of namespace attributes and/or namespace prefixes on the annotation value. For instance:

<annotation-xml encoding="application/xhtml+xml">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>E</title></head>
    <body>
      <p>The base of the natural logarithms, approximately 2.71828.</p>
    </body>
  </html>
</annotation-xml>

annotation-xml要素は, semantics要素の子要素としてのみ利用できるであろう, 意味を結び付ける要素です. annotation-xml要素に対する通常の描画が無いと同時に, 描画ソフトウェアは, 付加情報に含まれている情報を, それが付けられた要素の描画を変更するのに利用するかもしれません.

The annotation-xml element is a semantic mapping element that may only be used as a child of the semantics element. While there is no default rendering for the annotation-xml element, a renderer may use the information contained in an annotation to customize its rendering of the annotated element.

5.2.3.3 HTML文書でannotation-xmlを利用する
Using annotation-xml in HTML documents

上の例で使われている名前空間の拡張は, MathMLがXML文書として取り扱われなければ利用できません. 特にHTML処理プログラムはxmlns属性を通常の属性として扱うことから, OpenMathの例は, HTML検証ツールによって無効と分類されるでしょう. それでもOpenMath要素は, annotation-xml要素の子要素として処理されるでしょうし, それらは, MathML名前空間に置かれるでしょう. 上の例では, この仕様書のHTMLヴァージョンでは, その文書が有効なHTML5文書であることを確かにするため, 描画されません.

Note that the Namespace extensibility used in the above examples may not be available if the MathML is not being treated as an XML document. In particular HTML parsers treat xmlns attributes as ordinary attributes, so the OpenMath example would be classified as invalid by an HTML validator. The OpenMath elements would still be parsed as children of the annotation-xml element, however they would be placed in the MathML namespace. The above examples are not rendered in the HTML version of this specification, to ensure that that document is a valid HTML5 document.

annotation-xmlを処理するHTML処理プログラムの詳細については, [HTML5]で指定されており, 第6.4.3節 MathMLとHTMLの混在で要約していますが, MathML付加情報に影響するXML処理プログラムのふるまいとの主な違いは, HTML処理プログラムが, xmlns属性を処理せず, 要素の名前の中の:を特別なものとして扱わず, 3つの"既知"の名前空間HTML, SVG, MathMLを利用すると決めた元からの決まりを持っていることです.

The details of the HTML parser handling of annotation-xml is specified in [HTML5] and summarized in Section 6.4.3 Mixing MathML and HTML, however the main differences from the behavior of an XML parser that affect MathML annotations are that the HTML parser does not treat xmlns attributes, nor : in element names as special and has built-in rules determining whether the three "known" namespaces, HTML, SVG or MathML are used.

  • annotation-xmlが"text/html"または"annotation/xhtml+xml"であるencoding属性を持っている場合(異なる場合は無視され), 中身はHTMLとして処理され, (最初から)HTML名前空間に置かれます.

    If the annotation-xml has an encoding attribute that is (ignoring case differences) "text/html" or "annotation/xhtml+xml" then the content is parsed as HTML and placed (initially) in the HTML namespace.

  • それ以外の場合, annotation-xmlは, 外部の内容として処理され, よりXMLに近い決まりで(HTMLの中のMathML自体のように)/>が空要素を示すといった具合に処理されます. 中身はMathML名前空間に置かれます.

    Otherwise it is parsed as foreign content and parsed in a more XML-like manner (like MathML itself in HTML) in which /> signifies an empty element. Content will be placed in the MathML namespace.

    何らかのHTML要素として認知される要素が外部の内容である付加情報の中に現れた場合, HTML処理プログラムはMathMLの式を事実上終わらせ, math要素が閉じるまでの全ての開いている要素を閉じさせ, math要素の文脈の中でないかのように入れ子になったHTMLを処理します. 何らかのそれに続くMathML要素は, math要素の文脈もしくはMathML名前空間に無いものとされ, 正確には描画されないでしょう.

    If any recognised HTML element appears in this foreign content annotation the HTML parser will effectively termnate the math expression, closing all open elements until the math element is closed, and then process the nested HTML as if it were not inside the math context. Any following MathML elements will then not render correctly as they are not in a math context, or in the MathML namespace.

これらの課題は, 次の例がXML処理プログラムまたはHTML処理プログラムのどちらで処理されても有効であることを意味しています.

These issues mean that the following example is valid whether parsed by an XML or HTML parser:

<math>
 <semantics>
  <mi>a</mi>
  <annotation-xml encoding="text/html">
   <span>xxx</span>
  </annotation-xml>
 </semantics>
 <mo>+</mo>
 <mi>b</mi>
</math>

しかしながら, encoding属性が無い場合, この式はXMLとして処理される場合のみ有効です.

However the if the encoding attribute is omitted then the expression is only valid if parsed as XML:

<math>
 <semantics>
  <mi>a</mi>
  <annotation-xml>
   <span>xxx</span>
  </annotation-xml>
 </semantics>
 <mo>+</mo>
 <mi>b</mi>
</math>

上の例がHTML処理プログラムで処理された場合, この例は, 全てのMathML要素が早まって閉じられることをspan要素が引き落とすといった, 次の無効な入力と等しい結果を提供します. spanに続く残されたMathML要素は, もはや<math>の中には含まれず, 未知のHTML要素として処理され, 不正確に描画されるでしょう.

If the above is parsed by an HTML parser it produces a result equivalent to the following invalid input, where the span element has caused all MathML elements to be prematurely closed. The remaining MathML elements following the span are no longer contained within <math> so will be parsed as unknown HTML elements and render incorrectly.

<math xmlns="http://www.w3.org/1998/Math/MathML">
 <semantics>
  <mi>a</mi>
  <annotation-xml>
  </annotation-xml>
 </semantics>
</math>
<span xmlns="http://www.w3.org/1999/xhtml">xxx</span>
<mo xmlns="http://www.w3.org/1999/xhtml">+</mo>
<mi xmlns="http://www.w3.org/1999/xhtml">b</mi>

ここでHTMLspan要素が, 全ての開いているMathML要素に早まって閉じられることを引き起こし, 続くMathML要素が未知のHTML要素として, もはやmathの子孫要素でないものとして扱われる結果を招いていることに注意して下さい. HTMLの中のMathMLの処理についてより詳しくは, 第6.4.3節 MathMLとHTMLの混在を参照して下さい.

Note here that the HTML span element has caused all open MathML elements to be prematurely closed, resulting in the following MathML elements being treated as unknown HTML elements as they are no longer descendents of math. See Section 6.4.3 Mixing MathML and HTML for more details of the parsing of MathML in HTML.

(上の例のOpenMathといった)他の種類の要素の何らかの利用は, HTMLでは無効と見なされます. 正当性が厳密に必要でないなら, そのような要素を利用できますが, それらはMathML名前空間の要素として処理されます. 文書は, 名前空間接頭辞やコロン(:)を含む要素を使うべきではありません. すなわち, HTML処理プログラムによって提供される要素が, 名前空間を扱うことのできるXML処理プログラムで組み立てできない, コロンを含む環境に依存した名前を持つべきではありません. そのような外部の付加情報を利用するよりも, HTML処理プログラムを使う場合, 既存の種類の言語を使って付加情報をコード化した方がより良いです. 第4章 コンテントマークアップの例のように, OpenMathは厳格なコンテントマークアップとして正確にコード化されるでしょう. 同様に, RDF付加情報は, annotation-xml要素でRDF/XMLをencodingの値として使うのではなく, annotationの中でtext/html付加情報のRDFaまたはN3(と呼ばれる)表記を使ってコード化されるでしょう.

Any use of elements in other vocabularies (such as the OpenMath examples above) is considered invalid in HTML. If validity is not a strict requirement it is possible to use such elements but they will be parsed as elements on the MathML namespace. Documents SHOULD NOT use namespace prefixes and element names containing colon (:) as the element nodes produced by the HTML parser with have local names containing a colon, which can not be constructed by a namespace aware XML parser. Rather than use such foreign annotations, when using an HTML parser it is better to encode the annotation using the existing vocabulary. For example as shown in Chapter 4 Content Markup OpenMath may be encoded faithfuly as Strict Content MathML. Similarly RDF annotations could be encoded using RDFa in text/html annotation or (say) N3 notation in annotation rather than using RDF/XML encoding in an annotation-xml element.

5.3 プレゼンテーションマークアップとコンテントマークアップを混在させる
Combining Presentation and Content Markup

プレゼンテーションマークアップは, 式の表記の構造をコード化します. コンテントマークアップは, 式の機能の構造をコード化します. ある状況において, MathMLの特定のソフトウェアは, プレゼンテーションマークアップとコンテントマークアップの両方の組合せを必要とするでしょう. この節は, コンテントマークアップの中でプレゼンテーションマークアップの利用を行う場合, および逆の場合の特定の制約について説明しています.

Presentation markup encodes the notational structure of an expression. Content markup encodes the functional structure of an expression. In certain cases, a particular application of MathML may require a combination of both presentation and content markup. This section describes specific constraints that govern the use of presentation markup within content markup, and vice versa.

5.3.1 コンテントマークアップの中のプレゼンテーションマークアップ
Presentation Markup in Content Markup

プレゼンテーションマークアップは, 最終的な表現があいまいでない機能の適用される構造を持つ限りは, コンテントマークアップの中に埋め込まれるでしょう. 具体的に言えば, プレゼンテーションマークアップは, 次の3つの場合のみコンテントマークアップの中に現れます.

Presentation markup may be embedded within content markup so long as the resulting expression retains an unambiguous function application structure. Specifically, presentation markup may only appear in content markup in three ways:

  1. cicn素子要素の中

    within ci and cn token elements

  2. csymbol要素の中

    within the csymbol element

  3. semantics要素の中

    within the semantics element

これら以外のコンテントマークアップの中に現れるどのプレゼンテーションマークアップもMathMLエラーになります. それらの3つの状況のより詳しい議論は次のとおりです.

Any other presentation markup occurring within content markup is a MathML error. More detailed discussion of these three cases follows:

素子要素の中のプレゼンテーションマークアップ
Presentation markup within token elements.
素子要素cicnは, 何らかの一連の(第7章 文字, 実体, 書式で定義されている)MathML文字やプレゼンテーション要素を含むことができます. ciまたはcn要素のMathML文字の連続した部分は, 適切にmiまたはmn要素で囲まれているかのように扱われ, 最終的なプレゼンテーション要素の集まりは, 省略されたmrow要素で囲まれているかのように描画されます.
The token elements ci and cn are permitted to contain any sequence of MathML characters (defined in Chapter 7 Characters, Entities and Fonts) and/or presentation elements. Contiguous blocks of MathML characters in ci or cn elements are treated as if wrapped in mi or mn elements, as appropriate, and the resulting collection of presentation elements is rendered as if wrapped in an implicit mrow element.
csymbol要素の中のプレゼンテーション要素
Presentation markup within the csymbol element.
csymbol要素は, プレゼンテーションマークアップまたはコンテントマークアップどちらかで散らばめられているMathML文字を含むでしょう. csymbol要素にプレゼンテーション要素とコンテント要素両方を含むことはMathMLエラーになります. csymbol要素が文字データとプレゼンテーションマークアップを含むとき, 素子要素cicnに適用されたのと同じ描画の決まりが使用されます.
The csymbol element may contain either MathML characters interspersed with presentation markup, or content markup. It is a MathML error for a csymbol element to contain both presentation and content elements. When the csymbol element contains character data and presentation markup, the same rendering rules that apply to the token elements ci and cn should be used.
semantics要素の中のプレゼンテーションマークアップ
Presentation markup within the semantics element.
semantics要素の主な目的の1つは, 任意のMathMLの式をコンテントマークアップに有意義な方法で組み入れる仕組みを提供することです. 特に, 何らかの有効なプレゼンテーションマークアップの式は, semantics要素の最初の子要素とすることで, コンテントマークアップの式に埋め込めます. 囲まれた式の意味は, semantics要素に一緒に含まれる1つ以上の付加情報要素により示されるべきです.
One of the main purposes of the semantics element is to provide a mechanism for incorporating arbitrary MathML expressions into content markup in a semantically meaningful way. In particular, any valid presentation expression can be embedded in a content expression by placing it as the first child of a semantics element. The meaning of this wrapped expression should be indicated by one or more annotation elements also contained in the semantics element.

5.3.2 プレゼンテーションマークアップの中のコンテントマークアップ
Content Markup in Presentation Markup

コンテントマークアップは, 最終的な式が明確な描画を持ってさえいれば, プレゼンテーションマークアップに埋め込めるでしょう. つまり, 原則として, 組合せた式に現れるコンテントマークアップの各部分に対する, プレゼンテーションマークアップの部分を提供することが可能でなければなりません. コンテントマークアップの各部分を対応するプレゼンテーションマークアップで置き換える際には, 整形式のプレゼンテーションマークアップの式を提供すべきです. よって, プレゼンテーションマークアップ対応のプログラムは, 元の式に含まれるコンテントマークアップの部分を参照することなく, プレゼンテーションマークアップの式を処理できるべきです.

Content markup may be embedded within presentation markup so long as the resulting expression has an unambiguous rendering. That is, it must be possible, in principle, to produce a presentation markup fragment for each content markup fragment that appears in the combined expression. The replacement of each content markup fragment by its corresponding presentation markup should produce a well-formed presentation markup expression. A presentation engine should then be able to process this presentation expression without reference to the content markup bits included in the original expression.

一般に, この制約は, それぞれの埋め込まれたコンテント要素が, コンテントマークアップの式として整形式でなければならず, 何らかの含まれているコンテントマークアップの文脈の外でも単独で成立できなけらばならないことを意味しています. 結果として, 次のコンテント要素は, プレゼンテーション要素の途中の子要素として現れることはできないでしょう. annotation, annotation-xml, bvar, condition, degree, logbase, lowlimit, uplimit.

In general, this constraint means that each embedded content expression must be well-formed, as a content expression, and must be able to stand alone outside the context of any containing content markup element. As a result, the following content elements may not appear as an immediate child of a presentation element: annotation, annotation-xml, bvar, condition, degree, logbase, lowlimit, uplimit.

加えて, プレゼンテーションマークアップにおいて, コンテントマークアップは, プレゼンテーション素子要素の中に現れないかもしれません.

In addition, within presentation markup, content markup may not appear within presentation token elements.

5.4 並列のマークアップ
Parallel Markup

ソフトウェアの中には, プレゼンテーションマークアップとコンテントマークアップ両方の情報を利用するものもあります. 並列のマークアップは, 2つ以上のマークアップのツリー構造を同じ数式として組合せる方法です. 並列のマークアップは, semantics要素と一緒に成し遂げられます. 式に対する並列のマークアップは, それ単独で, もしくは大きなコンテントマークアップまたはプレゼンテーションマークアップのツリー構造の一部として認められるでしょう.

Some applications are able to use both presentation and content information. Parallel markup is a way to combine two or more markup trees for the same mathematical expression. Parallel markup is achieved with the semantics element. Parallel markup for an expression may appear on its own, or as part of a larger content or presentation tree.

5.4.1 並列のマークアップの一番上の要素
Top-level Parallel Markup

多くの場合, 目標は, 数式全体に対するプレゼンテーションマークアップとコンテントマークアップを提供することです. 単独のsemantics要素は, 2つのマークアップのツリー構造の組に利用されるでしょう. 1つの子要素がプレゼンテーションマークアップを提供し, 他の子要素がコンテントマークアップを提供するでしょう.

In many cases, the goal is to provide presentation markup and content markup for a mathematical expression as a whole. A single semantics element may be used to pair two markup trees, where one child element provides the presentation markup, and the other child element provides the content markup.

次の例は, ブール演算の式(a+b)(c+d)をこの方法でコード化しています.

The following example encodes the Boolean arithmetic expression (a+b)(c+d) in this way.

<semantics>
  <mrow>
    <mrow><mo>(</mo><mi>a</mi> <mo>+</mo> <mi>b</mi><mo>)</mo></mrow>
    <mo>&#x2062;<!--INVISIBLE TIMES--></mo>
    <mrow><mo>(</mo><mi>c</mi> <mo>+</mo> <mi>d</mi><mo>)</mo></mrow>
  </mrow>
  <annotation-xml encoding="MathML-Content">
    <apply><and/>
      <apply><xor/><ci>a</ci> <ci>b</ci></apply>
      <apply><xor/><ci>c</ci> <ci>d</ci></apply>
    </apply>
  </annotation-xml>
</semantics>

上のマークアップは, 最初の子要素であるプレゼンテーション要素に, annotation-xml要素の部分としてコンテントマークアップを付け加えていることに注意して下さい. 同一のことを, 最初の子要素としてのコンテントマークアップにannotation-xml要素の部分としてプレゼンテーションマークアップを付け加えても表せます.

Note that the above markup annotates the presentation markup as the first child element, with the content markup as part of the annotation-xml element. An equivalent form could be given that annotates the content markup as the first child element, with the presentation markup as part of the annotation-xml element.

5.4.2 相互参照を通した並列のマークアップ
Parallel Markup via Cross-References

大きなデータの式の一部を処理しなければならないソフトウェアを考慮に入れるために, MathMLは, semantics要素の対応する式の構造を特定するツリーの枝どうしの相互参照に対応します. これらの相互参照は, semantics要素の中で, idxref属性を利用して確立します. このsemantics要素の中のidxref属性の利用は, 利用者がsemantics要素の代替のツリーの枝の任意の式を選ぶことができるようにする最も良い方法として見られるべきです. idxref属性は, どちらのマークアップのMathML要素にも配置されるでしょう.

To accommodate applications that must process sub-expressions of large objects, MathML supports cross-references between the branches of a semantics element to identify corresponding sub-structures. These cross-references are established by the use of the id and xref attributes within a semantics element. This application of the id and xref attributes within a semantics element should be viewed as best practice to enable a recipient to select arbitrary sub-expressions in each alternative branch of a semantics element. The id and xref attributes may be placed on MathML elements of any type.

次の例は, ブール演算の式(a+b)(c+d)に対する相互参照を説明しています.

The following example demonstrates cross-references for the Boolean arithmetic expression (a+b)(c+d).

<semantics>
  <mrow id="E">
    <mrow id="E.1">
      <mo id="E.1.1">(</mo>
      <mi id="E.1.2">a</mi>
      <mo id="E.1.3">+</mo>
      <mi id="E.1.4">b</mi>
      <mo id="E.1.5">)</mo>
    </mrow>
    <mo id="E.2">&#x2062;<!--INVISIBLE TIMES--></mo>
    <mrow id="E.3">
      <mo id="E.3.1">(</mo>
      <mi id="E.3.2">c</mi>
      <mo id="E.3.3">+</mo>
      <mi id="E.3.4">d</mi>
      <mo id="E.3.5">)</mo>
    </mrow>
  </mrow>

  <annotation-xml encoding="MathML-Content">
    <apply xref="E">
      <and xref="E.2"/>
      <apply xref="E.1">
        <xor xref="E.1.3"/><ci xref="E.1.2">a</ci><ci xref="E.1.4">b</ci>
      </apply>
      <apply xref="E.3">
        <xor xref="E.3.3"/><ci xref="E.3.2">c</ci><ci xref="E.3.4">d</ci>
      </apply>
    </apply>
  </annotation-xml>
</semantics>

同じsemantics要素の中に現れるid属性に対応するxref属性は, 対応する式の部分どうしの相互参照を確立します.

An id attribute and associated xref attributes that appear within the same semantics element establish the cross-references between corresponding sub-expressions.

並列のマークアップにおいて, 何らかのxref属性によって参照される全てのid属性は, 囲っているsemantics要素の同じツリーの枝にあるべきです. この制限は, 相互参照がうかつな循環を作り出さないことを保証します. この制限は, 囲っているsemantics要素の他のツリーの枝でのid属性の使用を除外するものではありません. ただし, 同じsemantics要素から生じたそれら他のid属性への参照を除いてです.

For parallel markup, all of the id attributes referenced by any xref attribute should be in the same branch of an enclosing semantics element. This constraint guarantees that the cross-references do not create unintentional cycles. This restriction does not exclude the use of id attributes within other branches of the enclosing semantics element. It does, however, exclude references to these other id attributes originating from the same semantics element.

semantics要素のどちらのツリーの枝が参照先のid属性を含むかについては, 何の制限もありません. このことは, どちらのツリーの枝を利用するかを決めることにも適用されます.

There is no restriction on which branch of the semantics element may contain the destination id attributes. It is up to the application to determine which branch to use.

一般に, 並列のツリーの枝の要素の間に1対1の対応がある訳ではないでしょう. 例えば, プレゼンテーションマークアップのツリー構造は, かっこといった要素を持つでしょうが, コンテントマークアップのツリー構造には対応するものはありません. そのため, 最も細かく分けられた要素の構造を持つツリーの枝にid属性を付けることが, 大抵の場合に利用しやすいです. その場合, 全ての他のツリーの枝は, 一連のid属性に対するxref属性を持つでしょう.

In general, there will not be a one-to-one correspondence between nodes in parallel branches. For example, a presentation tree may contain elements, such as parentheses, that have no correspondents in the content tree. It is therefore often useful to put the id attributes on the branch with the finest-grained node structure. Then all of the other branches will have xref attributes to some subset of the id attributes.

他に基準が無いため, semantics要素の最初のツリーの枝は, id属性を含むのに懸命な選択です. その場合, 付加情報を加えたり外したりするソフトウェアは, 付加情報が変わってもこれらの属性を再割当てする必要は無いでしょう.

In absence of other criteria, the first branch of the semantics element is a sensible choice to contain the id attributes. Applications that add or remove annotations will then not have to re-assign these attributes as the annotations change.

一般に, idxref属性の利用は, せいぜい参照元より大きな固定の因子を持つ文章で与えられる式との間の完全な対応を認めています. 参照の方向は, 式の選択をsemantics要素の1つの子要素のみで認められるように暗にするべきではありません. どのツリーの枝にあるより小さなツリー構造を選ぶことや, 他のツリーの枝の対応するより小さなツリー構造を回復させることも同じように可能です.

In general, the use of id and xref attributes allows a full correspondence between sub-expressions to be given in text that is at most a constant factor larger than the original. The direction of the references should not be taken to imply that sub-expression selection is intended to be permitted only on one child of the semantics element. It is equally feasible to select a subtree in any branch and to recover the corresponding subtrees of the other branches.

相互参照を伴う並列のマークアップは, 前の節のブール代数の式が相互参照を含むOpenMathマークアップが付けられている次の例で示すように, 意味付加情報のXMLでコード化されたどのツリーの枝でも利用できるでしょう.

Parallel markup with cross-references may be used in any XML-encoded branch of the semantic annotations, as shown by the following example where the Boolean expression of the previous section is annotated with OpenMath markup that includes cross-references:

<semantics>
  <mrow id="EE">
    <mrow id="EE.1">
      <mo id="EE.1.1">(</mo>
      <mi id="EE.1.2">a</mi>
      <mo id="EE.1.3">+</mo>
      <mi id="EE.1.4">b</mi>
      <mo id="EE.1.5">)</mo>
    </mrow>
    <mo id="EE.2">&#x2062;<!--INVISIBLE TIMES--></mo>
    <mrow id="EE.3">
      <mo id="EE.3.1">(</mo>
      <mi id="EE.3.2">c</mi>
      <mo id="EE.3.3">+</mo>
      <mi id="EE.3.4">d</mi>
      <mo id="EE.3.5">)</mo>
    </mrow>
  </mrow>

  <annotation-xml encoding="MathML-Content">
    <apply xref="EE">
      <and xref="EE.2"/>
      <apply xref="EE.1">
        <xor xref="EE.1.3"/><ci xref="EE.1.2">a</ci><ci xref="EE.1.4">b</ci>
      </apply>
      <apply xref="EE.3">
        <xor xref="EE.3.3"/><ci xref="EE.3.2">c</ci><ci xref="EE.3.4">d</ci>
      </apply>
    </apply>
  </annotation-xml>

  <annotation-xml encoding="application/openmath+xml">
    <om:OMA xmlns:om="http://www.openmath.org/OpenMath" href="EE">
      <om:OMS name="and" cd="logic1" href="EE.2"/>

      <om:OMA href="EE.1">
        <om:OMS name="xor" cd="logic1" href="EE.1.3"/>
        <om:OMV name="a" href="EE.1.2"/>
        <om:OMV name="b" href="EE.1.4"/>
      </om:OMA>

      <om:OMA href="EE.3">
        <om:OMS name="xor" cd="logic1" href="EE.3.3"/>
        <om:OMV name="c" href="EE.3.2"/>
        <om:OMV name="d" href="EE.3.4"/>
      </om:OMA>
    </om:OMA>
  </annotation-xml>
</semantics>

ここで, OMA, OMS, OMVは, OpenMath標準で定義されている, それぞれ適用, 記号, 変数を表す要素です. OpenMath付加情報からの参照は, href属性により示されています. 前に注意したように, annotation-xmlの中でMathML, SVG, HTML以外の名前空間の利用は, HTML構文の中では有効と見なされません. コロンや名前空間接頭辞の付いた要素名の利用は, HTML処理プログラムが環境特有の名前(例えば)om:OMAという要素を生成したり, そのような要素が名前空間に配慮したXML処理プログラムによって構造化できないことから, 避けられるべきです.

Here OMA, OMS and OMV are elements defined in the OpenMath standard for representing application, symbol, and variable, respectively. The references from the OpenMath annotation are given by the href attributes. As noted above, the use of namespaces other than MathML, SVG or HTML within annotation-xml is not considered valid in the HTML syntax. Use of colons and namespace-prefixed element names should be avoided as the HTML parser will generate nodes with local name om:OMA (for example), and such nodes can not be constructed by a namespace-aware XML parser.

概要: 数学用マークアップ言語 (MathML) ヴァージョン 3.0 第2版
Overview: Mathematical Markup Language (MathML) Version 3.0 2nd Edition
前へ: 4 コンテントマークアップ
Previous: 4 Content Markup
次へ: 6 ホスト環境との相互作用
Next: 6 Interactions with the Host Environment