For anyone interested the current svn trunk for libSBML now contains
code that sets any new attributes (with the exception of sbml:units and
the required attribute for packages) and writes out SBML L3.
We will release this as a beta but we have one outstanding issue that we
would appreciate your feedback on:
================
The SBML Level 3 specification removes default values. Thus it will be
the responsibility of the user to set values for any required
attributes. For example the following code
Unit * u = new Unit(3,1);
u->setKind("mole")
would create a unit that would have the following values:
This would be the internal representation of the unit.
Using the function getMultiplier() will return NaN etc.
Writing out this unit would produce the text above; since the attributes
are now required libSBML will write them out with their current value -
which have obviously not been set.
This leaves libSBML in a slight dilemma regarding boolean attributes.
There is no such thing as "Not-A-Boolean". Thus any boolean attribute
must be internally initialised with a boolean value. So for example
where the boolean attributes have values (the default L2 values) even
though the user has not explicitly set them.
So using the function getBoundaryCondition() will return "false".
Obviously we can use internal flags to track whether an attribute has
been explicitly set and the function isSetBoundaryCondition() would
return "false"; but can we rely on the user to check :-) ?
We have a thought on this, but appreciate it is not the neatest of
solutions:
The getBooleanFoo() functions could check whether the attribute has been
set and throw an exception if it has not.
The write process could also check and produce something like
Our reasoning is that this will avoid a user receiving bad information
regarding a model.
We would appreciate your thoughts on this.
Please keep in mind that whilst the above discussion uses attributes we
are already all familiar with - L3 + packages may well introduce other
boolean attributes where there is no obvious default value!!