biouml.plugins.sbml
Class SbmlModelWriter

java.lang.Object
  extended bybiouml.plugins.sbml.SbmlConstants
      extended bybiouml.plugins.sbml.SbmlSupport
          extended bybiouml.plugins.sbml.SbmlModelWriter
Direct Known Subclasses:
SbmlModelWriter_21, SbmlModelWriter_L1

public abstract class SbmlModelWriter
extends SbmlSupport

Writes diagram in SBML format. SbmlModelWriter can correctly process following types of diagram:

Reactant and product are obligatory elements of SBML reaction, but it BioUML allows user to create reaction without reactants or products. So to respect SBML requirements REACTANT_STUB or PRODUCT_STUB can be added into reaction and model.

SbmlModelReader can recognise such stubs and remove them from model automatically. Thus "_in_empty_set" (REACTANT_STUB) and "_out_empty_set" are reserved key words that should not be used as species names.

Pendung:
SName validation, warn if species list or reaction list is empty.

Field Summary
protected  java.util.List compartmentList
           
protected  org.w3c.dom.Document document
           
protected  boolean doProductStub
           
protected  boolean doReactantStub
           
protected  org.w3c.dom.Element speciesListElement
           
 
Fields inherited from class biouml.plugins.sbml.SbmlSupport
diagram, emodel, log, modelName
 
Fields inherited from class biouml.plugins.sbml.SbmlConstants
ANNOTATION_ELEMENT, ASSIGNEMENT_ELEMENT, ASSIGNEMENT_LIST_ELEMENT, ASSIGNEMENT_VARIABLE_ATTR, BIOUML_COMPARTMENT_INFO_ELEMENT, BIOUML_EDGE_INFO_ELEMENT, BIOUML_NODE_INFO_ELEMENT, BIOUML_SPECIE_INFO_ELEMENT, BIOUML_SPECIE_TYPE_ATTR, BIOUML_XMLNS_ATTR, BIOUML_XMLNS_VALUE, COMPARTMENT_ATTR, COMPARTMENT_DIMENTION_ATTR, COMPARTMENT_ELEMENT, COMPARTMENT_LIST_ELEMENT, COMPARTMENT_OUTSIDE_ATTR, COMPARTMENT_VOLUME_ATTR, CONSTANT_ATTR, DELAY_ELEMENT, DENOMINATOR_ATTR, EVENT_ELEMENT, EVENT_LIST_ELEMENT, FORMULA_ATTR, FUNCTION_DEFINITION_ELEMENT, FUNCTION_LIST_ELEMENT, ID_ATTR, KINETIC_LAW_ELEMENT, MATH_ATTR, MATH_ELEMENT, MODEL_ELEMENT, MODIFIER_LIST_ELEMENT, NAME_ATTR, NOTES_ELEMENT, PARAMETER_ELEMENT, PARAMETER_LIST_ELEMENT, PARAMETER_VALUE_ATTR, PRODUCT_LIST_ELEMENT, PRODUCT_STUB, REACTANT_LIST_ELEMENT, REACTANT_STUB, REACTION_ELEMENT, REACTION_FAST_ATTR, REACTION_LIST_ELEMENT, REACTION_REVERSIBLE_ATTR, RULE_ALGEBRAIC_ELEMENT, RULE_ASSIGNEMENT_ELEMENT, RULE_COMMENT_ATTR, RULE_COMPARTMENT_VOLUME_ELEMENT, RULE_FORMULA_ATTR, RULE_LIST_ELEMENT, RULE_PARAMETER_ELEMENT, RULE_RATE_ELEMENT, RULE_SPECIE_CONCENTRATION_ELEMENT, RULE_VARIABLE_ATTR, SBML_ELEMENT, SBML_LEVEL_ATTR, SBML_LEVEL_VALUE_1, SBML_LEVEL_VALUE_2, SBML_VERSION_ATTR, SBML_VERSION_VALUE_1, SBML_VERSION_VALUE_2, SBML_XMLNS_VALUE, SPECIE_ATTR, SPECIE_ATTR_11, SPECIE_BOUNDARY_CONDITION_ATTR, SPECIE_CHARGE_ATTR, SPECIE_DEFAULT_SUBSTANCE_UNITS, SPECIE_ELEMENT, SPECIE_ELEMENT_11, SPECIE_HAS_ONLY_SUBSTANCE_UNITS_ATTR, SPECIE_INITIAL_AMOUNT_ATTR, SPECIE_INITIAL_CONCENTRATION_ATTR, SPECIE_LIST_ELEMENT, SPECIE_REFERENCE_ELEMENT, SPECIE_REFERENCE_ELEMENT_11, SPECIE_SPATIAL_SIZE_UNITS_ATTR, SPECIE_SUBSTANCE_UNITS_ATTR, STOICHIOMETRY_ATTR, STOICHIOMETRY_MATH_ELEMENT, SUBSTANCE_UNITS_ATTR, TIME_UNITS_ATTR, TRIGGER_ELEMENT, TYPE_ATTR, UNIT_LIST_ELEMENT, UNIT_SUBSTANCE, UNIT_TIME, UNIT_VOLUME, UNITS_ATTR, XMLNS_ATTR
 
Constructor Summary
SbmlModelWriter()
           
 
Method Summary
 org.w3c.dom.Document createDOM(Diagram sourceDiagram)
           
protected abstract  org.w3c.dom.Element createSpecieElement()
           
protected  void fillCompartmentList(Compartment compartment, boolean includeItself)
           
protected abstract  void initContext()
          Initializes context of the writer.
protected  boolean parseAsSpecie(java.lang.String token, java.lang.StringBuffer result)
           
protected abstract  void setId(org.w3c.dom.Element element, java.lang.String id)
          Sets 'id' or 'name' attribute (according to level and version) equal to given string.
protected abstract  void setLevel(org.w3c.dom.Element sbmlElement)
           
protected abstract  void setVersion(org.w3c.dom.Element sbmlElement)
           
protected abstract  boolean validCompartmentList(java.util.List compartmentList)
          Returns true if compartment list is valid according to given version of SBML specification.
protected abstract  boolean validReaction(Node reaction)
          Returns true if reaction is valid according to given version of SBML specification.
protected  void writeCompartment(org.w3c.dom.Element compartmentListElement, Compartment compartment)
           
protected  org.w3c.dom.Element writeCompartmentList(org.w3c.dom.Element model)
           
protected  void writeDiagram(org.w3c.dom.Element sbml)
           
protected abstract  void writeEventList(org.w3c.dom.Element model)
           
protected abstract  void writeFormula(java.lang.String formula, Node reaction, org.w3c.dom.Element kineticLawElement)
           
protected abstract  void writeFunctionDefinitionList(org.w3c.dom.Element model)
          Function definitions are only supported since level 2
protected  void writeKineticLaw(org.w3c.dom.Element reactionElement, Node reaction)
           
 void writeNotes(org.w3c.dom.Element element, java.lang.String notes)
           
protected  void writeParameter(org.w3c.dom.Element parameterListElement, Variable parameter)
           
protected  void writeParameterList(org.w3c.dom.Element element)
           
protected  void writeProducts(org.w3c.dom.Element reactionElement, Node reaction)
           
protected  void writeReactants(org.w3c.dom.Element reactionElement, Node reaction)
           
protected  void writeReaction(org.w3c.dom.Element reactionListElement, Node reaction)
           
protected  org.w3c.dom.Element writeReactionList(org.w3c.dom.Element model)
           
protected  void writeReactionList(org.w3c.dom.Element reactionListElement, Compartment compartment)
           
protected abstract  void writeRuleList(org.w3c.dom.Element model)
          Writes list of rules, that are not rules derived from reactions
protected  void writeSpecie(org.w3c.dom.Element speciesListElement, Node species)
           
protected  org.w3c.dom.Element writeSpecieList(org.w3c.dom.Element model)
           
protected  void writeSpecieList(org.w3c.dom.Element speciesListElement, Compartment compartment)
           
protected  boolean writeSpecieReferences(org.w3c.dom.Element listElement, Node reaction, java.lang.String role)
           
protected  void writeSpecieStub(org.w3c.dom.Element speciesListElement, java.lang.String stubName, java.lang.String messageKey)
           
protected  void writeStubReference(org.w3c.dom.Element listElement, Node reaction, java.lang.String stubName)
           
protected abstract  void writeUnitList(org.w3c.dom.Element model)
           
 
Methods inherited from class biouml.plugins.sbml.SbmlSupport
error, getElement, parseAsCompartment, parseAsParameter, parseFormula, readXhtml, warn, writeXhtml
 
Methods inherited from class biouml.plugins.sbml.SbmlConstants
DEFAULT_SPATIAL_SIZE_UNITS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected org.w3c.dom.Document document

compartmentList

protected java.util.List compartmentList

speciesListElement

protected org.w3c.dom.Element speciesListElement

doReactantStub

protected boolean doReactantStub

doProductStub

protected boolean doProductStub
Constructor Detail

SbmlModelWriter

public SbmlModelWriter()
Method Detail

setLevel

protected abstract void setLevel(org.w3c.dom.Element sbmlElement)

setVersion

protected abstract void setVersion(org.w3c.dom.Element sbmlElement)

setId

protected abstract void setId(org.w3c.dom.Element element,
                              java.lang.String id)
Sets 'id' or 'name' attribute (according to level and version) equal to given string.


initContext

protected abstract void initContext()
Initializes context of the writer.


validCompartmentList

protected abstract boolean validCompartmentList(java.util.List compartmentList)
Returns true if compartment list is valid according to given version of SBML specification.


validReaction

protected abstract boolean validReaction(Node reaction)
Returns true if reaction is valid according to given version of SBML specification.


createDOM

public org.w3c.dom.Document createDOM(Diagram sourceDiagram)
                               throws java.lang.Exception
Throws:
java.lang.Exception

writeNotes

public void writeNotes(org.w3c.dom.Element element,
                       java.lang.String notes)

writeDiagram

protected void writeDiagram(org.w3c.dom.Element sbml)
                     throws java.lang.Exception
Throws:
java.lang.Exception

writeFunctionDefinitionList

protected abstract void writeFunctionDefinitionList(org.w3c.dom.Element model)
Function definitions are only supported since level 2


writeUnitList

protected abstract void writeUnitList(org.w3c.dom.Element model)
To do:
Complete units support. It will stay absract for the sake of clarity

writeRuleList

protected abstract void writeRuleList(org.w3c.dom.Element model)
Writes list of rules, that are not rules derived from reactions


writeEventList

protected abstract void writeEventList(org.w3c.dom.Element model)

writeCompartmentList

protected org.w3c.dom.Element writeCompartmentList(org.w3c.dom.Element model)

fillCompartmentList

protected void fillCompartmentList(Compartment compartment,
                                   boolean includeItself)

writeCompartment

protected void writeCompartment(org.w3c.dom.Element compartmentListElement,
                                Compartment compartment)

writeSpecieList

protected org.w3c.dom.Element writeSpecieList(org.w3c.dom.Element model)

writeSpecieList

protected void writeSpecieList(org.w3c.dom.Element speciesListElement,
                               Compartment compartment)

createSpecieElement

protected abstract org.w3c.dom.Element createSpecieElement()

writeSpecie

protected void writeSpecie(org.w3c.dom.Element speciesListElement,
                           Node species)

writeParameterList

protected void writeParameterList(org.w3c.dom.Element element)

writeParameter

protected void writeParameter(org.w3c.dom.Element parameterListElement,
                              Variable parameter)

writeReactionList

protected org.w3c.dom.Element writeReactionList(org.w3c.dom.Element model)

writeReactionList

protected void writeReactionList(org.w3c.dom.Element reactionListElement,
                                 Compartment compartment)

writeReaction

protected void writeReaction(org.w3c.dom.Element reactionListElement,
                             Node reaction)

writeReactants

protected void writeReactants(org.w3c.dom.Element reactionElement,
                              Node reaction)

writeProducts

protected void writeProducts(org.w3c.dom.Element reactionElement,
                             Node reaction)

writeSpecieReferences

protected boolean writeSpecieReferences(org.w3c.dom.Element listElement,
                                        Node reaction,
                                        java.lang.String role)

writeStubReference

protected void writeStubReference(org.w3c.dom.Element listElement,
                                  Node reaction,
                                  java.lang.String stubName)

writeSpecieStub

protected void writeSpecieStub(org.w3c.dom.Element speciesListElement,
                               java.lang.String stubName,
                               java.lang.String messageKey)

writeKineticLaw

protected void writeKineticLaw(org.w3c.dom.Element reactionElement,
                               Node reaction)

writeFormula

protected abstract void writeFormula(java.lang.String formula,
                                     Node reaction,
                                     org.w3c.dom.Element kineticLawElement)

parseAsSpecie

protected boolean parseAsSpecie(java.lang.String token,
                                java.lang.StringBuffer result)
Overrides:
parseAsSpecie in class SbmlSupport


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.