CellML Logo

CellML Specification 1.1

Draft — 6 November 2002

Get
the PDF!

9  Importing Models

9.1  Introduction

The modular structure of CellML seen so far can be taken up one level to make it easier to build a model on previously published models. Often in systems biology, molecular behaviour is researched, modelled, and described in steps. One (group of) scientist(s) will model the flux of ions across a cell membrane, for instance, limiting their study to certain variables. Others will build on the first's work, expanding the focus of the study, and so on. To reflect a realistic method of model building, a CellML modeller may choose to use the import features described below.

9.2  Basic Structure

9.2.1  Definition of imported models

To be able to reuse a model, the model must first be imported into the current model. The <cellml:import_model> element is used to locate the model that will be imported. The CellML import feature makes use of the W3C hyperlink standard, XLink, to identify the link between the current model and the model being imported. Each <cellml:import_model> element must have an xlink:title attribute and an xlink:href attribute. The xlink and cellml namespace prefixes are used throughout this section to indicate that the elements are in the XLink and CellML namespaces, respectively. The value of the xlink:title attribute is a CellML identifier which must be unique amongst all <cellml:import_model> elements within the current model. It need not be equal to the value of the cellml:name attribute of the root <cellml:model> element of the imported model. The xlink:href attribute has a value equal to the Uniform Resource Identifier that identifies the location of the imported cell model. Throughout the current CellML model, the value of the xlink:title attribute will be used to point to the model identified by the value of the xlink:href attribute. A model may import any number of valid CellML models.

9.2.2  Referencing units from an imported model

Units from an imported model may be called in the current model by use of the cellml:units_model attribute. Any cellml:units attribute may be clarified by tagging a cellml:units_model attribute to the same element the cellml:units attribute qualifies. If the cellml:units_model attribute is present, the units referenced by the cellml:units attribute must be a globally defined units in the model referenced by the cellml:cellmlunits_model attribute.

9.2.3  Mapping variables between models

Variables can be mapped between models in much the same way as mapping variables between components in a model. Variables must still be mapped through components, and connections can be made between two models' components by using the cellml:model_1 and cellml:model_2 attribute qualifiers on a <cellml:map_components> element. If the cellml:model_1 attribute is present, the model referenced must contain the component referenced by the cellml:component_1 attribute on the same element. Similarly, the model referenced by the cellml:model_2 attribute, if present, must contain the component referenced by the cellml:component_2 attribute on the same element.

9.3  Examples

Figure 17 shows the use of the <cellml:import_model> element to import a CellML model located at
http://www.example.com/units.xml that contains two units definitions: one with the name of microF and another named microA_per_microF. The imported model is aliased to the name units_dictionary so that when a cellml:units_model attribute calls the alias, a processor knows in which document to look for the corresponding units.

When a connection is made between the membrane component and another imported model, the cellml:model_1 attribute is tagged to the <cellml:map_components> element to indicate that the component referenced by the cellml:component_1 attribute can be found in the model aliased to the name sodium_current_component. In this example, the model containing the membrane component, cellml:component_2, is the current model; therefore, no cellml:model_2 attribute is necessary.


<model
    
xmlns="http://www.cellml.org/cellml/1.1#"
    
xmlns:xlink="http://www.w3.org/1999/xlink">
  
<import_model
      
xlink:href="http://www.example.com/units.xml"
      
xlink:title="units_dictionary" />
  
<import_model
      
xlink:href="http://www.example.com/sodium_current_component.xml"
      
xlink:title="sodium_current_component" />

  
<component name="membrane">
    
<variable name="Cm" units="microF" units_model="units_dictionary" />
    
<variable
        
name="I_st" units="microA_per_microF" units_model="units_dictionary" />
    ...

  
</component>

  
<connection>
    
<map_components
        
component_1="sodium_current" component_2="membrane"
        
model_1="sodium_current_component" />
    
<map_variables variable_1="V" variable_2="V" />
    
<map_variables variable_1="constant_T" variable_2="T" />
  
</connection>

</model>

Figure 17 The <cellml:import_model> identifies the URI of the file being imported and gives the model a name by which it will be referred in the current model. See text for more details.


9.4  Rules for CellML Documents

9.4.1  The <import_model> element

  1. Allowed use of the <import_model> element
    • A <cellml:import_model> element must contain only the following elements:

      • <RDF> elements in the RDF namespace.

    • Each <cellml:import_model> element must define an xlink:title attribute and an xlink:href attribute.

      [ In this and subsequent rules, the cellml and xlink prefixes are used to indicate that elements and attributes are in the CellMl and XLink namespaces, respectively. ]

  2. Proper use of the <cellml:import_model> element
    • A model must not import a model that directly or indirectly imports itself.

      [ The model tree must be acyclic. ]

  3. Allowed values of the xlink:title attribute
    • The value of the xlink:title attribute must be a valid CellML identifier as discussed in Section 2.2.1.

    • The value of the xlink:title attribute must be unique across all <cellml:import_model> elements contained in the parent <cellml:model> element.

  4. Allowed values of the xlink:href attribute

9.5  Rules for Processor Behaviour

9.5.1  Treatment of imported models

CellML processing software must include the imported models in the current model. Values of every name attribute in the imported models must be qualified with the value of the xlink:title attribute associated with the imported model.

                                                                                

Valid HTML!Valid CSS!XML/XSL