| Author | Topic |
Posts: 307
Location: Cambridge UK
Registered: February 2005
|
|
setting automatically an SBO term for time
|
24 Nov '10 02:52
|
 |
|
> Index: src/org/sbml/jsbml/UnitDefinition.java
> ===================================================================
> --- src/org/sbml/jsbml/UnitDefinition.java (revision 445)
> +++ src/org/sbml/jsbml/UnitDefinition.java (working copy)
> @@ -172,42 +172,40 @@
> * specified level version combination or null if no
> such predefined
> * unit exists.
> */
> public static final UnitDefinition getPredefinedUnit(String
> id, int level,
> int version) {
> if (level < 3) {
> id = id.toLowerCase();
> Unit u = new Unit(level, version);
> UnitDefinition ud = new UnitDefinition(id,
> level, version);
> if (id.equals("substance")) {
> u.setKind(Unit.Kind.MOLE);
> } else if (id.equals("volume")) {
> u.setKind(Unit.Kind.LITRE);
> } else if (id.equals("area")) {
> u.setKind(Unit.Kind.METRE);
> u.setExponent(2);
> } else if (id.equals("length")) {
> u.setKind(Unit.Kind.METRE);
> } else if (id.equals("time")) {
> u.setKind(Unit.Kind.SECOND);
> - u.setSBOTerm(345);
> - ud.setSBOTerm(345);
Just encountered these setSBOTerm calls that make the library failed to
read SBML L2V1 in a really strange way where the exception was quite hidden.
First, I thing we should avoid setting automatically anything that is
not on the specs.
And it feel strange to me to annotate unit with SBO term in general.
In this case, the SBO term 345 is obsolete and we should better use a
child of the term 346 (temporal measure) but I am not sure any term fit
anymore.
The second problem is that method call provoke an exception being thrown
(for level 2 version 1 or lower model), a PropertyNotAvailableError
and when java try to print the stack trace there was a
NullPointerException in the toString() because plenty of the attributes
of an SBMLError were not defined
and this exception is apparently catch by the jdk so nothing was displayed.
So, we need to define the toString() of the new SBMLErrors, I can to
that and I would propose to remove these setSBOTerm call.
Do you make any use of it Andreas ?
Thanks,
Nico
> } else {
> return null;
> }
> ud.setName("Predefined unit " + id);
> ud.addUnit(u);
> return ud;
> }
> return null;
> }
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|
|
|