Forums

F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Search Search
SBML Discussions » libsbml-development » No defaults in SBML L3
Show: Today's Posts  :: Message Navigator
| Subscribe to topic 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
myers


Posts: 140
Location:
University of Utah
Registered:
May 2008
Re: No defaults in SBML L3 21 Sep '09 08:57 Go to previous messageGo to previous message

> ============
> Compartment *c = new Compartment(3,1);
>
> c->setUnits("metre");
> =============
>
> Since the user has made no explicit declaration about the
> spatialDimensions, if the spatialDimensions defaults to 3, this
> creates
> an invalid internal representation of a compartment - something
> libSBML-4 tries very very hard to avoid doing blindly.
>
I'm not sure I see the difference between the above and the following:

Compartment *c = new Compartment(3,1);
c->setSpatialDimensions(3);
c->setUnits("metre");

In either case, the result is either an invalid internal
representation or throwing an exception on the setUnits call. Also,
for the one above, if there are no defaults than the internal
representation is still invalid as it has units set to a compartment
which has no known spatial dimensions. I think that tools need to
take some of the responsibility to not produce invalid SBML. In our
tool, for example, when a new compartment is created, the default
spatial dimensions is 3, so the user is prohibited from selecting any
units that are not compatible with this. If you change the spatial
dimensions to 1, then the units will be changed to none and the user
is given the option of setting it to units compatible with spatial
dimensions of 1. In this case, I'm pretty sure that our code does not
assume that defaults are provided but instead provides them. However,
in other cases, I believe we have set defaults to match those
specified for level 2 SBML. Therefore, in those cases, we would need
to add code to add explicit values which may be a pain to track down.

> Also consider this code:
>
> ===============
> Model *m = new Model(3,1);
> m->setVolumeUnits("whatever");
>
> Compartment *c = m->createCompartment();
> ===============
>
> Again, implicitly compartment c has units of "whatever" - since by
> default the spatialDimensions are 3.
>
> SBML Level 3 core removed defaults so that these sorts of implicit
> declarations were removed !!
>
The SBML file generated though would not have any implicit
declarations as the spatial units in the file would be explicitly set.

One "feature" of libsbml using defaults is that it can make invalid
SBML (one missing required elements) to be valid. For example, if you
are given a file that is missing the "hasOnlySubstanceUnits" field,
then libsbml w/defaults would fill this in allowing the file to be
read. If the file is then saved, it is now valid SBML. If libsbml
does not allow defaults, then I see two possible behaviors:

1) Throw an exception and not load the SBML file. This is bad because
the user cannot fix the file if it is not loaded.

2) Load the invalid SBML file. This is also bad because now you have
an invalid SBML file.

I guess a compromise would to be add a second readSBML function that
fills in defaults for missing required elements in a SBML file. An
ideal program would read the file without filling in defaults, catch
the exception when required elements are missing, then ask the user if
he/she would like to read the file filling in the required elements
with defaults perhaps opening a window showing which defaults have
been set.

Chris


____________________________________________________________
To manage your libsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/libsbml-development

For a web interface to the libsbml-development mailing list, visit
http://sbml.org/Forums/

For questions or feedback about the libsbml-development list,
contact sbml-team@caltech.edu

      

SubjectPosterDate
Read Message   No defaults in SBML L3 Sarah Keating15 Sep '09 02:28
Read Message   Re: No defaults in SBML L3 Frank Bergmann15 Sep '09 09:00
Read Message   Re: No defaults in SBML L3 Lucian Smith18 Sep '09 17:03
Read Message   Re: No defaults in SBML L3 myers18 Sep '09 19:33
Read Message   Re: No defaults in SBML L3 Sarah Keating21 Sep '09 01:02
Read Message   Re: No defaults in SBML L3  myers21 Sep '09 08:57
Read Message   Re: No defaults in SBML L3 Stefan.Hoops21 Sep '09 10:17
Read Message   Re: No defaults in SBML L3 myers21 Sep '09 10:39
Read Message   Re: No defaults in SBML L3 curoli21 Sep '09 11:00
Read Message   Re: No defaults in SBML L3 Stefan.Hoops21 Sep '09 12:19
Read Message   Re: No defaults in SBML L3 Lucian Smith21 Sep '09 12:56
Read Message   Re: No defaults in SBML L3 Lucian Smith21 Sep '09 12:42
Read Message   Re: No defaults in SBML L3 Mike Hucka21 Sep '09 22:03
Read Message   Re: No defaults in SBML L3 Stefan.Hoops22 Sep '09 06:37
Read Message   Re: No defaults in SBML L3 curoli22 Sep '09 12:21
Read Message   Re: No defaults in SBML L3 Stefan.Hoops22 Sep '09 13:40
Read Message   Re: No defaults in SBML L3 curoli22 Sep '09 14:42
Read Message   Re: No defaults in SBML L3 Stefan.Hoops22 Sep '09 15:03
Read Message   Re: No defaults in SBML L3 curoli22 Sep '09 18:39
Read Message   Re: No defaults in SBML L3 Sarah Keating23 Sep '09 01:29
Read Message   Re: No defaults in SBML L3 curoli23 Sep '09 05:40
Read Message   Re: No defaults in SBML L3 Sarah Keating23 Sep '09 07:08
Read Message   Re: No defaults in SBML L3 myers23 Sep '09 08:47
Read Message   Re: No defaults in SBML L3 Lucian Smith23 Sep '09 11:58
Read Message   Re: No defaults in SBML L3 ajouraku24 Sep '09 01:57
Read Message   Re: No defaults in SBML L3 myers23 Sep '09 08:16
Read Message   Re: No defaults in SBML L3 Lucian Smith22 Sep '09 15:42
Read Message   Re: No defaults in SBML L3 Sarah Keating23 Sep '09 03:11
Previous Topic:Updating libsbml installation instructions
Next Topic:Unit consistency check in libsbml 3.3.2
Go to forum:
-=] Back to Top [=-

Powered by FUDforum. (Copyright Advanced Internet Designs Inc.)

Please use our issue tracking system for any questions or suggestions about this website.