A list for the developers of CellML tools

Text archives Help


RE: [[cellml-dev] ] libCellML handling of non-valid CellML - discussion request


Chronological Thread 
  • From: "Alan Garny" <alan.garny AT inria.fr>
  • To: <cellml-tools-developers AT lists.cellml.org>
  • Subject: RE: [[cellml-dev] ] libCellML handling of non-valid CellML - discussion request
  • Date: Fri, 16 Jan 2015 09:03:16 +0100
  • Organization: INRIA

Hi all,



I am answering this message, rather than the last one, since it contains all
the issues currently at hand.



Regarding phantom variables, phantom units, etc.: this looks like an
implementation issue to me. Still, if we take your case of a variable, it
should indeed always have a reference to a units object. So, by default, I
would use a null pointer for the case where I want to create a variable with
a units object that doesn't exist yet. Now, if you think that a phantom
units would work better, then I have no issue with that in principle.



Regarding connections: first and foremost, I am all in favour of an API that
looks like what David described (i.e. "[provide] a much cleaner, more
intuitive, and flexible interface for application developers"). However, I
have typical cases where access to a DOM-based structure would also be
useful.



One such case is the CellML Annotation view in OpenCOR. In that view, we
want to be able to annotate any CellML element and, whether we/I like it or
not, that includes connection elements.



Now, assuming we cannot access connections, what would happen in the
following scenario: say that you have 4 components (A1, A2, B1 and B2) that
are all siblings. Say that both A1 and B1 define the exact same variable V
and that this variable contains the result of some calculation (with
different results for A1.V and B1.V). Next, say that A2 and B2 need to use
the result of A1.V and B1.V, respectively. Now, since I don't have access to
connections, how would I tell libCellML that A2.V is connected to A1.V and
that B2.V is connected to B1.V?



Alan



PS: another case where I thought we might need access to connection elements
was the Pretty CellML view in OpenCOR where we want to provide a beautified
version of the CellML code (a la COR). However, I have decided against using
the current CellML API for this. Indeed, I wanted to keep the order in which
things are in the CellML file. So, for that reason, I am using the DOM to
retrieve everything I need and, in a similar way, I am also thinking of
using the DOM to write things back (again, so that the order is kept).





From:
cellml-tools-developers-request AT lists.cellml.org
[mailto:cellml-tools-developers-request AT lists.cellml.org]
On Behalf Of
Randall Britten
Sent: 16 January 2015 00:22
To: cellml-tools-developers Mailing List
Subject: Re: [[cellml-dev] ] libCellML handling of non-valid CellML -
discussion request



Hi Alan



I've pasted Andre's e-mail below this response (hopefully it helps with
threading in this conversation). I think it addresses why connections would
be hidden.



Your understanding of what I mean by invalid models, and how that relates to
partially constructed models is exactly correct, and I see validation the
same way you do.



To answer your questions regarding the options:

1. Phantom Variables, Phantom Units etc, would basically be a way of
handling partially constructed models. The design that I've been working
with so far: a variable object always has a reference to a units object,
enforced by only providing a constructor that requires a units object. We
could use null pointers to perform the same role. Explicitly inserting
PhantomX type objects might appeal because we can aim to never have null
pointers, and then if we find null pointers, we know we have a bug.
2. Was answered by Andre
3. 80/20 rule: http://en.wikipedia.org/wiki/Pareto_principle. I mean
that if we forge ahead on the assumption that we won't support partially
constructed models and invalid models for now, and then later come back and
add this feature (i.e. support for incomplete and invalid models), then we
gain 80% of the functionality we need. In practice, it would mean that at
first, editing software that used libCellML would force the user to first
define the unit U before allowing a variable V with units U to be defined.

And "still under consruction, pa" was meant to be "still under consruction,
partially constructed", my bad.



Cheers,

Randall





On 16/01/15 11:48 am, "David Nickerson"
<david.nickerson AT gmail.com>
wrote:



Hi Alan,



Just to address part of your email. In my view, the libCellML API

should only expose objects and methods that are of use to application

developers for working with CellML models and not be restricted to the

current XML serialisation. In this instance, a connection element is

just the serialisation of the relationship between variables in two

components. I don't see a need for a special object in the API that

represents this as such information is just a property of the

respective variables.



In my view an API that simply exposes the primary data in a CellML

model - components, variables, units, and math - provides a much

cleaner, more intuitive, and flexible interface for application

developers than one similar to the current CellML API which simply

exposes a DOM-based view of the XML serialisation format. Obviously,

this is why discussion on the proposed object model and API for

libCellML would have been more valuable to have prior to getting into

these implementation details.





Cheers,

Andre.





From: Alan Garny
<alan.garny AT inria.fr>
Reply-To:
"cellml-tools-developers AT lists.cellml.org"
<cellml-tools-developers AT lists.cellml.org>
Date: Friday, 16 January 2015 11:25 am
To:
"cellml-tools-developers AT lists.cellml.org"
<cellml-tools-developers AT lists.cellml.org>
Cc:
"cellml-tools-developers AT cellml.org"
<cellml-tools-developers AT cellml.org>
Subject: Re: [[cellml-dev] ] libCellML handling of non-valid CellML -
discussion request



Hi Randall,



I am not sure I fully understand the issue at hand. What do you mean exactly
by non-valid CellML models? Using libCellML, I would expect to be able to
create a model with a component C. Within that component, I would expect to
be able to create a variable V with units U, and stop here if I want. The
model would clearly be incomplete, yet I would still expect to be able to
save it and load it back without any problem. However, if if I was then to
ask libCellML to validate the model, then I would expect libCellML to tell
me that the unit U hasn't been defined, as well as probably tell me that
there is no equation that uses the variable V. More generally, when it comes
to validation, I would expect libCellML to implement all the rules that are
in the CellML specification, as well as Jonathan Cooper's algorithm for
checking units consistency.



About connections, I imagine I am once again missing something. Why would
you hide them? What if, for some reason or another, a CellML-capable
software needs to know about the connections? As an API, I would expect
libCellML to give me access to everything that is part of the CellML
language.



Regarding your options:

1) I am clearly missing something. In other words, I don't see the need for
this.

2) Independent of whether a model is valid or not, I would in any case have
a "connection" class and make it accessible to libCellML users.

3) 80/20 rule?



Otherwise, "pa" (in "still under consruction, pa")?



Alan



_____

From: "Randall Britten"
<r.britten AT auckland.ac.nz>
To:
cellml-tools-developers AT cellml.org
Sent: Thursday, 15 January, 2015 9:46:47 PM
Subject: [[cellml-dev] ] libCellML handling of non-valid CellML - discussion
request



Hi all



Firstly, Happy New Year, hope you have a great 2015!



I had some conversations yesterday around the ABI about how libCellML should
handle non-valid CellML models. We are especially envisaging model-editing
software that uses libCellML, progressively building and modifying models,
meaning that as the model is worked on step-by-step, there will often be
steps that are part of a group of steps, and only once the group of steps is
complete is the model in a valid state. Another likely scenario is using
software that uses libCellML to load models that were created independently
of libCellML, and it would be necessary to handle the case where the loaded
model might be invalid (e.g. still under construction, or pa).



Within reason, we'd like libCellML to support the corresponding use cases,
although it might make sense to defer them till later.



An example that has arisen is how connections are represented. While the
XML has a "connection" element that is a child of the "model" element, the
design that I've followed so far aimed to hide that, treating it as an
implementation detail, so that variables would simply allow for a query
regarding which other variables they are connected to.



Some options considered so far:

1)Phantom Variables (and similarly for other situations, e.g. Phantom
Units), which serve as place-holders.

2)Reinstate "connection" class in the object model to handle the case where
the connection is not valid (e.g. refers to variables or components that
don't exist in the model).

3)Defer consideration of partially defined and invalid models (80/20 rule).



Please provide feedback on this. I'll be responding to feedback received
today and next week on the same day it is received (within reason).



Thanks in advance.



Regards,

Randall








Archive powered by MHonArc 2.6.18.

Top of page