Forums

F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Search Search
SBML Discussions » jsbml-development » Units inheritance in Level 3
Show: Today's Posts  :: Message Navigator
| Subscribe to topic 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
Andreas Dräger


Posts: 273
Registered:
June 2006
Re: Units inheritance in Level 3 21 Mar '12 00:13 Go to previous message

Am 3/20/12 12:56 PM, schrieb Andreas Dräger:
> Hi Sarah,
>
>>> Yes. That's what I would like to do. It is actually very easy using a
>>> filter for listOf<UnitDefinition> that accepts the first identical
>>> UnitDefinition (using a call like
>>> UnitDefinition.areIdentical(myJustDerivedUnit, unitNumberXXfromTheList),
>>> with XX being the counter in the for-each loop).
>> My main thought about this is to consider what the user might want to
>> do with the unitDefinition returned from getDerivedUnits(). They may
>> wish to change or use it somewhere else and may not actually want it
>> to be part of the original model.
>>
> In deed, there are two different ways to go.
>
> 1. The user always receives a newly created UnitDefinition and can
> manipulate it in any way, but if it is necessary to ensure that the unit
> is already part of the model, the user must add it by him/herself.
> Similarly, the user would have to filter the Model's list of units for
> an identical unit by him/herself.
>
> 2. The user gets a unit that may already belong to the model. A check
> can be done by asking myModel.getListOfUnits().contains(myUnit). If it
> is already in the model and the user wants to do some change, a call to
> the clone() method might be necessary.
>
> It now depends on what the users would prefer to have. Maybe you're
> right, and way #2 is less streightforward because the user does not know
> if the unit belongs to the model or not. In idea #1 the returned unit
> never belongs to the model.
>
> Are there any other opinions on that topic?
>

Hi everybody,

Actually, when calling getDerivedUnitsInstance() on an element such as
Species or Compartment, the user can never know if the returned
UnitDefinition object is part of the model or a newly created element.
If, for instance, there is a unit defined for the species, the method
looks the corresponding UnitDefinition up in the model and returns it.
If it is a base unit, a new UnitDefinition will be created that only
contains the base unit in its list of units. Similarly, if the species
inherits a unit from the model, also the model's inherited unit
definition object will be returned. So in some cases the user receives a
UnitDefinition that is not (yet) part of the Model, and in some cases
the returned value is a UnitDefintion from the Model's list of units.

Therfore, it seems more logical to preferably return a UnitDefinition
from the Model rather than a completely new one. The approach to search
for identical UnitDefinition objects in the model after creating some
UnitDefintion (for a base unit or something different) seems to be the
better choice, I think.

In any way, the method we use to derive units is not straightforward at
the moment.

Cheers
Andreas

--
Dr. Andreas Dräger
University of Tuebingen
Center for Bioinformatics Tuebingen (ZBIT)
Sand 1
72076 Tübingen
Germany

Phone: +49-7071-29-78982
Fax: +49-7071-29-5091

____________________________________________________________
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

      

SubjectPosterDate
Read Message   Units inheritance in Level 3 Andreas Dräger15 Mar '12 09:19
Read Message   Re: Units inheritance in Level 3 Sarah Keating20 Mar '12 02:50
Read Message   Re: Units inheritance in Level 3 Andreas Dräger20 Mar '12 03:00
Read Message   Re: Units inheritance in Level 3 Sarah Keating20 Mar '12 02:50
Read Message   Re: Units inheritance in Level 3 Andreas Dräger20 Mar '12 02:55
Read Message   Re: Units inheritance in Level 3 Sarah Keating20 Mar '12 03:16
Read Message   Re: Units inheritance in Level 3 Andreas Dräger20 Mar '12 04:56
Read Message   Re: Units inheritance in Level 3  Andreas Dräger21 Mar '12 00:13
Previous Topic:Problem reading history element?
Next Topic:Unsetting substance units in Model
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.