A list for the developers of CellML tools

Text archives Help


[cellml-dev] CellML API - GetAlternateVersion from the Model interface


Chronological Thread 
  • From: david.nickerson at gmail.com (David Nickerson)
  • Subject: [cellml-dev] CellML API - GetAlternateVersion from the Model interface
  • Date: Fri, 25 Sep 2009 22:36:52 +1200

Hi Alan,

I know it doesn't help and the bug you see should be fixed, but why
are you creating CellML 1.0 models in the first place? Doesn't it make
sense to always create CellML 1.1 models regardless of there being
imports or not? As Andrew pointed out somewhere recently, technically
it is invalid CellML 1.1 to import a CellML 1.0 component (something
I'd never considered and am glad the tools don't actually stop such
models working), so we really want to be doing everything we can to
get model authors creating CellML 1.1 models. You'd imagine then that
OpenCell should have a "Save as..." option that lets you choose to
flatten the model and export a CellML 1.0 model document (probably
making use of Johnathan's model flattening code). [perhaps such an
option already exists?]

Just thinking out loud here...and maybe I have completely missed the
point of what you are doing...


Cheers,
Andre.

On Fri, Sep 25, 2009 at 10:01 PM, Alan Garny <alan.garny at dpag.ox.ac.uk>
wrote:
>
> Hi,
>
>
>
> I have just been reminded about this mailing list for my CellML-related
> ?problems?, so here goes?
>
>
>
> I am currently working on generating a CellML object from the COR-like view
> in OpenCell. Right now, I am able to create an empty CellML 1.0 object.
> However, should the user specify an import statement in the COR-like view,
> I would like to ?convert? that CellML 1.0 object to a CellML 1.1 object.
>
>
>
> Unless I am mistaken, I believe that one should be able to do that using
> the GetAlternateVersion method from the Model interface. At the moment, I
> have a Bison rule that reads as follows:
>
>
>
> ________________________________
>
> importstart: T_IMPORT T_URI T_AS {
>
> ? // We are importing something, which means the model should be a CellML
> 1.1
>
> ? // model (as opposed to a CellML 1.0 model, which is what it is by
> default)
>
>
>
> ? nsString cellMLVersion;
>
>
>
> ? (*aCellMLOutput)->GetCellmlVersion(cellMLVersion);
>
>
>
> ? if (cellMLVersion.Equals(NS_LITERAL_STRING("1.0")))
>
> ??? (*aCellMLOutput)->GetAlternateVersion(NS_LITERAL_STRING("1.1"),
> aCellMLOutput);
>
> };
>
> ________________________________
>
>
>
> The above code works fine in that the CellML 1.0 model does become a CellML
> 1.1 model (as can be seen in the XML view), BUT the whole contents of the
> CellML model disappears in the process. Say that I initially had the
> following COR code:
>
>
>
> ________________________________
>
> def model my_model as
>
> enddef;
>
> ________________________________
>
>
>
> This corresponds to the following CellML code:
>
>
>
> ________________________________
>
> <?xml version="1.0"?>
>
> <model xmlns="http://www.cellml.org/cellml/1.0#"; xml:base=""
> name="my_model"/>
>
> ________________________________
>
>
>
> Then, say that I edit the COR-like view to read:
>
>
>
> ________________________________
>
> def model my_model as
>
> ? def import {uri: cellml.org} as
>
> ??? comp A as B;
>
> ??? unit C as D;
>
> ? enddef;
>
> enddef;
>
> ________________________________
>
>
>
> This requires the CellML object to be ?converted to? CellML 1.1. However,
> when switching to the XML view (something that will trigger the
> ?conversion?), I get:
>
>
>
> ________________________________
>
> <?xml version="1.0"?>
>
> <model xmlns="http://www.cellml.org/cellml/1.1#"; xml:base=""/>
>
> ________________________________
>
>
>
> So, the model has been ?converted to? CellML 1.1, but everything is gone
> and indeed, if you switch back to the COR-like view, you will (as you would
> expect) get the following:
>
>
>
> ________________________________
>
> def model ?as
>
> enddef;
>
> ________________________________
>
>
>
> So, does anyone know what I have done wrong, if anything? I have checked
> the CellML test for GetAlternateVersion and it ?only? checks the CellML
> version, a test which my current code would also pass, but which should in
> fact fail (if we consider that the contents of the model has gone)? It
> seems like RecursivelyChangeVersionCopy might not be working? (I am
> currently looking into it.)
>
>
>
> Anyway, if any of you had some comments on the above or, most importantly,
> a working solution to my problem, then please feel free to make yourself
> heard? J
>
>
>
> Cheers, Alan.
>
>
>
> Dr Alan Garny
>
> University of Oxford, Department of Physiology, Anatomy & Genetics
>
> Sherrington Building, Parks Road, Oxford, OX1 3PT, England
>
> http://noble.physiol.ox.ac.uk/people/agarny/
>
> http://cor.physiol.ox.ac.uk/
>
>
>
>
>
> _______________________________________________
> cellml-tools-developers mailing list
> cellml-tools-developers at cellml.org
> http://www.cellml.org/mailman/listinfo/cellml-tools-developers
>




Archive powered by MHonArc 2.6.18.

Top of page