org.sbml.jsbml
public class SBMLDocument extends AbstractSBase
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Boolean> |
checkConsistencyParameters
Contains all the parameter to validate the SBML document
|
private java.util.Map<java.lang.String,java.lang.Boolean> |
enabledPackageMap
Stores a package namespace associated with it's status.
|
private SBMLErrorLog |
listOfErrors
Memorizes all
SBMLError when parsing the file containing this
document. |
private org.apache.log4j.Logger |
logger
logger used to print messages
|
private java.util.Map<java.lang.String,SBase> |
mappingFromMetaId2SBase
Stores all the meta identifiers within this
SBMLDocument to avoid
the creation of multiple identical meta identifiers. |
private Model |
model
Represents the 'model' XML subnode of a SBML file.
|
private java.util.Map<java.lang.String,java.lang.String> |
SBMLDocumentAttributes
Contains all the XML attributes of the sbml XML node.
|
private static long |
serialVersionUID
Generated serial version identifier.
|
static java.lang.String |
URI_NAMESPACE_L1
The namespace URI of SBML Level 1 Version 1 and 2.
|
static java.lang.String |
URI_NAMESPACE_L2V1
The namespace URI of SBML Level 2 Version 1.
|
static java.lang.String |
URI_NAMESPACE_L2V2
The namespace URI of SBML Level 2 Version 2.
|
static java.lang.String |
URI_NAMESPACE_L2V3
The namespace URI of SBML Level 2 Version 3.
|
static java.lang.String |
URI_NAMESPACE_L2V4
The namespace URI of SBML Level 2 Version 4.
|
static java.lang.String |
URI_NAMESPACE_L3V1Core
The namespace URI of SBML Level 3 Version 1.
|
ignoredExtensions, ignoredXMLElements, lv
listOfListeners, parent, UNKNOWN_ATTRIBUTES, UNKNOWN_ELEMENTS
Constructor and Description |
---|
SBMLDocument()
Creates a
SBMLDocument instance. |
SBMLDocument(int level,
int version)
Creates a SBMLDocument instance from a level and version.
|
SBMLDocument(SBMLDocument sb)
Creates a new
SBMLDocument instance from a given SBMLDocument . |
Modifier and Type | Method and Description |
---|---|
void |
addNamespace(java.lang.String namespaceName,
java.lang.String prefix,
java.lang.String URI)
Deprecated.
|
private void |
addPackageDeclaration(java.lang.String packageName,
java.lang.String packageURI,
boolean required)
Adds the package namespace declaration in this
SBMLDocument , adds as well
the required attribute for this package. |
int |
checkConsistency()
Validates the
SBMLDocument using the
SBML.org online validator (http://sbml.org/validator/). |
private void |
checkMetaId(java.lang.String metaId)
Checks if the given meta identifier can be added in this
SBMLDocument
's mappingFromMetaId2SBase . |
SBMLDocument |
clone()
Creates a deep copy of this object, i.e., a new
SBase with the same properties
like this one. |
private void |
collectMetaIds(java.util.Map<java.lang.String,SBase> metaIds,
SBase sbase,
boolean recursively,
boolean delete)
Collects all meta identifiers of this
AbstractSBase and all of
its sub-elements if recursively is true . |
boolean |
containsMetaId(java.lang.String metaId)
A check to see whether elements have been registered to this
SBMLDocument with the given meta identifier. |
Model |
createModel()
Creates a new Model inside this
SBMLDocument , and returns a
pointer to it. |
Model |
createModel(java.lang.String id)
Creates a new instance of Model from id and the level and version of this
SBMLDocument.
|
void |
disablePackage(java.lang.String packageURIOrName)
Disables the given SBML Level 3 package on this
SBMLDocument . |
void |
enablePackage(java.lang.String packageURIOrName)
Enables the given SBML Level 3 package on this
SBMLDocument . |
void |
enablePackage(java.lang.String packageURIOrName,
boolean enabled)
Enables or disables the given SBML Level 3 package on this
SBMLDocument . |
boolean |
equals(java.lang.Object o)
|
SBase |
findSBase(java.lang.String metaId)
Looks up the
SBase registered in this SBMLDocument for the
given metaId. |
boolean |
getAllowsChildren() |
javax.swing.tree.TreeNode |
getChildAt(int index) |
int |
getChildCount() |
int |
getDefaultLevel()
Returns the default SBML Level of new SBMLDocument objects.
|
int |
getDefaultVersion()
Returns the default Version of new SBMLDocument objects.
|
SBase |
getElementByMetaId(java.lang.String metaid)
|
java.lang.String |
getElementName()
Returns the XML element name of this object.
|
SBMLError |
getError(int i)
Returns the ith error or warning encountered during consistency checking.
|
int |
getErrorCount()
Returns the number of errors or warnings encountered during consistency checking.
|
SBMLErrorLog |
getErrorLog()
Returns a collection of all
SBMLError s reflecting
problems in the overall data structure of this SBMLDocument . |
SBMLErrorLog |
getListOfErrors()
Returns a collection of all
SBMLError s reflecting
problems in the overall data structure of this SBMLDocument . |
Model |
getModel()
Returns the model of this
SBMLDocument . |
int |
getNumErrors()
Returns the number of errors or warnings encountered during consistency checking.
|
boolean |
getPackageRequired(java.lang.String nameOrUri)
Returns the required attribute of the given package extension.
|
boolean |
getPkgRequired(java.lang.String pckage)
Deprecated.
|
java.util.Map<java.lang.String,java.lang.String> |
getSBMLDocumentAttributes()
Returns the map of attribute names and values of this SBMLDocument.
|
java.util.Map<java.lang.String,java.lang.String> |
getSBMLDocumentNamespaces()
Deprecated.
|
int |
hashCode()
Returns a hash code value for this
SBase instance. |
private void |
initDefaults() |
boolean |
isIgnoredPackage(java.lang.String nameOrURI)
Returns
true if the given package extension is one of an ignored
packages, otherwise returns false . |
boolean |
isIgnoredPkg(java.lang.String pkgURI)
Deprecated.
|
boolean |
isPackageEnabled(java.lang.String packageURIOrName)
Returns
true if the given SBML Level 3 package is enabled within the SBMLDocument . |
java.lang.Boolean |
isPackageEnabledOrDisabled(java.lang.String packageURIOrName)
Returns
true if the given SBML Level 3 package is enabled within the SBMLDocument , false
if the package was disabled using the method disablePackage(String) or null if this package
was neither enabled or disabled on this SBMLDocument . |
private boolean |
isSetListOfErrors()
Returns
true if the list of errors is defined and contain at least one error. |
boolean |
isSetModel()
|
boolean |
isSetPackageRequired(java.lang.String nameOrURI)
Returns
true . |
boolean |
isSetPkgRequired(java.lang.String pckage)
Deprecated.
|
java.util.Collection<java.lang.String> |
metaIds()
Provides access to all registered metaIds in this
SBMLDocument . |
java.lang.String |
nextMetaId()
Randomly creates a new
String that can be used as a metaid, i.e., a
String that is a valid metaid and that is not yet used by any other element
within this SBMLDocument . |
void |
printErrors(java.io.PrintStream stream)
Prints all the errors or warnings encountered trying to check this SBML document.
|
boolean |
readAttribute(java.lang.String attributeName,
java.lang.String prefix,
java.lang.String value)
Sets the given attribute in this
SBase . |
(package private) boolean |
registerMetaId(SBase sbase,
boolean add)
Saves or removes the given meta identifier in this
SBMLDocument 's
mappingFromMetaId2SBase . |
(package private) void |
registerMetaIds(SBase sbase,
boolean recursively,
boolean delete)
Collects all meta identifiers of this
AbstractSBase and all of
its sub-elements if recursively is true . |
private void |
removePackageDeclaration(java.lang.String packageName)
Removes the package namespace declaration in this
SBMLDocument , removes as well
the required attribute for this package. |
void |
setConsistencyChecks(SBMLValidator.CHECK_CATEGORY category,
boolean apply)
Controls the consistency checks that are performed when
checkConsistency() is called. |
boolean |
setLevelAndVersion(int level,
int version)
Sets the SBML Level and Version of this
SBMLDocument instance,
without attempting to convert the model. |
boolean |
setLevelAndVersion(int level,
int version,
boolean strict)
Sets the SBML Level and Version of this
SBMLDocument instance,
attempting to convert the model as needed. |
void |
setModel(Model model)
|
boolean |
setPackageRequired(java.lang.String nameOrUri,
boolean flag)
Sets the required attribute value of the given package extension (does nothing in fact!).
|
boolean |
setPkgRequired(java.lang.String pckage,
boolean flag)
Deprecated.
|
void |
setSBMLDocumentAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Sets the
SBMLDocumentAttributes . |
java.lang.String |
toString() |
boolean |
unsetModel()
|
java.util.Map<java.lang.String,java.lang.String> |
writeXMLAttributes()
Returns a map with all the attributes of this
SBase that
need to be written out in XML. |
addCVTerm, addDeclaredNamespace, addExtension, addPlugin, appendNotes, appendNotes, checkLevelAndVersionCompatibility, createHistory, createPlugin, filterCVTerms, filterCVTerms, filterCVTerms, filterCVTerms, fireNodeRemovedEvent, firePropertyChange, getAnnotation, getAnnotationString, getCVTerm, getCVTermCount, getCVTerms, getDeclaredNamespaces, getExtension, getExtensionCount, getExtensionPackages, getHistory, getIdManager, getLevel, getLevelAndVersion, getMetaId, getNamespace, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getParent, getParentSBMLObject, getPlugin, getSBMLDocument, getSBOTerm, getSBOTermID, getVersion, hasValidAnnotation, hasValidLevelVersionNamespaceCombination, isExtendedByOtherPackages, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetHistory, isSetLevel, isSetLevelAndVersion, isSetMetaId, isSetNotes, isSetParentSBMLObject, isSetPlugin, isSetSBOTerm, isSetVersion, isValidLevelAndVersionCombination, isValidMetaId, notifyChildChange, registerChild, removeCVTerm, removeCVTerm, setAnnotation, setHistory, setLevel, setMetaId, setNamespace, setNotes, setNotes, setParentSBML, setParentSBMLObject, setSBOTerm, setSBOTerm, setThisAsParentSBMLObject, setVersion, unregisterChild, unsetAnnotation, unsetCVTerms, unsetExtension, unsetHistory, unsetMetaId, unsetNamespace, unsetNotes, unsetPlugin, unsetSBOTerm
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySet
finalize, getClass, notify, notifyAll, wait, wait, wait
removeTreeNodeChangeListener
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getListOfTreeNodeChangeListeners, getRoot, getTreeNodeChangeListenerCount, getUserObject, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeUserObject, userObjectKeySet
private static final long serialVersionUID
public static final transient java.lang.String URI_NAMESPACE_L1
public static final transient java.lang.String URI_NAMESPACE_L2V1
public static final java.lang.String URI_NAMESPACE_L2V2
public static final transient java.lang.String URI_NAMESPACE_L2V3
public static final transient java.lang.String URI_NAMESPACE_L2V4
public static final transient java.lang.String URI_NAMESPACE_L3V1Core
private java.util.Map<java.lang.String,java.lang.Boolean> checkConsistencyParameters
private SBMLErrorLog listOfErrors
SBMLError
when parsing the file containing this
document.private transient org.apache.log4j.Logger logger
private java.util.Map<java.lang.String,SBase> mappingFromMetaId2SBase
SBMLDocument
to avoid
the creation of multiple identical meta identifiers. These identifiers
have to be unique within the document.private Model model
private java.util.Map<java.lang.String,java.lang.Boolean> enabledPackageMap
private java.util.Map<java.lang.String,java.lang.String> SBMLDocumentAttributes
public SBMLDocument()
SBMLDocument
instance. By default, the parent SBML object of
this object is itself. The model is null
. The SBMLDocumentAttributes and
the SBMLDocumentNamespaces are empty.public SBMLDocument(int level, int version)
null
. The
SBMLDocumentAttributes and the SBMLDocumentNamespaces are empty.level
- the SBML levelversion
- the SBML versionpublic SBMLDocument(SBMLDocument sb)
SBMLDocument
instance from a given SBMLDocument
.sb
- @Deprecated public void addNamespace(java.lang.String namespaceName, java.lang.String prefix, java.lang.String URI)
SBase.addDeclaredNamespace(String, String)
SBMLDocument
.namespaceName
- prefix
- URI
- private void addPackageDeclaration(java.lang.String packageName, java.lang.String packageURI, boolean required)
SBMLDocument
, adds as well
the required attribute for this package.packageName
- the name or short label of the package, for example: layout, comp, qual, ...packageURI
- the package namespace urirequired
- the value of the required attributeprivate void removePackageDeclaration(java.lang.String packageName)
SBMLDocument
, removes as well
the required attribute for this package.packageName
- the name or short label of the package, for example: layout, comp, qual, ...public int checkConsistency()
SBMLDocument
using the
SBML.org online validator (http://sbml.org/validator/).
you can control the consistency checks that are performed when
checkConsistency()
is called with the
#setConsistencyChecks(CHECK_CATEGORY, boolean)
method.
It will fill this SBMLDocument
's listOfErrors
with SBMLError
s for each problem within this whole data
structure. You will then be able to obtain this list by calling
getError(int)
or getListOfErrors()
.
If this method returns a nonzero value (meaning, one or more
consistency checks have failed for SBML document), the failures may be
due to warnings @em or errors. Callers should inspect the severity
flag in the individual SBMLError objects returned by
getError(int)
to determine the nature of the failures.
#setConsistencyChecks(CHECK_CATEGORY, boolean)
private void checkMetaId(java.lang.String metaId)
SBMLDocument
's mappingFromMetaId2SBase
.metaId
- the identifier whose value is to be checked.java.lang.IllegalArgumentException
- if a metaid to add is already present in the list of
registered metaids.public SBMLDocument clone()
SBase
SBase
with the same properties
like this one.clone
in interface SBase
clone
in class AbstractSBase
private void collectMetaIds(java.util.Map<java.lang.String,SBase> metaIds, SBase sbase, boolean recursively, boolean delete)
AbstractSBase
and all of
its sub-elements if recursively is true
.metaIds
- the Map
that gathers the result.sbase
- The SBase
whose meta identifier is to be collected
and from which we maybe have to recursively go through all
of its children.recursively
- if true
, this method will also consider all
sub-elements of this AbstractSBase
.delete
- if true
this method will not check if
the meta identifier can be added to the SBMLDocument
.java.lang.IllegalArgumentException
- However, duplications are not legal and an
IllegalArgumentException
will be thrown in such
cases.public boolean containsMetaId(java.lang.String metaId)
SBMLDocument
with the given meta identifier.metaId
- public Model createModel()
SBMLDocument
, and returns a
pointer to it.
In SBML Level 2, the use of an identifier on a Model
object is
optional. This method takes an optional argument, sid, for setting the
identifier. If not supplied, the identifier attribute on the Model
instance is not set.Model
instance.public Model createModel(java.lang.String id)
id
- Model
instance.public void disablePackage(java.lang.String packageURIOrName)
SBMLDocument
.disablePackage
in interface SBase
disablePackage
in class AbstractSBase
packageURIOrName
- a package namespace URI or package namepublic void enablePackage(java.lang.String packageURIOrName)
SBMLDocument
.enablePackage
in interface SBase
enablePackage
in class AbstractSBase
packageURIOrName
- a package namespace URI or package namepublic void enablePackage(java.lang.String packageURIOrName, boolean enabled)
SBMLDocument
.enablePackage
in interface SBase
enablePackage
in class AbstractSBase
packageURIOrName
- a package namespace URI or package nameenabled
- a boolean to tell if the package need to be enabled or disabled. It true
the package will be enabled, otherwise it will be disabled.public boolean equals(java.lang.Object o)
SBase
public SBase findSBase(java.lang.String metaId)
SBase
registered in this SBMLDocument
for the
given metaId.metaId
- public boolean getAllowsChildren()
getAllowsChildren
in interface javax.swing.tree.TreeNode
getAllowsChildren
in class AbstractSBase
public javax.swing.tree.TreeNode getChildAt(int index)
getChildAt
in interface javax.swing.tree.TreeNode
getChildAt
in class AbstractSBase
public int getChildCount()
getChildCount
in interface javax.swing.tree.TreeNode
getChildCount
in class AbstractSBase
public int getDefaultLevel()
public int getDefaultVersion()
public java.lang.String getElementName()
SBase
getElementName
in interface SBase
getElementName
in class AbstractSBase
public SBase getElementByMetaId(java.lang.String metaid)
metaid
- - the metaid of SBase
to findSBase
with the given metaid or nullfindSBase(String)
public SBMLError getError(int i)
i
- - the index of the SBMLError
to getjava.lang.IndexOutOfBoundsException
- if the index is wronggetNumErrors()
public int getErrorCount()
public SBMLErrorLog getErrorLog()
SBMLError
s reflecting
problems in the overall data structure of this SBMLDocument
.SBMLError
s encountered during consistency checking.public SBMLErrorLog getListOfErrors()
SBMLError
s reflecting
problems in the overall data structure of this SBMLDocument
.SBMLError
s encountered during consistency checking.public Model getModel()
SBMLDocument
.getModel
in interface SBase
getModel
in class AbstractSBase
SBMLDocument
. Can be null if it is not set.public int getNumErrors()
getErrorCount()
public boolean getPackageRequired(java.lang.String nameOrUri)
nameOrUri
- the name or URI of the package extension.@Deprecated public boolean getPkgRequired(java.lang.String pckage)
getPackageRequired(String)
pckage
- the name or URI of the package extension.SBMLDocument
.public java.util.Map<java.lang.String,java.lang.String> getSBMLDocumentAttributes()
@Deprecated public java.util.Map<java.lang.String,java.lang.String> getSBMLDocumentNamespaces()
SBase.getDeclaredNamespaces()
public int hashCode()
SBase
SBase
instance.hashCode
in interface SBase
hashCode
in class AbstractSBase
SBase
instance.Object.hashCode()
private void initDefaults()
public boolean isIgnoredPackage(java.lang.String nameOrURI)
true
if the given package extension is one of an ignored
packages, otherwise returns false
.
An ignored package is one that is defined to be used in this
SBMLDocument
, but the package is not supported in this copy of JSBML.
nameOrURI
- the name or URI of the package extension.true
if the package is being ignored and
false
otherwise.@Deprecated public boolean isIgnoredPkg(java.lang.String pkgURI)
isIgnoredPackage(String)
An ignored package is one that is defined to be used in this SBMLDocument, but the package is not supported in this copy of JSBML.
pkgURI
- the URI of the package extension.public boolean isPackageEnabled(java.lang.String packageURIOrName)
true
if the given SBML Level 3 package is enabled within the SBMLDocument
.isPackageEnabled
in interface SBase
isPackageEnabled
in class AbstractSBase
packageURIOrName
- the name or URI of the package extension.true
if the given SBML Level 3 package is enabled within the SBMLDocument
, false
otherwise.public java.lang.Boolean isPackageEnabledOrDisabled(java.lang.String packageURIOrName)
true
if the given SBML Level 3 package is enabled within the SBMLDocument
, false
if the package was disabled using the method disablePackage(String)
or null
if this package
was neither enabled or disabled on this SBMLDocument
.
This method can be used, for example, by the SBMLWriter
to know if a package was really disabled
or if the user forgot to enable it.
packageURIOrName
- the name or URI of the package extension.true
if the given SBML Level 3 package is enabled within the SBMLDocument
, false
if the package was disabled using the method disablePackage(String)
or null
if this package
was neither enabled or disabled on this SBMLDocument
.private boolean isSetListOfErrors()
true
if the list of errors is defined and contain at least one error.true
if the list of errors is defined and contain at least one error.public boolean isSetModel()
true
if the Model
of this SBMLDocument
is not null
.public boolean isSetPackageRequired(java.lang.String nameOrURI)
true
.nameOrURI
- the name or URI of the package extension.true
@Deprecated public boolean isSetPkgRequired(java.lang.String pckage)
isSetPackageRequired(String)
true
pckage
- the name or URI of the package extension.public java.lang.String nextMetaId()
String
that can be used as a metaid, i.e., a
String that is a valid metaid and that is not yet used by any other element
within this SBMLDocument
.SBMLDocument
.public void printErrors(java.io.PrintStream stream)
stream
- the stream where to print the SBMLDocument
errors.public boolean readAttribute(java.lang.String attributeName, java.lang.String prefix, java.lang.String value)
SBase
SBase
.
If the given attribute name is not recognized, nothing is done and
false
is returned.
readAttribute
in interface SBase
readAttribute
in class AbstractSBase
attributeName
- localName of the XML attributeprefix
- prefix of the XML attributevalue
- value of the XML attributetrue
if the attribute has been successfully read.boolean registerMetaId(SBase sbase, boolean add)
SBMLDocument
's
mappingFromMetaId2SBase
.sbase
- the element whose meta identifier is to be registered (if it is set).add
- if true
this will add the given meta identifier
to this SBMLDocument
's mappingFromMetaId2SBase
.
Otherwise, the given identifier will be removed from this set.true
, then this method returns
true
if this set did not already contain the specified
element, false
otherwise.true
, this method returns
true
if this set contained the specified element,
false
otherwise.false
if the given
SBase
does not have a defined metaIdvoid registerMetaIds(SBase sbase, boolean recursively, boolean delete)
AbstractSBase
and all of
its sub-elements if recursively is true
. It can also be used
to delete meta identifiers from the given Set
.sbase
- The SBase
whose meta identifier is to be registered
and from which we maybe have to recursively go through all
of its children.recursively
- if true
, this method will also consider all
sub-elements of this AbstractSBase
.delete
- if true
the purpose of this method will be to
delete the meta identifier from the given Set
.
Otherwise, it will try to add it to the set.java.lang.IllegalArgumentException
- However, duplications are not legal and an
IllegalArgumentException
will be thrown in such
cases.public java.util.Collection<java.lang.String> metaIds()
SBMLDocument
. The
given collection is unmodifiable. Modifications made to the values has
hence no effect. This method is helpful to iterate through all metaIds in
the document and to query elements based on the metaId.String
s as a view of the
actual metaIds within this SBMLDocument
. Hence, modifying
any of the values returned by this method does not have any effect
for the content of this document.public void setConsistencyChecks(SBMLValidator.CHECK_CATEGORY category, boolean apply)
checkConsistency()
is called.
This method works by adding or subtracting consistency checks from the
set of all possible checks that checkConsistency()
knows
how to perform. This method may need to be called multiple times in
order to achieve the desired combination of checks. The first
argument (category
) in a call to this method indicates the category
of consistency/error checks that are to be turned on or off, and the
second argument (apply
, a boolean) indicates whether to turn it on
(value of true
) or off (value of false
).
The possible categories (values to the argument category
) are the
set of values from the SBMLValidator.CHECK_CATEGORY
enumeration.
The following are the possible choices:
SBMLValidator.CHECK_CATEGORY#GENERAL_CONSISTENCY
:
Correctness and consistency of specific SBML language constructs.
Performing this set of checks is highly recommended. With respect to
the SBML specification, these concern failures in applying the
validation rules numbered 2xxxx in the Level 2 Versions 2, 3
and 4 specifications.
SBMLValidator.CHECK_CATEGORY#IDENTIFIER_CONSISTENCY
:
Correctness and consistency of identifiers used for model entities.
An example of inconsistency would be using a species identifier in a
reaction rate formula without first having declared the species. With
respect to the SBML specification, these concern failures in applying
the validation rules numbered 103xx in the Level 2
Versions 2, 3 and 4 specifications.
SBMLValidator.CHECK_CATEGORY#UNITS_CONSISTENCY
:
Consistency of measurement units associated with quantities in a
model. With respect to the SBML specification, these concern failures
in applying the validation rules numbered 105xx in the Level 2
Versions 2, 3 and 4 specifications.
SBMLValidator.CHECK_CATEGORY#MATHML_CONSISTENCY
:
Syntax of MathML constructs. With respect to the SBML specification,
these concern failures in applying the validation rules numbered 102xx
in the Level 2 Versions 2, 3 and 4 specifications.
SBMLValidator.CHECK_CATEGORY#SBO_CONSISTENCY
:
Consistency and validity of SBO identifiers (if any) used in the
model. With respect to the SBML specification, these concern failures
in applying the validation rules numbered 107xx in the Level 2
Versions 2, 3 and 4 specifications.
SBMLValidator.CHECK_CATEGORY#OVERDETERMINED_MODEL
:
Static analysis of whether the system of equations implied by a model
is mathematically overdetermined. With respect to the SBML
specification, this is validation rule #10601 in the SBML Level 2
Versions 2, 3 and 4 specifications.
SBMLValidator.CHECK_CATEGORY#MODELING_PRACTICE
:
Additional checks for recommended good modeling practice. (These are
tests performed by libSBML and do not have equivalent SBML validation
rules.)
By default, all validation checks are applied to the model in
an SBMLDocument
object unless SBMLDocument#setConsistencyChecks(CHECK_CATEGORY, boolean)
is called to
indicate that only a subset should be applied. Further, this default
(i.e., performing all checks) applies separately to each new
SBMLDocument
object created. In other words, each time a model
is read using SBMLReader.readSBML(String)
, SBMLReader.readSBMLFromString(String)
, a new
SBMLDocument
is created and for that document, a call to
checkConsistency()
will default to applying all possible checks.
Calling programs must invoke SBMLDocument#setConsistencyChecks(CHECK_CATEGORY, boolean)
for each such new
model if they wish to change the consistency checks applied.
category
- a value drawn from JSBML#JSBML.SBML_VALIDATOR_* indicating the
consistency checking/validation to be turned on or off
apply
- a boolean indicating whether the checks indicated by
category
should be applied or not.
checkConsistency()
public boolean setLevelAndVersion(int level, int version)
Sets the SBML Level and Version of this SBMLDocument
instance,
without attempting to convert the model.
level
- the desired SBML Levelversion
- the desired Version within the SBML Leveltrue
if 'level' and 'version' are valid.setLevelAndVersion(int, int, boolean)
public boolean setLevelAndVersion(int level, int version, boolean strict)
Sets the SBML Level and Version of this SBMLDocument
instance,
attempting to convert the model as needed.
This method is the principal way in JSBML to convert models between Levels and Versions of SBML. Generally, models can be converted upward without difficulty (e.g., from SBML Level 1 to Level 2, or from an earlier Version of Level 2 to the latest Version of Level 2). Sometimes models can be translated downward as well, if they do not use constructs specific to more advanced Levels of SBML.
Calling this method will not necessarily lead to a successful conversion.
If the conversion fails, it will be logged in the error list associated
with this SBMLDocument
. Callers should consult
getErrorCount()
to find out if the conversion succeeded
without problems. For conversions from Level 2 to Level 1, callers can
also check the Level of the model after calling this method to find out
whether it is Level 1. (If the conversion to Level 1 failed, the Level of
this model will be left unchanged.)
setLevelAndVersion
in class AbstractSBase
level
- the desired SBML Levelversion
- the desired Version within the SBML Levelstrict
- boolean indicating whether to check consistency of both the
source and target model when performing conversion (defaults
to true
)true
if 'level' and 'version' are valid.public void setModel(Model model)
model
- public boolean setPackageRequired(java.lang.String nameOrUri, boolean flag)
nameOrUri
- the name or URI of the package extension.flag
- boolean value indicating whether the package is required.true
@Deprecated public boolean setPkgRequired(java.lang.String pckage, boolean flag)
setPackageRequired(String, boolean)
pckage
- the name or URI of the package extension.flag
- a Boolean value indicating whether the package is required.true
public void setSBMLDocumentAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
SBMLDocumentAttributes
.attributes
- public java.lang.String toString()
toString
in class AbstractSBase
public boolean unsetModel()
true
if calling this method changed the properties
of this element.public java.util.Map<java.lang.String,java.lang.String> writeXMLAttributes()
SBase
SBase
that
need to be written out in XML.
The attribute name is used as a key and the attribute value as value. If a prefix is needed for the attribute name, it need to be set directly in this map.
writeXMLAttributes
in interface SBase
writeXMLAttributes
in class AbstractSBase
Map
containing the XML attributes of this object.