CellML Discussion List

Text archives Help


[cellml-discussion] Another IDL for the CellML API


Chronological Thread 
  • From: Andrew Miller <ak.miller AT auckland.ac.nz>
  • To: cellml-discussion AT cellml.org
  • Subject: [cellml-discussion] Another IDL for the CellML API
  • Date: Sat, 26 Mar 2005 16:11:00 +1200
  • List-archive: <http://www.cellml.org/pipermail/cellml-discussion>
  • List-id: "For those interested in contributing to the development of CellML." <cellml-discussion.cellml.org>

This CellML API is based upon the specification at
http://n2.bioeng5.bioeng.auckland.ac.nz/development/documentation/apifiles/APIideas.pdf
by Matt Halstead.

It has the following differences:
1) It is a formulated in IDL instead as in a "more casual approach".
2) The naming of some objects has been changed to better fit into the usual
way
of doing things in IDL. For example, mixed case is used to separate words in
identifiers, instead of underscores. In addition, CellML was appended to a
number of names, like Component, to avoid conflicts with IDL reserved words.
Some names were also changed because case-insensitive conflicts of attribute
and interface names is not allowed in IDL.
3) As required by IDL, a decision about what attributes were readonly and
which
ones are read-write was made. Furthermore, all methods which take no
parameters, return no values, and are not expected to have any side effects
were converted to readonly attributes. Attributes referring to a CollectionOf*
were all made to be read-only(this doesn't mean you can't do any operations on
the collection that modify the collection, it just means you can't switch the
connection itself).
4) The collection architecture was changed somewhat to accomodate the need for
immutable collections. There are now ConstCollectionOf* and CollectionOf*
collections available, related by an inheritance hierarchy. The polymorphic
inheritance hierarchy chosen may need further study to ensure it is generally
applicable.


This version has Doxygen/Javadoc style comments on every interface(except
forward definitions), attribute, method, enumeration, and enumeration option.

Things which require further work are flagged with @todo. There are a number
of
these:
CellMLAttributeString has two @todo flags, one for whose responsibility
escaping
is, and another for the underlying IDL datatype to use.

The model interface has two @todo flags, one because I removed the model
manager
as previously agreed in-person with Matt(but not yet reflected in Matt's
spec),
and this needs further work, and one because the namespace map was removed,
again based on what Matt and I agreed on in-person.

CellMLImport::fullyInstantiate has a @todo flag to properly define "full
instantiation".

ImportComponent::componentRef has a @todo flag to define what happens if
componentRef is changed after fullyInstantiate() is called.

Group has a @todo flag because I don't understand what
Component get_parent_component_name(component name)
Component get_children_component_names(component name)
means.

Best regards,
Andrew


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
/**
 * This module contains a description of the CellML Application Programming
 * Interface in the language-neutral IDL form.
 */
module cellml_api
{
  /* Forward definitions... */
  interface RDF;
  interface CollectionOfExtensionElements;
  interface Model;
  interface CollectionOfComponents;
  interface CollectionOfGroups;
  interface CollectionOfImports;
  interface CollectionOfUnits;
  interface CollectionOfCellMLAttributeString;
  interface CollectionOfConnections;
  interface CollectionOfGroups;
  interface CollectionOfVariables;
  interface CollectionOfMath;
  interface CollectionOfImportComponents;
  interface CollectionOfImportUnits;
  interface CollectionOfUnit;
  interface CollectionOfComponentRefs;
  interface Units;
  interface ConstCollectionOfUnits;
  interface ConstCollectionOfCellMLAttributeString;
  interface ConstCollectionOfComponents;
  interface ConstCollectionOfGroups;
  interface ConstCollectionOfConnections;
  interface CollectionOfMapVariables;
  interface Group;
  interface CollectionOfRelationshipRefs;
  interface RateVariableRef;
  interface CollectionOfReactantVariableRefElements;
  interface CollectionOfProductVariableRefElements;
  interface MapComponents;
  interface ReactantRole;

  /**
   * This holds attribute values for the XML attributes of elements in
   * serialised CellML. Character data in XML can be any Unicode character;
   * the sequence of characters must conform to the rules of XML character data
   * (which define escaping of reserved characters etc).
   * @see http://www.w3.org/TR/REC-xml/#syntax
   * @todo How much escaping is done by the application and how much by the API?
   * @todo Perhaps not use wstring(W3C doesn't, it is a wide-string but doesn't
   *       expsay Unicode).
   */
  typedef wstring CellMLAttributeString;

  /**
   * This interface is a place-holder in this IDL, in the DOM-based API
   * implementations it would refer to the MathML DOM.
   */
  interface MathMLElement
  {
  };

  /**
   * This interface is a place-holder in this IDL, it could refer to some sort
   * of RDF interface in certain implementations.
   */
  interface RDF
  {
  };

  /**
   * This interface can be inherited from by the user for use in annotations.
   */
  interface UserData
  {
  };


  /**
   * Indicates that something went wrong. Implementations are free to add more
   * attributes to this, but to support all implementations, these are not
   * required.
   */
  exception CellMLException{};

  /**
   * Represents a uniform resource indicator, conforming to RFC2396
   * (http://rfc.net/rfc2396.html)
   */
  interface URI
  {
    /**
     * A representation of this string as text.
     */
    attribute string asText;
  };

  /**
   * This is a general interface from which all CellML elements inherit.
   */
  interface CellMLElement
  {
    /**
     * The CellML version that this element corresponds to.
     * Can be the string "1.0" or "1.1".
     * Raises a CellMLException if set to an invalid string.
     * Other values are reserved for future use.
     */
    attribute CellMLAttributeString cellmlVersion;

    /**
     * This element's cmeta id(which may be defined on any CellML element)
     */
    attribute CellMLAttributeString cmetaId;

    /**
     * The RDF metadata associated with this element. An element must have a
     * cmeta:id for any RDF to be able to refer to it.
     */
    attribute RDF rdfMetadata;

    /**
     * The collection of extension elements associated with this CellML
     * element.
     */
    readonly attribute CollectionOfExtensionElements extensionElements;

    /**
     * Perform validation according to the validation requirements
     * specification. Some validation only makes sense once entire model is
     * loaded.
     */
    boolean validate();

    /**
     * The parent element of this model...
     */
    readonly attribute CellMLElement parentElement;

    /**
     * The underlying model element.
     */
    readonly attribute Model modelElement;

    /**
     * Sets user-supplied annotations on this element. These annotations are
     * never read from an XML file or written out, but are for the application
     * to use for any purpose it likes.
     * Implementations in languages in which the ability to do this on any
     * object is built in may choose not to implement this.
     * If the key already exists, then the existing user-data should be removed
     * and the new user-data added.
     * @param key  A string to identify the annotation.
     * @param data The data to set, or null to clear the UserData for a key.
     */
    void setUserData(in string key, in UserData data);

    /**
     * Retrieves user-supplied annotations previously set on this element.
     * @param key A string to identify the annotation.
     * @return The user-data associated with the key.
     * @raises CellMLException if no UserData is set for the given key.
     */
    UserData getUserData(in string key) raises(CellMLException);
  };

  /**
   * This is a general interface from which all CellML elements which have a
   * name attribute inherit.
   */
  interface NamedCellMLElement
    : CellMLElement
  {
    /**
     * The name associated with this CellML element.
     */
    attribute CellMLAttributeString name;
  };

  /**
   * An extension object is a user defined representation of data in an
   * extension namespace. In CellML/XML, a user is free to add other data
   * elements that do not conform to CellML names or rules, so long as they are
   * defined in another namespace. It is up to the application developer to
   * handle the creation of extension objects, which usually means interacting
   * with the XML parser to trigger the correct methods.
   */
  interface ExtensionElement
  {
  };

  /**
   * This interface represents a <model> element in the XML.
   */
  interface Model
    : NamedCellMLElement
  {
    /** @todo model manager removed from here as previously discussed, but need to
     *        determine alternative strategy for accessing the model manager.
     */

    /**
     * The collection of groups described in this model document.
     */
    readonly attribute CollectionOfGroups groups;

    /**
     * The collection of imports described in this model document.
     */
    readonly attribute CollectionOfImports imports;

    /**
     * @todo namespace map removed from here are previously discussed, but we
     *       need to decide where to put it.
     */

    /**
     * Models should really set an 'xml:base' attribute in the model element as
     * we need to be able to unambiguously and uniquely reference a model
     * independent of its location. If this is not set, the base_uri could be
     * set to the URI used to obtain it.
     */
    attribute URI base_uri;

    /**
     * The collection of units defined within this model.
     */
    readonly attribute CollectionOfUnits localUnits;

    /**
     * The collection of units, including those from imports(if imports have
     * been fully instantiated).
     */
    readonly attribute ConstCollectionOfUnits units;

    /**
     * Returns names of all units visible at the model level. This does not
     * include units declared in components, but will include units declared
     * in imports. This interface has the benefit of always including imported
     * units, whereas the units interface does not.
     */
    readonly attribute ConstCollectionOfCellMLAttributeString unitsNames;

    /**
     * Returns a collection of all components which are defined in this model.
     */
    readonly attribute CollectionOfComponents localComponents;

    /**
     * returns all components with interface 'CellMLComponent' in the model.
     * If imports have been fully instantiated then it includes these too.
     */
    readonly attribute ConstCollectionOfComponents components;

    /**
     * returns names of all components declared in the model, including those
     * declared in the import structures.
     */
    readonly attribute ConstCollectionOfCellMLAttributeString componentNames;

    /**
     * Model connections. If any imports have been fully instantiated, then it
     * includes connections relevant to those also.
     * Adding or removing from this collection must always add the connection
     * to the correct model.
     */
    readonly attribute CollectionOfConnections connections;

    /**
     * The following also searches user-defined relationships.
     * @param name The name of the relationship to search for.
     */
    ConstCollectionOfGroups findGroupsWithRelationshipRefName
    (
     in CellMLAttributeString name
    );

    /**
     * This fully instantiates the import definitions
     */
    void fullyInstantiateImports();

    /**
     * Return a flattened model, i.e. all imported component trees are promoted
     * to model level and import objects are removed.
     * @return The flattened model.
     */
    Model generateFlattenedModel();
  };

  /**
   * This interface represents a component element in the CellML document.
   */
  interface CellMLComponent
    : NamedCellMLElement
  {
    /**
     * The set of all variables defined in this component.
     */
    readonly attribute CollectionOfVariables variables;

    /**
     * The set of all units defined in this component.
     */
    readonly attribute CollectionOfUnits units;

    /**
     * The set of all math defined in this component.
     */
    readonly attribute CollectionOfMath math;

    /**
     * The set of all connections which involve this component.
     */
    readonly attribute ConstCollectionOfConnections connections;
    
    /**
     * The component which, in the encapsulation hierarchy defined in this
     * model, encapsulates this component. When this component is
     * an imported component, an implementation must return
     * any encapsulation parent defined in the importing model.
     * When the same component is imported twice under different
     * names, the implementation must return the correct encapsulation
     * parent for each component instance.
     * This attribute is null if there is no encapsulation parent.
     */
    readonly attribute CellMLComponent encapsulationParent;

    /**
     * The set of all children of this component.
     */
    readonly attribute CollectionOfComponents encapsulationChildren;

    /**
     * The containment parent for this component. This must work correctly
     * across imports if imports have been instantiated.
     */
    readonly attribute CellMLComponent containmentParent;

    /**
     * The containment parent for this component. This must work correctly
     * across imports if imports have been instantiated.
     */
    readonly attribute CollectionOfComponents containmentChildren;
  };

  interface Units
    : NamedCellMLElement
  {
    /**
     * True if this set of units is base units, or false otherwise.
     */
    attribute boolean isBaseUnits;

    /**
     * A collection of all the <unit> elements making up this <units> element.
     */
    readonly attribute CollectionOfUnit unitCollection;
  };

  /**
   * Interface to a <unit> element.
   */
  interface Unit
    : CellMLElement
  {
    /**
     * The value of the prefix attribute in the unit element. This is
     * automatically converted to or from the text name of the SI prefix when
     * converting to a DOM view.
     */
    attribute long prefix;

    /**
     * The value of the multiplier attribute in the unit element.
     */
    attribute double multiplier;

    /**
     * The value of the offset attribute in the unit element.
     */
    attribute double offset;

    /**
     * The value of the exponent attribute in unit element.
     */
    attribute double exponent;

    /**
     * The name of the units attribute.
     */
    attribute CellMLAttributeString units;
  };

  /**
   * This interface represents a CellML import element.
   */
  interface CellMLImport
    : CellMLElement
  {
    /**
     * The URI in the xlink:href attribute.
     */
    attribute URI xlinkHref;

    /**
     * The collection of all <component> elements inside this element.
     */
    readonly attribute CollectionOfImportComponents components;

    /**
     * The collection of all <units> elements inside this element.
     */
    readonly attribute CollectionOfImportUnits units;

    /**
     * The collection of all connections defined in the import or in components
     * which are imported by the import(and so on) and which involve only
     * the imported component or other components beneath the same imported
     * component in the encapsulation hierarchy.
     */
    readonly attribute CollectionOfConnections importedConnections;

    /**
     * Fully instantiate the import.
     * @todo Definition of full instantiation.
     */
    void fullyInstantiate();

    /**
     * Returns true if fullyInstantiate has previously been called on this
     * import, or false otherwise.
     */
    readonly attribute boolean wasFullyInstantiated;
  };

  /**
   * This interface represents a <component> element inside an <import>
   * element.
   */
  interface ImportComponent
    : CellMLComponent
  {
    /**
     * The name of the component referenced by this import component.
     * @todo what happens if this is changed after fullyInstantiate()?
     */
    attribute CellMLAttributeString componentRef;

    /**
     * Fully instantiate the import.
     * @todo Definition of full instantiation.
     */
    void fullyInstantiate();

    /**
     * Returns true if fullyInstantiate has previously been called on this
     * import, or false otherwise.
     */
    readonly attribute boolean wasFullyInstantiated;
  };

  /**
   * This interface represents a <units> found in <import>
   */
  interface ImportUnits
    : Units
  {
    /**
     * The name of the units referenced by this import component.
     * @todo what happens if this is changed after fullyInstantiate()?
     */
    attribute CellMLAttributeString unitsRef;

    /**
     * Fully instantiate the import.
     * @todo Definition of full instantiation.
     */
    void fullyInstantiate();

    /**
     * Returns true if fullyInstantiate has previously been called on this
     * import, or false otherwise.
     */
    readonly attribute boolean wasFullyInstantiated;
  };

  /**
   * An enumeration representing the direction of the variable interface.
   */
  enum VariableInterface
  {
    /**
     * The interface is in.
     */
    INTERFACE_IN,
    /**
     * The interface is out.
     */
    INTERFACE_OUT,
    /**
     * No interface is defined.
     */
    INTERFACE_NONE
  };

  /**
   * Represents a <variable> element in a CellML document.
   */
  interface CellMLVariable
    : CellMLElement
  {
    /**
     * The initial value of this variable.
     */
    attribute CellMLAttributeString initialValue;

    /**
     * The private interface direction of this variable.
     */
    attribute VariableInterface privateInterface;

    /**
     * The public interface direction of this variable.
     */
    attribute VariableInterface publicInterface;

    /**
     * The collection of all variables connected to this variable.
     */
    readonly attribute CollectionOfVariables connectedVariables;

    /**
     * The source variable is always a variable on which f(v) holds, and is
     * this variable, or a variable which is(directly or indirectly) connected
     * to this variable. If no such variable exists, sourceVariable is null.
     * This must work correctly across import boundaries, if those imports
     * have been fully instantiated.
     * f(v) is defined as meaning
     *   (v.public_interface == INTERFACE_OUT ||
     *    v.public_interface == INTERFACE_NONE) &&
     *   (v.private_interface == INTERFACE_OUT ||
     *    v.private_interface == INTERFACE_NONE)
     * 
     */
    readonly attribute CellMLVariable sourceVariable;
  };

  /**
   * Represents a <component_ref> element in a group element or in another
   * <component_ref> element.
   */
  interface ComponentRef
    : CellMLElement

  {
    /**
     * The name of the component being referenced.
     */
    attribute CellMLAttributeString componentName;

    /**
     * A collection of component references which are beneath this one in the
     * group tree.
     */
    readonly attribute CollectionOfComponentRefs componentRefs;

    /**
     * The parent component reference, or null if this is the toplevel
     * component reference.
     */
    readonly attribute ComponentRef parentComponentRef;

    /**
     * Thie parent group in which the component reference is found.
     */
    readonly attribute Group parentGroup;
  };

  /**
   * Represents a relationship_ref element in a group element.
   */
  interface RelationshipRef
    : CellMLElement
  {
    /**
     * The name of this relationship_ref, or the empty string if no such name
     * is defined.
     */
    attribute CellMLAttributeString name;

    /**
     * The name of the relationship referenced by this element.
     */
    attribute CellMLAttributeString relationship;

    /**
     * The namespace in which the relationship attribute belongs.
     */
    attribute URI relationship_namespace;
  };

  /**
   * Represents a <group> element.
   */
  interface Group
  {
    /**
     * The collection of relationship references.
     */
    attribute CollectionOfRelationshipRefs relationshipRefs;

    /**
     * The collection of component references.
     */
    attribute CollectionOfComponentRefs componentRefs;

    /**    
     * @todo Find out what Matt meant by the following
             Component get_parent_component_name(component name)
             Component get_children_component_names(component name)
    */

    /**
     * True if this is an encapsulation relationship
     * (with relationship on relationship_ref in the CellML namespace)
     * and false otherwise.
     */
    readonly attribute boolean isEncapsulation;

    /**
     * True if this is a containment relationship
     * (with relationship on relationship_ref in the CellML namespace)
     * and false otherwise.
     */
    readonly attribute boolean isContainment;
  };

  /**
   * Represents a <connection> element.
   */
  interface Connection
    : CellMLElement
  {
    /**
     * The map_components element in this connection.
     */
    readonly attribute MapComponents componentMapping;

    /**
     * A collection of the map_variables elements in this connection.
     */
    readonly attribute CollectionOfMapVariables variableMappings;
  };

  /**
   * An interface the map_components element.
   */
  interface MapComponents
    : CellMLElement
  {
    /**
     * The name of the first component.
     */
    attribute CellMLAttributeString firstComponentName;
    
    /**
     * The name of the second component.
     */
    attribute CellMLAttributeString secondComponentName;

    /**
     * The first component.
     */
    readonly attribute CellMLComponent firstComponent;

    /**
     * The second component.
     */
    readonly attribute CellMLComponent secondComponent;   
  };

  /**
   * An interface the map_variables element.
   */
  interface MapVariables
    : CellMLElement
  {
    /**
     * The name of the first variable.
     */
    attribute CellMLAttributeString firstVariableName;

    /**
     * The name of the second variable.
     */
    attribute CellMLAttributeString secondVariableName;

    /**
     * The first variable.
     */
    readonly attribute CellMLVariable firstVariable;

    /**
     * The second variable.
     */
    readonly attribute CellMLVariable secondVariable;
  };

  /**
   * An interface to a <reaction> element.
   */
  interface Reaction
    : CellMLElement
  {
    /**
     * A collection of all the reactants involved in this reaction.
     */
    readonly attribute CollectionOfReactantVariableRefElements reactants;

    /**
     * A collection of all the products for this reaction.
     */
    readonly attribute CollectionOfProductVariableRefElements products;

    /**
     * A reference to the rate variable.
     */
    readonly attribute RateVariableRef rate;
  };

  /**
   * An interface to any type of variable reference.
   */
  interface VariableRef
    : CellMLElement
  {
    /**
     * The variable being referenced.
     */
    readonly attribute CellMLVariable variable;

    /**
     * A string representing the type of variable reference.
     * "reactant" if this is a reference to a variable with the reactant role.
     * "product" if this is a reference to a variable with the product role.
     * "rate" if this is a reference to a variable with the rate role.
     */
    readonly attribute string refType;
  };

  /**
   * An interface to a reactant variable reference.
   */
  interface ReactantVariableRef
    : VariableRef
  {
    attribute ReactantRole role;
  };

  interface ProductRole;

  /*
   * An interface to a reactant variable reference.
   */
  interface ProductVariableRef
    : VariableRef
  {
    attribute ProductRole role;
  };

  interface RateRole;

  /**
   * An interface to a rate variable reference.
   */
  interface RateVariableRef
    : VariableRef
  {
    attribute RateRole role;
  };

  /**
   * An interface to any type of role.
   */
  interface Role
    : CellMLElement
  {
    /**
     * A string representing the type of role.
     * "reactant" if this is a reactant role.
     * "product" if this is a product role.
     * "rate" if this is a rate role.
     */
    readonly attribute string roleType;
  };

  /**
   * An interface to a reactant role.
   */
  interface ReactantRole
    : Role
  {
  };

  /**
   * An interface to a product role.
   */
  interface ProductRole
    : Role
  {
  };

  /**
   * An interface to a rate role.
   */
  interface RateRole
    : Role
  {
    /**
     * A collection of maths which applies to this rate role.
     */
    readonly attribute CollectionOfMath maths;
  };

  /**
   * An interface allowing CellMLElements to be iterated.
   */
  interface CellMLElementIterator
  {
    /**
     * Fetches the next CellML element, and advances the iterator.
     * @return The next CellML element, or null if there are no more CellML
     *         elements.
     */
    CellMLElement next();
  };

  /**
   * An interface allowing MathMLElements to be iterated.
   */
  interface MathMLElementIterator
  {
    /**
     * Fetches the next MathML element, and advances the iterator.
     * @return The next MathML element, or null if there are no more MathML
     *         elements.
     */
    MathMLElement next();
  };

  /**
   * An interface allowing CellMLAttributeStrings to be iterated.
   */
  interface CellMLAttributeStringIterator
  {
    /**
     * Fetches the next CellML attribute string, and advances the iterator.
     * @return The next CellML attribute string, or null if there are no more
     *         CellML attribute strings.
     */
    CellMLAttributeString next();
  };

  /**
   * A collection of extension elements.
   */
  interface CollectionOfExtensionElements
  {
    /**
     * The length of the collection.
     */
    readonly attribute unsigned long length;

    /**
     * Tests for the existance of an element in the set.
     * @param x The element to test for.
     * @return true if the element is present, or false otherwise.
     */
    boolean contains(in ExtensionElement x);

    /**
     * Finds the index of the given extension element.
     * @param x The extension element to find.
     * @return The index(first is 0) of the extension element, or -1 if the
     *         element is not found.
     */
    long getIndexOf(in ExtensionElement x);

    /**
     * Fetches the extension element at a certain index(starting from 0).
     * @param index The index at which to fetch the extension element.
     */
    ExtensionElement getAt(in unsigned long index);

    /**
     * Insert an element into this collection without disturbing the order of
     * the existing elements.
     * @param index The new index(indices start at 0) that the inserted element
     *              will have. Must be in the range [0, length]
     * @param x The element to insert.
     */
    void insertAt(in unsigned long index, in ExtensionElement x);

    /**
     * Equivalent to insertAt(length, x)
     * @param x The element to append.
     */
    void append(in ExtensionElement x);

    /**
     * Equivalent to insertAt(0, x)
     * @param x The element to prepend.
     */
    void prepend(in ExtensionElement x);

    /**
     * Remove an element from this collection. If the element is not found,
     * do nothing.
     * @param x The element to remove.
     */
    void remove(in ExtensionElement x);

    /**
     * Find an element in this collection, and if it is found, replace it
     * with another element.
     * @param x The element to find.
     * @param y The element to replace x with.
     */
    void replace(in ExtensionElement x, in ExtensionElement y);

    /**
     * Remove all elements in this collection.
     */
    void clear();    
  };

  /**
   * A collection of math.
   */
  interface CollectionOfMath
  {
    /**
     * The length of the collection.
     */
    readonly attribute unsigned long length;

    /**
     * Tests for the existance of an element in the set.
     * @param x The element to test for.
     * @return true if the element is present, or false otherwise.
     */
    boolean contains(in MathMLElement x);

    /**
     * Returns a CellMLElementIterator that can be used to iterate through the
     * elements. The iteration order is undefined.
     */
    MathMLElementIterator iterate();

    /**
     * Add an element to this collection.
     * @param x The element to add.
     */
    void add(in MathMLElement x);

    /**
     * Remove an element from this collection. If the element is not found,
     * do nothing.
     * @param x The element to remove.
     */
    void remove(in MathMLElement x);

    /**
     * Find an element in this collection, and if it is found, replace it
     * with another element.
     * @param x The element to find.
     * @param y The element to replace x with.
     * @raises CellMLException If y is not valid according to the constraints
     *                         on this collection(check optional).
     */
    void replace(in MathMLElement x, in MathMLElement y);

    /**
     * Remove all elements in this collection.
     */
    void clear();
  };

  /**
   * An immutable collection of CellML attribute strings.
   */
  interface ConstCollectionOfCellMLAttributeString
  {
    /**
     * The length of the collection.
     */
    readonly attribute unsigned long length;

    /**
     * Tests for the existance of a string in the set.
     * @param x The string to test for.
     * @return true if the string is present, or false otherwise.
     */
    boolean contains(in CellMLAttributeString x);

    /**
     * Returns a CellMLAttributeStringIterator that can be used to iterate
     * through the strings. The iteration order is undefined.
     */
    CellMLAttributeStringIterator iterate();
  };

  /**
   * A collection of CellML attribute strings.
   */
  interface CollectionOfCellMLAttributeString
    : ConstCollectionOfCellMLAttributeString
  {
    /**
     * Add a string to this collection.
     * @param x The string to add.
     */
    void add(in CellMLAttributeString x);

    /**
     * Remove a string from this collection. If the string is not found,
     * do nothing.
     * @param x The string to remove.
     */
    void remove(in CellMLAttributeString x);

    /**
     * Find a string in this collection, and if it is found, replace it
     * with another string.
     * @param x The string to find.
     * @param y The string to replace x with.
     */
    void replace(in CellMLAttributeString x, in CellMLAttributeString y);

    /**
     * Remove all strings in this collection.
     */
    void clear();
  };

  /**
   * An immutable collection of CellML elements.
   */
  interface ConstCollectionOfCellMLElements
  {
    /**
     * The length of the collection.
     */
    readonly attribute unsigned long length;

    /**
     * Tests for the existance of an element in the set.
     * @param x The element to test for.
     * @return true if the element is present, or false otherwise.
     */
    boolean contains(in CellMLElement x);

    /**
     * Returns a CellMLElementIterator that can be used to iterate through the
     * elements. The iteration order is undefined.
     */
    CellMLElementIterator iterate();
  };

  /**
   * An interface for modifying a collection of CellML elements.
   */
  interface ModifyCollectionOfCellMLElements
  {
    /**
     * Add an element to this collection.
     * @param x The element to add.
     * @raises CellMLException If x is not valid according to the constraints
     *                         on this collection(check optional).
     */
    void add(in CellMLElement x)
      raises(CellMLException);

    /**
     * Remove an element from this collection. If the element is not found,
     * do nothing.
     * @param x The element to remove.
     */
    void remove(in CellMLElement x);

    /**
     * Find an element in this collection, and if it is found, replace it
     * with another element.
     * @param x The element to find.
     * @param y The element to replace x with.
     * @raises CellMLException If y is not valid according to the constraints
     *                         on this collection(check optional).
     */
    void replace(in CellMLElement x, in CellMLElement y)
      raises(CellMLException);

    /**
     * Remove all elements in this collection.
     */
    void clear();
  };

  /**
   * An interface for viewing or modifying a collection of CellML elements.
   */
  interface CollectionOfCellMLElements
    : ConstCollectionOfCellMLElements, ModifyCollectionOfCellMLElements
  {
  };

  /**
   * An interface for accessing a collection of NamedCellMLElements. It is
   * an error if any element in this collection does not inherit from
   * NamedCellMLElement.
   */
  interface ConstCollectionOfNamedCellMLElements
    : ConstCollectionOfCellMLElements
  {
    /**
     * Fetch a NamedCellMLElement by name.
     * @param name The name of the element
     * @return The element, or null if not found.
     */
    NamedCellMLElement get(in CellMLAttributeString name);
  };

  /**
   * An interface for modifying a collection of NamedCellMLElements. It is an
   * error if any element in this collection does not inherit from
   * NamedCellMLElement.
   */
  interface ModifyCollectionOfNamedCellMLElements
    : ModifyCollectionOfCellMLElements
  {
    /**
     * Remove a CellML element by name, or do nothing if that element is not
     * found.
     * @param name The name to remove.
     */
    void removeByName(in CellMLAttributeString name);
  };

  /**
   * An interface for accessing or modifying a collection of
   * NamedCellMLElements.
   */
  interface CollectionOfNamedCellMLElements
    : CollectionOfCellMLElements,
      ConstCollectionOfNamedCellMLElements,
      ModifyCollectionOfNamedCellMLElements
  {
  };

  /**
   * An interface for accessing a collection of models.
   */
  interface ConstCollectionOfModels
    : ConstCollectionOfNamedCellMLElements
  {
  };
  
  /**
   * An interface for accessing or modifying a collection of models.
   */
  interface CollectionOfModels
    : CollectionOfNamedCellMLElements
  {
  };

  /**
   * An interface for accessing or modifying a collection of components.
   */
  interface CollectionOfComponents
    : CollectionOfNamedCellMLElements
  {
  };

  /**
   * An interface for accessing a collection of components.
   */
  interface ConstCollectionOfComponents
    : ConstCollectionOfNamedCellMLElements
  {
  };

  /**
   * An interface for accessing or modifying a collection of <import>
   * components.
   */
  interface CollectionOfImportComponents
    : CollectionOfComponents
  {
  };

  /**
   * An interface for accessing or modifying a collection of variables.
   */
  interface CollectionOfVariables
    : CollectionOfNamedCellMLElements
  {
  };

  /**
   * An interface for accessing a collection of units.
   */
  interface ConstCollectionOfUnits
    : ConstCollectionOfNamedCellMLElements
  {
  };
  
  /**
   * An interface for accessing or modifying a collection of units.
   */
  interface CollectionOfUnits
    : CollectionOfNamedCellMLElements
  {
  };

  /**
   * An interface for accessing or modifying a collection of import units.
   */
  interface CollectionOfImportUnits
    : CollectionOfUnits
  {
  };

  /**
   * An interface for accessing or modifying a collection of imports.
   */
  interface CollectionOfImports
    : CollectionOfCellMLElements
  {
  };  

  /**
   * An interface for accessing or modifying a collection of unit elements.
   */
  interface CollectionOfUnit
    : CollectionOfCellMLElements
  {
  };

  /**
   * An interface for accessing a collection of connections.
   */
  interface ConstCollectionOfConnections
    : ConstCollectionOfCellMLElements
  {
    /**
     * Fetch a subset collection containing only those connections involving
     * the named component.
     * @param compName The component to restrict this to.
     */
    ConstCollectionOfConnections
      getSubsetInvolvingComponent(in CellMLAttributeString compName);
  };

  /**
   * An interface for accessing or modifying a collection of connections.
   */
  interface CollectionOfConnections
    : CollectionOfCellMLElements, ConstCollectionOfConnections
  {
  };

  /**
   * An interface for accessing a collection of groups.
   */
  interface ConstCollectionOfGroups
  {
    /**
     * Fetch a subset collection containing only those connections involving
     * the named relationship.
     * @param relName The relationship to restrict this to.
     */
    ConstCollectionOfConnections
      getSubsetInvolvingRelationship(in CellMLAttributeString relName);

    /**
     * The subset of all connections in this collection involving
     * encapsulation.
     */
    readonly attribute ConstCollectionOfConnections subsetInvolvingEncapsulation;

    /**
     * The subset of all connections in this collection involving
     * containment.
     */
    readonly attribute ConstCollectionOfConnections subsetInvolvingContainment;
  };

  /**
   * An interface for accessing or modifying a collection of groups.
   */
  interface CollectionOfGroups
    : ConstCollectionOfGroups, CollectionOfCellMLElements
  {
  };

  /**
   * An interface for accessing or modifying a collection of relationship refs.
   */
  interface CollectionOfRelationshipRefs
    : CollectionOfCellMLElements
  {
  };

  /**
   * An interface for accessing or modifying a collection of component refs.
   */
  interface CollectionOfComponentRefs
    : CollectionOfCellMLElements
  {
  };

  /**
   * An interface for accessing or modifiying a collection of map_variables.
   */
  interface CollectionOfMapVariables
    : CollectionOfCellMLElements
  {
  };

  /**
   * An interface for accessing or modifying a collection of reactant variable
   * refs.
   */
  interface CollectionOfReactantVariableRefElements
    : CollectionOfCellMLElements
  {
  };

  /**
   * An interface for accessing or modifying a collection of product variable
   * refs.
   */
  interface CollectionOfProductVariableRefElements
    : CollectionOfCellMLElements
  {
  };
};


  • [cellml-discussion] Another IDL for the CellML API, Andrew Miller, 03/26/2005

Archive powered by MHonArc 2.6.18.

Top of page