MathML in JSim

Introduction

MathML is a W3C standard specification for describing mathematics content and presentation markup. As well as being useful in itself, MathML is used as part of the CellML and SBML model specifications. This document discusses MathML export from JSim. JSim currently supports import of MathML only when it is embedded in CellML or SBML.

Prerequisites:

Contents:

  • MathML Basics
  • JSim MathML Scope and Usage
  • Creating Graphics from JSim MathML Output
  • Implementation Details
  • Comments or Questions?
    Give feedback

MathML Basics

MathML documents may specify either content or presentation markup. Content markup describes the underlying mathematic structure of a mathematical expression. Presentation markup describes the graphical layout of mathematical symbols. For example, the underlying content "A multiplied by B" might be presented in any of the following manners:

      A * B
      A x B
      A . B
      AB
      (A)(B)

Content markup is most often used mathematical processing packages or documents, such as CellML and SBML. Presentation markup is used by graphics packages to produce publication quality equation graphics.

A complete description of MathML is beyond the scope of this document. Those interested in the reasoning behind MathML design, and specifics of the implementation should consult the MathML home page

JSim MathML Scope and Usage

JSim generates MathML content markup for MML models as an XHTML document with one equation per paragraph. The equations are in the form of MathML content markup. This document will be rendered properly in MathML-enabled browsers after the addition of an appropriate stylesheet (see below ). Most MML equations translate to MathML properly. There are certain limitations to models contains events, functions and procedures. For further information, see Implementaton Details.

You can export MathML from either the JSim GUI or jsbatch . In the JSim GUI, select "View MathML" from the View menu in the model's Debug tab. In jsbatch, use the -mathml switch:

      jsbatch -f test.mod -omathml > test.xml

Both options above require successful model compilation.

There is currently no JSim options to tailor MathML output. Any needed output editing must be done in external packages, such as text, XML or MathML editors.

Note that generated models compiled with "unit correction on;" will include conversion factors in the MathML output. If you don't want to include such factors, modify the MML to "unit correction off;" and recompile. We realize this approach is rather awkward, and will work out a simpler methodology in the future.

Creating Graphics from JSim MathML Output

The generated .xml output requires a style sheet for proper graphic rendering. A style sheet provides information to a MathML-enabled browser on how to render MathML. See the MathML XSL Overview for a specific example.

Example usage: Download mathml.xsl and related files from the above link, place them in the same directory as the output .xml file, and insert the following as the 2nd line of the .xml:

      <?xml-stylesheet type="text/xsl" href="mathml.xsl"?>

The .xml should now render passable graphics in an MathML-enabled browser.

Implementation Details

This section describes details and quirks of the MML to MathML conversion process.

MML "when" clauses are translated to MathML "condition" tags.

MML events are not translated to MathML. These constructs are procedural (rather than mathematical) and, as such, have no obvious counterpart in MathML.

Code definition blocks and library references in MML functions and procedures are not translated to MathML (see events above). However, calls to functions, as part of an mathematical equation, are translated.

The integral operator "integral(t=t.min to t.max, u)" is not yet translated properly to MathML. However, the form "integral(u@t)" is.

Comments or Questions?

Give feedback

 

Model development and archiving support at https://www.imagwiki.nibib.nih.gov/physiome provided by the following grants: NIH U01HL122199 Analyzing the Cardiac Power Grid, 09/15/2015 - 05/31/2020, NIH/NIBIB BE08407 Software Integration, JSim and SBW 6/1/09-5/31/13; NIH/NHLBI T15 HL88516-01 Modeling for Heart, Lung and Blood: From Cell to Organ, 4/1/07-3/31/11; NSF BES-0506477 Adaptive Multi-Scale Model Simulation, 8/15/05-7/31/08; NIH/NHLBI R01 HL073598 Core 3: 3D Imaging and Computer Modeling of the Respiratory Tract, 9/1/04-8/31/09; as well as prior support from NIH/NCRR P41 RR01243 Simulation Resource in Circulatory Mass Transport and Exchange, 12/1/1980-11/30/01 and NIH/NIBIB R01 EB001973 JSim: A Simulation Analysis Platform, 3/1/02-2/28/07.