Skip to content

MathML-Next Ideas #68

@AdamSobieski

Description

@AdamSobieski

Introduction

Some ideas for MathML4 are presented. Comments and discussion are welcomed.

Presentation, Semantics, Metadata and Extensibility

Presentation and Semantics

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/xhtml+xml">...</annotation-xml>
    <annotation-xml encoding="application/svg+xml">...</annotation-xml>
    <annotation encoding="image/png" src="data:..." />
    <annotation-xml encoding="MathML-Presentation">...</annotation-xml>
  </presentation>
  <semantics>
    <annotation-xml encoding="application/openmath+xml">...</annotation-xml>
    <annotation-xml encoding="MathML-Content">...</annotation-xml>
  </semantics>
</math>

Metadata

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/xhtml+xml">...</annotation-xml>
    <annotation-xml encoding="application/svg+xml">...</annotation-xml>
    <annotation encoding="image/png" src="data:..." />
    <annotation-xml encoding="MathML-Presentation">...</annotation-xml>
  </presentation>
  <semantics>
    <annotation-xml encoding="application/openmath+xml">...</annotation-xml>
    <annotation-xml encoding="MathML-Content">...</annotation-xml>
  </semantics>
  <metadata>
    <annotation-xml encoding="application/rdf+xml">...</annotation-xml>
    <annotation encoding="application/json+ld">...</annotation>
  </metadata>
</math>

Extensibility

Are there any other varieties of content for a mathematical expression beyond “presentation”, “semantics” and “metadata”? Might we want to include “other” for extensibility?

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/xhtml+xml">...</annotation-xml>
    <annotation-xml encoding="application/svg+xml">...</annotation-xml>
    <annotation encoding="image/png" src="data:..." />
    <annotation-xml encoding="MathML-Presentation">...</annotation-xml>
  </presentation>
  <semantics>
    <annotation-xml encoding="application/openmath+xml">...</annotation-xml>
    <annotation-xml encoding="MathML-Content">...</annotation-xml>
  </semantics>
  <metadata>
    <annotation-xml encoding="application/rdf+xml">...</annotation-xml>
    <annotation encoding="application/json+ld">...</annotation>
  </metadata>
  <other rel="http://www.example.com/semantic-uri/">
    <annotation-xml encoding="...">...</annotation-xml>
  </other>
</math>

Would content which interrelates mathematical expressions, e.g. for mathematical proofs, be expression “metadata” or “other” content? Would derivations of mathematical expressions be expression “metadata” or “other” content?

Selecting Content from Alternatives and Content Negotiation

Algorithms for selecting “presentation”, “semantic”, “metadata” or “other” content from alternatives may resemble agent-driven or reactive content negotiation.

Together with the encoding attribute, lang, notation, media, and q attributes can facilitate content selection from alternatives in a manner which resembles HTTP-based content negotiation for mathematical content.

See also: MathML3 <annotation> element
See also: MathML3 <annotation-xml> element
See also: HTML5 <source> element

Internationalization

For scenarios where natural language is utilized in the “presentation” annotation content, a BCP47 language attribute can adorn annotation markup and “presentation” annotations can also be described in expression “metadata”.

<math id="eq1">
  <presentation>
    <annotation-xml lang="en" encoding="MathML-Presentation">...</annotation-xml>
    <annotation-xml lang="fr" encoding="MathML-Presentation">...</annotation-xml>
  </presentation>
  <semantics>
    <annotation-xml encoding="MathML-Content">...</annotation-xml>
  </semantics>
  <metadata>
    <annotation-xml encoding="application/rdf+xml">...</annotation-xml>
  </metadata>
</math>

Multimodality

“Presentation” annotations can include content spanning multiple modalities, e.g. SSML or audio, and “presentation” annotations can also be described in expression “metadata”.

<math id="eq1">
  <presentation>
    <annotation-xml lang="en" encoding="MathML-Presentation">...</annotation-xml>
    <annotation-xml lang="fr" encoding="MathML-Presentation">...</annotation-xml>
    <annotation-xml lang="en" encoding="application/ssml+xml">...</annotation-xml>
    <annotation-xml lang="fr" encoding="application/ssml+xml">...</annotation-xml>
    <annotation lang="en" encoding="audio/mpeg" src="..." />
    <annotation lang="fr" encoding="audio/mpeg" src="..." />
  </presentation>
  <semantics>
    <annotation-xml encoding="MathML-Content">...</annotation-xml>
  </semantics>
  <metadata>
    <annotation-xml encoding="application/rdf+xml">...</annotation-xml>
  </metadata>
</math>

Notation

Might the values of a notation attribute be the display names of notations, URI’s, or encoded strings resembling BCP47? Might the values of a notation attribute be, instead, lists of settings and their values resembling the style attribute?

<math id="eq1">
  <presentation>
    <annotation-xml notation="Notation 1" encoding="MathML-Presentation">...</annotation-xml>
    <annotation-xml notation="Notation 2" encoding="MathML-Presentation">...</annotation-xml>
    <annotation-xml notation="Notation 3" encoding="MathML-Presentation">...</annotation-xml>
  </presentation>
  <semantics>
    <annotation-xml encoding="MathML-Content">...</annotation-xml>
  </semantics>
  <metadata>
    <annotation-xml encoding="application/rdf+xml">...</annotation-xml>
  </metadata>
</math>

The following example shows a combination of multiple presentation formats with multiple notations.

<math id="eq1">
  <presentation>
    <annotation-xml notation="Notation 1" encoding="application/xhtml+xml">...</annotation-xml>
    <annotation-xml notation="Notation 2" encoding="application/xhtml+xml">...</annotation-xml>
    <annotation-xml notation="Notation 3" encoding="application/xhtml+xml">...</annotation-xml>
    <annotation-xml notation="Notation 1" encoding="application/svg+xml">...</annotation-xml>
    <annotation-xml notation="Notation 2" encoding="application/svg+xml">...</annotation-xml>
    <annotation-xml notation="Notation 3" encoding="application/svg+xml">...</annotation-xml>
    <annotation notation="Notation 1" encoding="image/png" src="data:..." />
    <annotation notation="Notation 2" encoding="image/png" src="data:..." />
    <annotation notation="Notation 3" encoding="image/png" src="data:..." />
    <annotation-xml notation="Notation 1" encoding="MathML-Presentation">...</annotation-xml>
    <annotation-xml notation="Notation 2" encoding="MathML-Presentation">...</annotation-xml>
    <annotation-xml notation="Notation 3" encoding="MathML-Presentation">...</annotation-xml>
  </presentation>
  <semantics>
    <annotation-xml encoding="application/openmath+xml">...</annotation-xml>
    <annotation-xml encoding="MathML-Content">...</annotation-xml>
  </semantics>
  <metadata>
    <annotation-xml encoding="application/rdf+xml">...</annotation-xml>
  </metadata>
</math>

Media Queries

A media attribute can facilitate the use of media queries. “Presentation” annotations can also be described in expression “metadata”.

<math id="eq1">
  <presentation>
    <annotation-xml encoding="MathML-Presentation">...</annotation-xml>
    <annotation media="(resolution >= 2dppx)" encoding="image/png" src="eq1-high.png" />
    <annotation media="(resolution < 2dppx)" encoding="image/png" src="eq1-low.png" />
    <annotation-xml media="speech" encoding="application/ssml+xml">...</annotation-xml>
    <annotation media="speech" encoding="audio/mpeg" src="..." />
  </presentation>
  <metadata>
    <annotation-xml encoding="application/rdf+xml">...</annotation-xml>
  </metadata>
</math>

Quality Scores

<math id="eq1">
  <presentation>
    <annotation-xml q="0.9" encoding="application/xhtml+xml">...</annotation-xml>
    <annotation-xml q="0.9" encoding="application/svg+xml">...</annotation-xml>
    <annotation q="0.9" encoding="image/png" src="data:..." />
    <annotation-xml q="1.0" encoding="MathML-Presentation">...</annotation-xml>
  </presentation>
</math>

Remote Content

Remote Resources

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/xhtml+xml" src="eq1.xhtml" />
    <annotation-xml encoding="application/svg+xml" src="eq1.svg" />
    <annotation encoding="image/png" src="eq1.png" />
    <annotation-xml encoding="MathML-Presentation" src="eq1.mmlp" />
  </presentation>
  <semantics>
    <annotation-xml encoding="application/openmath+xml" src="eq1.om" />
    <annotation-xml encoding="MathML-Content" src="eq1.mmlc" />
  </semantics>
</math>

Remote Components

Perhaps utilizing HTTP-based agent-driven or reactive content negotiation, URL’s could be provided for “presentation”, “semantics” and “metadata” components.

<math id="eq1">
  <presentation src="presentation.php?eq=eq1" />
  <semantics src="semantics.php?eq=eq1" />
  <metadata src="metadata.php?eq=eq1" />
</math>

Alternatively, via a “partial” keyword or Boolean attribute, multiple MathML files could be merged together into mathematical expressions.

URL String Interpolation, Templating and Formatting

Described are uses of a pattern attribute for providing string templates with which string interpolation algorithms can produce values for src attributes on <annotation> and <annotation-xml> elements.

A pattern attribute could be of use for specifying string interpolation placeholders in URL query strings.

<math id="eq1">
  <presentation>
    <annotation-xml pattern="math.php?equation=eq1&amp;type={encoding}&amp;language={lang}" />
  </presentation>
</math>

A pattern attribute could also be of use for specifying string interpolation placeholders in file names and paths.

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/mathml-presentation+xml" pattern="eq1-{lang}.mmlp" />
  </presentation>
</math>

Media queries could be utilized via a media attribute.

<math id="eq1">
  <presentation>
    <annotation media="(resolution >= 2dppx)" encoding="image/png" pattern="math.php?equation=eq1&amp;type=image%2Fpng&amp;notation={notation}&amp;resolution=high" />
    <annotation media="(resolution < 2dppx)" encoding="image/png" pattern="math.php?equation=eq1&amp;type=image%2Fpng&amp;notation={notation}&amp;resolution=low" />
  </presentation>
</math>

Those <annotation-xml> and <annotation> elements with encoding, lang, notation, media, or q attributes could be described as “more specific” and thus to be utilized first when matching for content selection.

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/ssml+xml" pattern="math-synthesis.php?equation=eq1&amp;language={lang}" />
    <annotation encoding="audio/mpeg" pattern="math-audio.php?equation=eq1&amp;type=audio%2Fmpeg&amp;language={lang}" />
    <annotation-xml pattern="math.php?equation=eq1&amp;type={encoding}&amp;language={lang}&amp;notation={notation}" />
  </presentation>
</math>

The encoding attribute, the lang attribute and possibly the notation attribute could be utilized with multiple, delimited (e.g. space delimited) values for specifying when a pattern is valid.

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/mathml-presentation+xml application/xhtml+xml application/svg+xml" lang="en fr es de" pattern="math.php?equation=eq1&amp;type={encoding}&amp;language={lang}&amp;notation={notation}" />
    <annotation encoding="image/png" lang="en fr es de" pattern="math.php?equation=eq1&amp;type={encoding}&amp;language={lang}&amp;notation={notation}" />
  </presentation>
</math>
<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/mathml-presentation+xml" lang="en fr es de" pattern="eq1-{lang}.mmlp" />
  </presentation>
</math>

There is a caveat to delimiting MIME types with spaces in that MIME types can have parameters and spaces could exist between MIME types and their parameters as well as in the quoted string values of their parameters, for instance when specifying codecs.

See: RFC 7231 § 3.1.1.1, RFC 6381

MIME types with spaces can be observed in the HTML5 specification, e.g. HTML5 <source> element § Example 18.

audio/ogg; codecs=speex

If spaces are desired to delimit sets or lists of MIME types, then collapsing spaces in MIME types, including those with complex parameter values, e.g. codecs, would be required.

<math id="eq1">
  <presentation>
    <annotation encoding="audio/ogg;codecs=speex audio/mpeg" pattern="math-audio.php?equation=eq1&amp;type={encoding}&amp;language={lang}" />
  </presentation>
</math>

A fuller set of placeholders can be created for URL string interpolation. For example, a customizable filename {extension} placeholder can be derived from the encoding selected.

<math id="eq1">
  <presentation>
    <annotation-xml encoding="application/mathml-presentation+xml application/xhtml+xml application/svg+xml" lang="en fr es de" pattern="eq1-{lang}.{extension}" />
  </presentation>
</math>

See also: printf format string
See also: String interpolation
See also: Template processing

Remote Mathematical Expressions

Remote mathematical expressions could be facilitated via a src attribute on <math> elements.

<math id="eq1" src="eq1.mml" />

Additionally, HTML5 <img> and <object> elements could be of use.

<img id="eq1" src="eq1.mml" />
<object id="eq1" data="eq1.mml" type="application/mathml+xml" />

See also: HTML5 <img> element
See also: HTML5 <object> element

Metadata

Metadata

Assignees

No one assigned

    Labels

    MathML-NextIdeas for future releasescompatibilityIssues affecting backward compatibilityenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions