libSBML Perl API  5.20.4
Loading...
Searching...
No Matches
L3ParserSettings Class Reference

Detailed Description

Controls the behavior of the Level 3 formula parser.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.

The function , along with its variants and , are the interfaces to a parser for mathematical formulas written as text strings. The inverse function is and its variants such as The parsers and the formula writers convert between a text-string representation of mathematical formulas and Abstract Syntax Trees (ASTs), represented in libSBML using ASTNode objects. Compared to the parser and writer implemented by the functions and , which were designed primarily for converting the mathematical formula strings in SBML Level 1, the SBML Level 3 or "L3" variants of the parser and writer use an extended formula syntax. They also have a number of configurable behaviors. This class (L3ParserSettings) is an object used to communicate the configuration settings with callers.

The following aspects of the parser are configurable using L3ParserSettings objects. (For the formula writer, only a subset of these settings is relevant; please see the documentation for for more information about which ones).

  • A Model object may optionally be provided to use identifiers (values of type SId) from the model in preference to pre-defined MathML symbols More precisely, the Model entities whose identifiers will shadow identical symbols in the mathematical formula are: Species, Compartment, Parameter, Reaction, and SpeciesReference. For instance, if the parser is given a Model containing a Species with the identifier "pi", and the formula to be parsed is "3*pi", the MathML produced by the parser will contain the construct <ci> pi </ci> instead of the construct <pi/>. Another example, if the passed-in Model contains a FunctionDefinition with the identifier "sin", that function will be used instead of the predefined MathML function <sin/>.
  • The function log with a single argument ("log(x)") can be parsed as log10(x), ln(x), or treated as an error, as desired.
  • Unary minus signs can be either collapsed or preserved; that is, the parser can either (1) remove sequential pairs of unary minuses (e.g., "- -3") from the input and incorporate single unary minuses into the number node, or (2) preserve all minuses in the AST node structure, turning them into ASTNode objects of type
  • The character sequence "number id" can be interpreted as a numerical value number followed by units of measurement indicated by id, or it can be treated as a syntax error. (In Level 3, MathML <cn> elements can have an attribute named units placed in the SBML namespace, which can be used to indicate the units to be associated with the number. The text-string infix formula parser allows units to be placed after raw numbers; they are interpreted as unit identifiers for units defined by the SBML specification or in the containing Model object.)
  • The symbol avogadro can be parsed either as a MathML csymbol or as a identifier. More specifically, "avogadro" can be treated as an ASTNode of type or of type
  • Strings that match built-in functions and constants can either be parsed as a match regardless of capitalization, or may be required to be all-lower-case to be considered a match.
  • LibSBML plug-ins implementing support for SBML Level 3 packages may introduce extensions to the syntax understood by the parser. The precise nature of the extensions will be documented by the individual package plug-ins. An example of a possible extension is a notation for vectors and arrays, introduced by the SBML Level 3 Arrays package.

To obtain the default configuration values, callers can use the function . To change the configuration, callers can create an L3ParserSettings object, set the desired characteristics using the methods provided, and pass that object to

See also

Public Member Functions

bool getComparisonCaseSensitivity () const
 Returns true if the parser is configured to match built-in symbols in a case-insensitive way.
 
const ModelgetModel () const
 Returns the Model object referenced by this L3ParserSettings object.
 
bool getParseAvogadroCsymbol () const
 Indicates the current behavior set for handling avogadro for SBML Level 3.
 
bool getParseCollapseMinus () const
 Indicates the current behavior set for handling multiple unary minuses in formulas.
 
bool getParseL3v2Functions () const
 Indicates the current behavior set for handling whether to parse the functions added in L3v2 as that MathML or not.
 
ParseLogType_t getParseLog () const
 Indicates the current behavior set for handling the function log with one argument.
 
bool getParseModuloL3v2 () const
 Indicates the current behavior set for handling the % symbol in mathematical formulas.
 
bool getParsePackageMath (ExtendedMathType_t package) const
 Indicates the current behavior set for handling whether to parse the functions added in the given package as that MathML or not.
 
bool getParseUnits () const
 Indicates the current behavior set for handling units in text-string mathematical formulas.
 
 L3ParserSettings ()
 Creates a new L3ParserSettings object with default values.
 
 L3ParserSettings (const L3ParserSettings &source)
 Copy constructor.
 
 L3ParserSettings (Model *model, ParseLogType_t parselog, bool collapseminus, bool parseunits, bool avocsymbol, bool caseSensitive=false, SBMLNamespaces *sbmlns=NULL, bool moduloL3v2=false, bool l3v2functions=false)
 Creates a new L3ParserSettings object with specific values for all possible settings.
 
L3ParserSettingsoperator= (const L3ParserSettings &source)
 Assignment operator.
 
void setComparisonCaseSensitivity (bool strcmp)
 Sets the parser's behavior with respect to case sensitivity for recognizing predefined symbols.
 
void setModel (const Model *model)
 Sets the model reference in this L3ParserSettings object.
 
void setParseAvogadroCsymbol (bool l2only)
 Sets the parser's behavior in handling the symbol avogadro in mathematical formulas.
 
void setParseCollapseMinus (bool collapseminus)
 Sets the behavior for handling unary minuses appearing in mathematical formulas.
 
void setParseL3v2Functions (bool l3v2functions)
 Sets the behavior for handling functions added in SBML L3v2.
 
void setParseLog (ParseLogType_t type)
 Sets the behavior for handling log in mathematical formulas.
 
void setParseModuloL3v2 (bool modulol3v2)
 Sets the behavior for handling the % symbol in mathematical formulas.
 
void setParsePackageMath (ExtendedMathType_t package, bool parsepackage)
 Sets the behavior for handling functions added in SBML packages.
 
void setParseUnits (bool units)
 Sets the parser's behavior in handling units associated with numbers in a mathematical formula.
 
void unsetModel ()
 Unsets the Model reference in this L3ParserSettings object.
 
virtual ~L3ParserSettings ()
 Destroys this L3ParserSettings object.
 

Constructor & Destructor Documentation

◆ L3ParserSettings() [1/3]

L3ParserSettings::L3ParserSettings ( )

Creates a new L3ParserSettings object with default values.

This is the default constructor for the L3ParserSettings object. It sets the stored Model object to NULL and sets the following field values in the L3ParserSettings object:

  • parseunits ("parse units") is set to
  • collapseminus ("collapse minus") is set to
  • parselog ("parse log") is set to
  • avocsymbol ("Avogadro csymbol") is set to
  • caseSensitive ("case sensitive") is set to
  • moduloL3v2 ("modulo l3v2") is set to
  • sbmlns ("SBML namespaces") is set to NULL (which indicates that no syntax extensions due to SBML Level 3 packages will be assumed—the formula parser will only understand the core syntax described in the documentation for ).

◆ L3ParserSettings() [2/3]

L3ParserSettings::L3ParserSettings ( Model model,
ParseLogType_t  parselog,
bool  collapseminus,
bool  parseunits,
bool  avocsymbol,
bool  caseSensitive = false,
SBMLNamespaces sbmlns = NULL,
bool  moduloL3v2 = false,
bool  l3v2functions = false 
)

Creates a new L3ParserSettings object with specific values for all possible settings.

Parameters
modela Model object to be used for disambiguating identifiers encountered by in mathematical formulas.
parselog("parse log") a flag that controls how the parser will handle the symbol log in mathematical formulas. The function log with a single argument ("log(x)") can be parsed as log10(x), ln(x), or treated as an error, as desired, by using the parameter values , , or , respectively.
collapseminus("collapse minus") a flag that controls how the parser will handle minus signs in formulas. Unary minus signs can be collapsed or preserved; that is, sequential pairs of unary minuses (e.g., "- -3") can be removed from the input entirely and single unary minuses can be incorporated into the number node, or all minuses can be preserved in the AST node structure. The possible values of this field are (to collapse unary minuses) and (to expand unary minuses).
parseunits("parse units") a flag that controls how the parser will handle apparent references to units of measurement associated with raw numbers in a formula. If set to the value , units are parsed; if set to the value , units are not parsed.
avocsymbol("Avogadro csymbol") a flag that controls how the parser will handle the appearance of the symbol avogadro in a formula. If set to the value , the symbol is interpreted as the SBML/MathML csymbol avogadro; if set to the value , the symbol is interpreted as a plain symbol name.
caseSensitive("case sensitive") a flag that controls how the cases of alphabetical characters are treated when symbols are compared. If the flag is set to the value , symbols are compared in a case-insensitive manner, which means that mathematical functions such as "sin" will be matched no matter what their case is: "Sin", "SIN", etc. If the flag is set to the value , symbols are interpreted in a case-sensitive manner.
sbmlns("SBML namespaces") an SBML namespaces object. The namespaces identify the SBML Level 3 packages that can extend the syntax understood by the formula parser. When non-NULL, the parser will interpret additional syntax defined by the packages; for example, it may understand vector/array extensions introduced by the SBML Level 3 Arrays package.
moduloL3v2("modulo L3v2") a flag that controls how the parser will handle the % ('modulo') symbol in formulas. By default, the parser will convert 'a % b' to a piecewise function that properly calculates the remainder of a with respect to be, but the parser can also be set to produce the MathML rem function, should the target of the produced ASTNode be an SBML Level 3 Version 2 document, where the rem function is legal. The possible values of this field are (to parse % as a piecewise function) and (to parse % as rem).
l3v2functions("parse L3v2 functions directly") is a Boolean flag that controls how to translate certain mathematical functions added in SBML Level 3 Version 2 Core. The parser can either turn them into specific AST node types, or turn them all into with the name set to the function name in question.
Documentation note:
The native C++ implementation of this method defines a default argument value. In the documentation generated for different libSBML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java and C#, a default argument is handled by declaring two separate methods, with one of them having the argument and the other one lacking the argument. However, the libSBML documentation will be identical for both methods. Consequently, if you are reading this and do not see an argument even though one is described, please look for descriptions of other variants of this method near where this one appears in the documentation.
See also
getModel()
setModel( )
unsetModel()
getParseLog()
setParseLog( )
getParseUnits()
setParseUnits( )
getParseCollapseMinus()
setParseCollapseMinus( )
getParseAvogadroCsymbol()
setParseAvogadroCsymbol( )
getParseModuloL3v2()
setParseModuloL3v2( )
getParseL3v2Functions()
setParseL3v2Functions( )

◆ L3ParserSettings() [3/3]

L3ParserSettings::L3ParserSettings ( const L3ParserSettings source)

Copy constructor.

Parameters
sourcethe instance to copy.

◆ ~L3ParserSettings()

L3ParserSettings::~L3ParserSettings ( )
virtual

Destroys this L3ParserSettings object.

Member Function Documentation

◆ getComparisonCaseSensitivity()

bool L3ParserSettings::getComparisonCaseSensitivity ( ) const

Returns true if the parser is configured to match built-in symbols in a case-insensitive way.

By default (which is the value ), the parser compares symbols in a case insensitive manner for built-in functions such as "sin" and "piecewise", and for constants such as "true" and "avogadro". Setting this option to causes the parser to become case sensitive. In that mode, for example, the symbols "sin" and "true" will match the built-in values, but the symbols "SIN", "Sin", "True", "TRUE", and so on, will not.
Returns
true if matches are done in a case-sensitive manner, and false if the parser will recognize built-in functions and constants regardless of case,.
See also
setComparisonCaseSensitivity( )

◆ getModel()

const Model * L3ParserSettings::getModel ( ) const

Returns the Model object referenced by this L3ParserSettings object.

When a Model object is provided, identifiers (values of type SId) from that model are used in preference to pre-defined MathML symbol definitions. More precisely, the Model entities whose identifiers will shadow identical symbols in the mathematical formula are: Species, Compartment, Parameter, Reaction, and SpeciesReference. For instance, if the parser is given a Model containing a Species with the identifier "pi", and the formula to be parsed is "3*pi", the MathML produced will contain the construct <ci> pi </ci> instead of the construct <pi/>. Similarly, when a Model object is provided, SId values of user-defined functions present in the Model will be used preferentially over pre-defined MathML functions. For example, if the passed-in Model contains a FunctionDefinition with the identifier "sin", that function will be used instead of the predefined MathML function <sin/>.
See also
setModel( )
unsetModel()

◆ getParseAvogadroCsymbol()

bool L3ParserSettings::getParseAvogadroCsymbol ( ) const

Indicates the current behavior set for handling avogadro for SBML Level 3.

SBML Level 3 defines a symbol for representing the value of Avogadro's constant, but it is not defined in SBML Level 2. As a result, the text-string formula parser must behave differently depending on which SBML Level is being targeted. For Level 3 documents, it can interpret instances of avogadro in the input as a reference to the MathML csymbol for Avogadro's constant defined in the SBML Level 3 specification. For Level 2, it must treat avogadro as just another plain symbol.

This method returns the current setting of the avogadro-handling behavior in this L3ParserSettings object. The possible values are as follows:

  • (value = true): tells the parser to translate the string avogadro (in any capitalization) into an AST node of type
  • (value = false): tells the parser to translate the string avogadro into an AST of type
Returns
A boolean indicating which mode is currently set; one of

or

See also
setParseAvogadroCsymbol( )

◆ getParseCollapseMinus()

bool L3ParserSettings::getParseCollapseMinus ( ) const

Indicates the current behavior set for handling multiple unary minuses in formulas.

This setting affects two behaviors. First, pairs of multiple unary minuses in a row (e.g., "- -3") can be collapsed and ignored in the input, or the multiple minuses can be preserved in the AST node tree that is generated by the parser. Second, minus signs in front of numbers can be collapsed into the number node itself; for example, a "- 4.1" can be turned into a single ASTNode of type with a value of -4.1, or it can be turned into a node of type having a child node of type .
Returns
A boolean indicating the behavior currently set. The possible values are as follows:
  • (value = true): collapse unary minuses where possible.
  • (value = false): do not collapse unary minuses, and instead translate each one into an AST node of type
See also
setParseCollapseMinus( )

◆ getParseL3v2Functions()

bool L3ParserSettings::getParseL3v2Functions ( ) const

Indicates the current behavior set for handling whether to parse the functions added in L3v2 as that MathML or not.

This setting affects whether the names of functions added in SBML Level 3 Version 2 are parsed as those added MathML functions, or whether they are added as generic functions with those names (to be used in SBML as function definitions).
Returns
A boolean indicating the behavior currently set. The possible values are as follows:
  • (value = true): parse the strings rateOf, implies, max, min, quotient, and rem as , , , , , and , respectively.
  • (value = false): parse the strings rateOf, implies, max, min, quotient, and rem all as with the appropriate name set.
See also
setParseL3v2Functions( )

◆ getParseLog()

ParseLogType_t L3ParserSettings::getParseLog ( ) const

Indicates the current behavior set for handling the function log with one argument.

The function log with a single argument ("log(x)") can be parsed as log10(x), ln(x), or treated as an error, as desired. These three possible behaviors are indicated, respectively, by the values , , and

Returns
One of following three constants:
See also
setParseLog( )

◆ getParseModuloL3v2()

bool L3ParserSettings::getParseModuloL3v2 ( ) const

Indicates the current behavior set for handling the % symbol in mathematical formulas.

This setting affects whether the % symbol (modulo) is parsed as a piecewise equation that returns the modulo value of the entries on either side of the symbol, or whether it is parsed as the MathML 'rem' function, which was allowed in SBML Level 3 Version 2, but not in previous level/versions. The latter is more succinct, but might not be legal SBML for the desired target SBML document.
Returns
A boolean indicating the behavior currently set. The possible values are as follows:
  • (value = true): use the 'rem' MathML function ( ).
  • (value = false): use a piecewise function ( ) to encode the modulo rule explicitly.
See also
setParseModuloL3v2( )

◆ getParsePackageMath()

bool L3ParserSettings::getParsePackageMath ( ExtendedMathType_t  package) const

Indicates the current behavior set for handling whether to parse the functions added in the given package as that MathML or not.

This setting affects whether the math added in a given SBML Level 3 package are parsed as those added MathML elements, or whether they are added as generic functions or variables with those names.
Parameters
packagean ExtendedMathType_t indicating the extended math package to be set.
Returns
A boolean indicating the behavior currently set. The possible values are as follows:
  • (value = true): parse any string defined in a given SBML L3 package as its corresponding ASTType_t.
  • (value = false): parse any string that would have been defined in the given SBML L3 package as or

    with the appropriate name set.

See also
setParsePackageMath( )

◆ getParseUnits()

bool L3ParserSettings::getParseUnits ( ) const

Indicates the current behavior set for handling units in text-string mathematical formulas.

In SBML Level 2, there is no means of associating a unit of measurement with a pure number in a formula, while SBML Level 3 does define a syntax for this. In Level 3, MathML <cn> elements can have an attribute named units placed in the SBML namespace, which can be used to indicate the units to be associated with the number. The text-string infix formula parser allows units to be placed after raw numbers; they are interpreted as unit identifiers for units defined by the SBML specification or in the containing Model object. Some examples include: "4 mL", "2.01 Hz", "3.1e-6 M", and "(5/8) inches". To produce a valid SBML model, there must either exist a UnitDefinition corresponding to the identifier of the unit, or the unit must be defined in Table 2 of the SBML Level 3 specification.

Since SBML Level 2 does not have the ability to associate units with pure numbers, the value should be expected to be false ( ) when parsing text-string formulas intended for use in SBML Level 2 documents.

Returns
A boolean indicating whether to parse units. The possible values are as follows:
  • (value = true): parse units in the text-string formula.
  • (value = false): treat units in the text-string formula as errors.
See also
setParseUnits( )

◆ operator=()

L3ParserSettings & L3ParserSettings::operator= ( const L3ParserSettings source)

Assignment operator.

◆ setComparisonCaseSensitivity()

void L3ParserSettings::setComparisonCaseSensitivity ( bool  strcmp)

Sets the parser's behavior with respect to case sensitivity for recognizing predefined symbols.

By default (which is the value ), the parser compares symbols in a case insensitive manner for built-in functions such as "sin" and "piecewise", and for constants such as "true" and "avogadro". Setting this option to causes the parser to become case sensitive. In that mode, for example, the symbols "sin" and "true" will match the built-in values, but the symbols "SIN", "Sin", "True", "TRUE", and so on, will not.
Parameters
strcmpa boolean indicating whether to be case sensitive (if true) or be case insensitive (if false).
See also
getComparisonCaseSensitivity()

◆ setModel()

void L3ParserSettings::setModel ( const Model model)

Sets the model reference in this L3ParserSettings object.

When a Model object is provided, identifiers (values of type SId) from that model are used in preference to pre-defined MathML symbol definitions. More precisely, the Model entities whose identifiers will shadow identical symbols in the mathematical formula are: Species, Compartment, Parameter, Reaction, and SpeciesReference. For instance, if the parser is given a Model containing a Species with the identifier "pi", and the formula to be parsed is "3*pi", the MathML produced will contain the construct <ci> pi </ci> instead of the construct <pi/>. Similarly, when a Model object is provided, SId values of user-defined functions present in the Model will be used preferentially over pre-defined MathML functions. For example, if the passed-in Model contains a FunctionDefinition with the identifier "sin", that function will be used instead of the predefined MathML function <sin/>.
Parameters
modela Model object to be used for disambiguating identifiers.
Warning
This does not copy the Model object. This means that modifications made to the Model after invoking this method may affect parsing behavior, because the parser will query the current contents of the model.
See also
getModel()
unsetModel()

◆ setParseAvogadroCsymbol()

void L3ParserSettings::setParseAvogadroCsymbol ( bool  l2only)

Sets the parser's behavior in handling the symbol avogadro in mathematical formulas.

SBML Level 3 defines a symbol for representing the value of Avogadro's constant, but it is not defined in SBML Level 2. As a result, the text-string formula parser must behave differently depending on which SBML Level is being targeted. For Level 3 documents, it can interpret instances of avogadro in the input as a reference to the MathML csymbol for Avogadro's constant defined in the SBML Level 3 specification. For Level 2, it must treat avogadro as just another plain symbol.

This method allows callers to set the avogadro-handling behavior in this L3ParserSettings object. The possible values of l2only are as follows:

  • (value = true): tells the parser to translate the string avogadro (in any capitalization) into an AST node of type
  • (value = false): tells the parser to translate the string avogadro into an AST of type

Since SBML Level 2 does not define a symbol for Avogadro's constant, the value should be set to when parsing text-string formulas intended for use in SBML Level 2 documents.

Parameters
l2onlya boolean value indicating how the string avogadro should be treated when encountered in a formula. This will be one of the values or
See also
getParseAvogadroCsymbol()

◆ setParseCollapseMinus()

void L3ParserSettings::setParseCollapseMinus ( bool  collapseminus)

Sets the behavior for handling unary minuses appearing in mathematical formulas.

This setting affects two behaviors. First, pairs of multiple unary minuses in a row (e.g., "- -3") can be collapsed and ignored in the input, or the multiple minuses can be preserved in the AST node tree that is generated by the parser. Second, minus signs in front of numbers can be collapsed into the number node itself; for example, a "- 4.1" can be turned into a single ASTNode of type with a value of -4.1, or it can be turned into a node of type having a child node of type .

This method lets you tell the parser which behavior to use—either collapse minuses or always preserve them. The two possibilities are represented using the following constants:

  • (value = true): collapse unary minuses where possible.
  • (value = false): do not collapse unary minuses, and instead translate each one into an AST node of type
Parameters
collapseminusa boolean value (one of the constants or ) indicating how unary minus signs in the input should be handled.
See also
getParseCollapseMinus()

◆ setParseL3v2Functions()

void L3ParserSettings::setParseL3v2Functions ( bool  l3v2functions)

Sets the behavior for handling functions added in SBML L3v2.

This setting affects whether the names of functions added in SBML Level 3 Version 2 are parsed as those added MathML functions, or whether they are added as generic functions with those names (to be used in SBML as function definitions).

This method lets you tell the parser which behavior to use—either to parse the functions added in L3v2 as their built-in counterparts, or as generic functions with that name (to be defined by SBML as function definitions). The two possibilities are represented using the following constants:

  • (value = true): parse the strings rateOf, implies, max, min, quotient, and rem as , , , , , and , respectively.
  • (value = false): parse the strings rateOf, implies, max, min, quotient, and rem all as with the appropriate name set.
Parameters
l3v2functionsa boolean value (one of the constants or ) indicating how to interpret those function names.
See also
getParseL3v2Functions()

◆ setParseLog()

void L3ParserSettings::setParseLog ( ParseLogType_t  type)

Sets the behavior for handling log in mathematical formulas.

The function log with a single argument ("log(x)") can be parsed as log10(x), ln(x), or treated as an error. These three behaviors are set, respectively, by using the value , , or

for the type parameter.

Parameters
typea constant, one of following three possibilities:
See also
getParseLog()

◆ setParseModuloL3v2()

void L3ParserSettings::setParseModuloL3v2 ( bool  modulol3v2)

Sets the behavior for handling the % symbol in mathematical formulas.

This setting affects whether the % symbol (modulo) is parsed as a piecewise equation that returns the modulo value of the entries on either side of the symbol, or whether it is parsed as the MathML 'rem' function, which was allowed in SBML Level 3 Version 2, but not in previous level/versions. The latter is more succinct, but might not be legal SBML for the desired target SBML document.

This method lets you tell the parser which behavior to use—either parse % as the 'rem' function or as a piecewise function with the same interpretation. The two possibilities are represented using the following constants:

  • (value = true): use the 'rem' MathML function ( ).
  • (value = false): use a piecewise function ( ) to encode the modulo rule explicitly.
Parameters
modulol3v2a boolean value (one of the constants or ) indicating how the % symbol in the input should be handled.
See also
getParseModuloL3v2()

◆ setParsePackageMath()

void L3ParserSettings::setParsePackageMath ( ExtendedMathType_t  package,
bool  parsepackage 
)

Sets the behavior for handling functions added in SBML packages.

This setting affects whether the math added in a given SBML Level 3 package are parsed as those added MathML elements, or whether they are added as generic functions or variables with those names.

This method lets you tell the parser which behavior to use—either to parse the functions added in a given package as their built-in counterparts, or as generic functions with that name (to be defined by SBML as function definitions). The two possibilities are represented using the following constants:

  • (value = true): parse any string defined in a given SBML L3 package as its corresponding ASTType_t.
  • (value = false): parse any string that would have been defined in the given SBML L3 package as or

    with the appropriate name set.

Parameters
packagean ExtendedMathType_t indicating the extended math package to be queried.
parsepackagea boolean value (one of the constants or ) indicating how to interpret those function names.
See also
getParsePackageMath( )

◆ setParseUnits()

void L3ParserSettings::setParseUnits ( bool  units)

Sets the parser's behavior in handling units associated with numbers in a mathematical formula.

In SBML Level 2, there is no means of associating a unit of measurement with a pure number in a formula, while SBML Level 3 does define a syntax for this. In Level 3, MathML <cn> elements can have an attribute named units placed in the SBML namespace, which can be used to indicate the units to be associated with the number. The text-string infix formula parser allows units to be placed after raw numbers; they are interpreted as unit identifiers for units defined by the SBML specification or in the containing Model object. Some examples include: "4 mL", "2.01 Hz", "3.1e-6 M", and "(5/8) inches". To produce a valid SBML model, there must either exist a UnitDefinition corresponding to the identifier of the unit, or the unit must be defined in Table 2 of the SBML Level 3 specification.

This method sets the formula parser's behavior with respect to units.

Parameters
unitsa boolean indicating whether to parse units. The possible values are as follows:
  • (value = true): parse units in the text-string formula.
  • (value = false): treat units in the text-string formula as errors.
See also
getParseUnits()

◆ unsetModel()

void L3ParserSettings::unsetModel ( )

Unsets the Model reference in this L3ParserSettings object.

The effect of calling this method is to set the stored model value to NULL.

See also
setModel( )
getModel()