Constraint¶
A condition which a valid simulation of the model has to satisfy.
A constraint is an expression which has to stay true while a simulation runs, for example that a concentration stays inside the range in which a rate law was measured. It does not change anything in the model: as soon as it is violated, the results from that moment on are no longer valid, and the software has to tell the user.
The report shows the rendered condition and the message which explains a violation.
Attributes¶
| attribute | type | required | meaning | specification |
|---|---|---|---|---|
| math | Math |
optional | the condition which has to stay true | core 4.10.1 |
| message | XHTML |
optional | the text which is shown when the condition is violated | core 4.10.2 |
Every element of a model also carries the common attributes of SBase.
math
The math is an expression which returns a boolean value. It is checked at the start of the simulation and at every moment after it.
The report renders the condition in the column "math" and in the inspector.
Default: the constraint puts no restriction on the model.
21001(error): A <constraint>'s <math> expression must evaluate to a value of type Boolean.21007(error): A <constraint> object must contain exactly one MathML <math> element. The <math> element is optional in L3V2 and beyond.
message
The message is XHTML written for the user of a simulation, for example "the concentration of S1 left the range of the rate law". It is the place where the model author explains why the constraint exists.
The report shows the message next to the condition.
Default: nothing is shown to the user when the condition is violated.
21003(error): The contents of the <message> element in a <constraint> must be explicitly placed in the XHTML XML namespace.21004(error): The contents of the <message> element must not contain an XML declaration (i.e., a string of the form "<?xml version="1.0" encoding="UTF-8"?>" or similar).21005(error): The contents of the <message> element must not contain an XML DOCTYPE declaration (i.e., a string beginning with the characters "<!DOCTYPE".21006(error): The XHTML content inside a <constraint>'s <message> element can only take one of the following general forms: (1) a complete XHTML document beginning with the element <html> and ending with </html>; (2) the "body" portion of a document beginning with the element <body> and ending with </body>; or (3) XHTML content that is permitted within a <body> ... </body> elements.21008(error): A <constraint> object may contain at most one <message> subobject.
Validation rules¶
10706(warning): The value of the 'sboTerm' attribute on a <constraint> is expected to be an SBO identifier (http://www.biomodels.net/SBO/) referring to a mathematical expression (i.e., terms derived from SBO:0000064, "mathematical expression").21002(error): The order of subelements within <constraint> must be the following: <math>, <message>. The <message> element is optional, but if present, must follow the <math> element.21009(error): A <constraint> object may have the optional attributes 'metaid' and 'sboTerm'. No other attributes from the SBML Level 3 Core namespace are permitted on a Constraint object.
Related elements¶
- Model: the container of everything a model is made of
- Parameter: a named value which the mathematics of the model can use
Specification¶
SBML Level 3 Version 2 Core, Section 4.10 (Hucka et al. 2019, J Integr Bioinform 16(2):20190021).