libNuML 1.1.1
Library for reading / writing NuML documents
|
This represents the numl document that contains all information. More...
#include <NUMLDocument.h>
Public Member Functions | |
NUMLDocument (unsigned int level=0, unsigned int version=0) | |
Creates a new NUMLDocument, optionally with given values for the NUML Level and Version. | |
virtual | ~NUMLDocument () |
Destroys this NUMLDocument. | |
NUMLDocument (const NUMLDocument &rhs) | |
Copy constructor; creates a copy of this NUMLDocument. | |
virtual bool | accept (NUMLVisitor &v) const |
Accepts the given NUMLVisitor for this instance of NUMLDocument. | |
virtual NUMLDocument * | clone () const |
Creates and returns a deep copy of this NUMLDocument. | |
unsigned int | getNumOntologyTerms () const |
Get a the number of ontologyTerm objects in this NUMLDocument. | |
OntologyTerms * | getOntologyTerms () |
Returns the OntologyTerms object stored in this NUMLDocument. | |
const OntologyTerms * | getOntologyTerms () const |
Returns the OntologyTerms object stored in this NUMLDocument. | |
ResultComponents * | getResultComponents () |
Returns the ResultComponents object stored in this NUMLDocument. | |
const ResultComponents * | getResultComponents () const |
Returns the ResultComponents object stored in this NUMLDocument. | |
unsigned int | getNumResultComponents () const |
Get a the number of resultComponent objects in this NUMLDocument. | |
ResultComponent * | getResultComponent (unsigned int index) |
bool | setLevelAndVersion (unsigned int level, unsigned int version, bool strict=true) |
Sets the NUML Level and Version of this NUMLDocument instance, attempting to convert the model as needed. | |
OntologyTerm * | createOntologyTerm () |
ResultComponent * | createResultComponent () |
const NUMLError * | getError (unsigned int n) const |
Returns the nth error or warning encountered during parsing, consistency checking, or attempted translation of this model. | |
unsigned int | getNumErrors () const |
Returns the number of errors or warnings mencountered during parsing, consistency checking, or attempted translation of this model. | |
void | printErrors (std::ostream &stream=std::cerr) const |
virtual void | setParentNUMLObject (NMBase *sb) |
Sets the parent NUML object of this NUML object. | |
virtual void | setNUMLDocument (NUMLDocument *d) |
No-op; it is provided for consistency with the method available on other libNUML object classes but has no effect on NUMLDocument. | |
virtual NUMLTypeCode_t | getTypeCode () const |
Returns the libNUML type code for this NUML object. | |
virtual const std::string & | getElementName () const |
Returns the XML element name of this object, which for NUMLDocument, is always "numl" . | |
NUMLErrorLog * | getErrorLog () |
Returns the list of errors or warnings logged during parsing, consistency checking, or attempted translation of this model. | |
virtual LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * | getNamespaces () const |
Returns a list of XML Namespaces associated with the XML content of this NUML document. | |
int | getElementPosition () const |
virtual void | writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Subclasses should override this method to write out their contained NUML objects as XML elements. | |
![]() | |
virtual | ~NMBase () |
Destroy this object. | |
NMBase & | operator= (const NMBase &orig) |
Assignment operator for NMBase. | |
const std::string & | getMetaId () const |
Returns the value of the "metaid" attribute of this object. | |
std::string & | getMetaId () |
Returns the value of the "metaid" attribute of this object. | |
virtual const std::string & | getId () const |
virtual const std::string & | getName () const |
const NUMLDocument * | getNUMLDocument () const |
Returns the parent NUMLDocument object. | |
NUMLDocument * | getNUMLDocument () |
Returns the parent NUMLDocument object. | |
NMBase * | getParentNUMLObject () |
Returns the parent NUML object. | |
NMBase * | getAncestorOfType (NUMLTypeCode_t type) |
Returns the ancestor NUML object that corresponds to the given NUMLTypeCode_t. | |
unsigned int | getLine () const |
Returns the line number on which this object first appears in the XML representation of the NUML document. | |
unsigned int | getColumn () const |
Returns the column number on which this object first appears in the XML representation of the NUML document. | |
bool | isSetMetaId () const |
Predicate returning true or false depending on whether this object's "metaid" attribute has been set. | |
bool | isSetName () const |
int | setMetaId (const std::string &metaid) |
Sets the value of the "metaid" attribute of this object. | |
virtual int | setId (const std::string &sid) |
int | setNamespaces (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns) |
Sets the namespaces relevant of this NUML object. | |
int | unsetMetaId () |
Unsets the value of the "metaid" attribute of this NUML object. | |
unsigned int | getLevel () const |
Returns the NUML Level of the overall NUML document. | |
unsigned int | getVersion () const |
Returns the Version within the NUML Level of the overall NUML document. | |
bool | hasValidLevelVersionNamespaceCombination () |
Predicate returning true or false depending on whether this object's level/version and namespace values correspond to a valid NUML specification. | |
char * | toNUML () |
Returns a string that consists of the partial NUML describing this object. | |
void | read (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream) |
Reads (initializes) this NUML object by reading from XMLInputStream. | |
void | write (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Writes (serializes) this NUML object by writing it to XMLOutputStream. | |
virtual bool | hasRequiredAttributes () const |
virtual bool | hasRequiredElements () const |
void | setNUMLNamespaces (NUMLNamespaces *numlns) |
NUMLNamespaces * | getNUMLNamespaces () const |
void | syncAnnotation () |
bool | isSetNotes () const |
bool | isSetAnnotation () const |
virtual int | setAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *annotation) |
virtual int | setAnnotation (const std::string &annotation) |
virtual int | appendAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *annotation) |
virtual int | appendAnnotation (const std::string &annotation) |
int | removeTopLevelAnnotationElement (const std::string elementName, const std::string elementURI="") |
int | replaceTopLevelAnnotationElement (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *annotation) |
int | replaceTopLevelAnnotationElement (const std::string &annotation) |
int | setNotes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *notes) |
int | setNotes (const std::string ¬es, bool addXHTMLMarkup=false) |
int | appendNotes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *notes) |
int | appendNotes (const std::string ¬es) |
int | unsetNotes () |
int | unsetAnnotation () |
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * | getNotes () const |
std::string | getNotesString () const |
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * | getAnnotation () const |
std::string | getAnnotationString () const |
Static Public Member Functions | |
static unsigned int | getDefaultLevel () |
The default NUML Level of new NUMLDocument objects. | |
static unsigned int | getDefaultVersion () |
The default Version of new NUMLDocument objects. | |
Protected Member Functions | |
virtual NMBase * | createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream) |
virtual void | readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes &attributes) |
Subclasses should override this method to read values from the given XMLAttributes set into their specific fields. | |
virtual void | writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Subclasses should override this method to write their XML attributes to the XMLOutputStream. | |
bool | conversion_errors (unsigned int errors) |
bool | hasStrictUnits () |
bool | hasStrictSBO () |
![]() | |
virtual void | writeXMLNS (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Subclasses should override this method to write their xmlns attriubutes (if any) to the XMLOutputStream. | |
NMBase (const std::string &id="", const std::string &name="") | |
Only subclasses may create NMBase objects. | |
NMBase (unsigned int level, unsigned int version) | |
Creates a new NMBase object with the given sboTerm. | |
NMBase (NUMLNamespaces *numlns) | |
Creates a new NMBase object with the given NUMLNamespaces. | |
NMBase (const NMBase &orig) | |
Copy constructor. | |
virtual bool | readOtherXML (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream) |
Subclasses should override this method to read (and store) XHTML, MathML, etc. | |
NUMLErrorLog * | getErrorLog () |
void | logError (unsigned int id, const unsigned int level=2, const unsigned int version=3, const std::string &details="") |
Convenience method for easily logging problems from within method implementations. | |
void | logUnknownAttribute (std::string attribute, const unsigned int level, const unsigned int version, const std::string element) |
Helper to log a common type of error. | |
void | logUnknownElement (const std::string element, const unsigned int level, const unsigned int version) |
Helper to log a common type of error. | |
void | logEmptyString (std::string attribute, const unsigned int level, const unsigned int version, std::string element) |
Helper to log a common type of error. | |
void | checkOrderAndLogError (NMBase *object, int expected) |
Checks that NUML element has been read in the proper order. | |
void | checkNUMLListPopulated (NMBase *object) |
Checks that an NUML NUMLList element has been populated. | |
void | checkDefaultNamespace (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns, const std::string &elementName) |
Checks that the given default namespace in the given element is valid. | |
void | checkXHTML (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *) |
Checks that the XHTML is valid. | |
void | checkAnnotation () |
Checks the annotation does not declare an numl namespace. | |
Protected Attributes | |
int | mLevel |
int | mVersion |
OntologyTerms | mOntologyTerms |
ResultComponents | mResultComponents |
NUMLErrorLog | mErrorLog |
unsigned char | mApplicableValidators |
unsigned char | mApplicableValidatorsForConversion |
![]() | |
std::string | mMetaId |
std::string | mId |
std::string | mName |
NUMLDocument * | mNUML |
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * | mNotes |
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * | mAnnotation |
NUMLNamespaces * | mNUMLNamespaces |
unsigned int | mLine |
unsigned int | mColumn |
int | mDept |
NMBase * | mParentNUMLObject |
bool | mHasBeenDeleted |
std::string | mEmptyString |
Friends | |
class | NMBase |
class | NUMLReader |
This represents the numl document that contains all information.
NUMLDocument::NUMLDocument | ( | unsigned int | level = 0 , |
unsigned int | version = 0 |
||
) |
Creates a new NUMLDocument, optionally with given values for the NUML Level and Version.
If both the NUML Level and Version attributes are not specified, the NUML document is treated as having the latest Level and Version of NUML as determined by NUMLDocument::getDefaultLevel() and NUMLDocument::getDefaultVersion(); however, the NUMLDocument object is otherwise left blank. In particular, the blank NUMLDocument object has no associated XML attributes, including (but not limited to) an XML namespace declaration. The XML namespace declaration is not added until the model is written out, or the method is called. This may be important to keep in mind if an application needs to add additional XML namespace declarations on the <numl>
element. Application writers should either provide values for level
and version
on the call to this constructor, or else call shortly after creating the NUMLDocument object.
level | an integer for the NUML Level |
version | an integer for the Version within the NUML Level |
@docnote The native C++ implementation of this method defines a default argument value. In the documentation generated for different libNUML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java, a default argument is handled by declaring two separate methods, with one of them having the argument and the other one lacking the argument. However, the libNUML documentation will be identical for both methods. Consequently, if you are reading this and do not see an argument even though one is described, please look for descriptions of other variants of this method near where this one appears in the documentation.
|
virtual |
Destroys this NUMLDocument.
NUMLDocument::NUMLDocument | ( | const NUMLDocument & | rhs | ) |
Copy constructor; creates a copy of this NUMLDocument.
|
virtual |
Accepts the given NUMLVisitor for this instance of NUMLDocument.
v | the NUMLVisitor instance to be used. |
v.visit()
. Implements NMBase.
|
virtual |
Creates and returns a deep copy of this NUMLDocument.
Implements NMBase.
|
protected |
changed this code in line with the rest of the validation errors: ie each now assigns a severity Error would imply conversion not possible Warning implies lose of data but conversion still possible
|
protectedvirtual |
Reimplemented from NMBase.
OntologyTerm * NUMLDocument::createOntologyTerm | ( | ) |
ResultComponent * NUMLDocument::createResultComponent | ( | ) |
|
static |
The default NUML Level of new NUMLDocument objects.
This "default level" corresponds to the most recent NUML specification Level available at the time this version of libNUML was released. For this copy of libNUML, the value is 2
. The default Level is used by NUMLDocument if no Level is explicitly specified at the time of the construction of an NUMLDocument instance.
|
static |
The default Version of new NUMLDocument objects.
This "default version" corresponds to the most recent NUML Version within the most recent Level of NUML available at the time this version of libNUML was released. For this copy of libNUML, the value is 4
. The default Version is used by NUMLDocument if no Version is explicitly specified at the time of the construction of an NUMLDocument instance.
|
virtual |
Returns the XML element name of this object, which for NUMLDocument, is always "numl"
.
"numl"
. Implements NMBase.
|
virtual |
Reimplemented from NMBase.
const NUMLError * NUMLDocument::getError | ( | unsigned int | n | ) | const |
Returns the nth error or warning encountered during parsing, consistency checking, or attempted translation of this model.
Callers can use method XMLError::getSeverity() on the result to assess the severity of the problem. The possible severity levels range from informational messages to fatal errors.
n
, or return NULL
if n > (getNumErrors() - 1)
.n | the integer index of the error sought. |
NUMLErrorLog * NUMLDocument::getErrorLog | ( | ) |
Returns the list of errors or warnings logged during parsing, consistency checking, or attempted translation of this model.
|
virtual |
Returns a list of XML Namespaces associated with the XML content of this NUML document.
Reimplemented from NMBase.
unsigned int NUMLDocument::getNumErrors | ( | ) | const |
Returns the number of errors or warnings mencountered during parsing, consistency checking, or attempted translation of this model.
unsigned int NUMLDocument::getNumOntologyTerms | ( | ) | const |
Get a the number of ontologyTerm objects in this NUMLDocument.
unsigned int NUMLDocument::getNumResultComponents | ( | ) | const |
Get a the number of resultComponent objects in this NUMLDocument.
OntologyTerms * NUMLDocument::getOntologyTerms | ( | ) |
Returns the OntologyTerms object stored in this NUMLDocument.
It is important to note that this method does not create a OntologyTerm instance. The model in the NUMLDocument must have been created at some prior time, for example using NUMLDocument::createOntologyTerm() or This method returns NULL if a model does not yet exist.
const OntologyTerms * NUMLDocument::getOntologyTerms | ( | ) | const |
Returns the OntologyTerms object stored in this NUMLDocument.
It is important to note that this method does not create a OntologyTerm instance. The model in the NUMLDocument must have been created at some prior time, for example using NUMLDocument::createOntologyTerm() or This method returns NULL if a model does not yet exist.
ResultComponent * NUMLDocument::getResultComponent | ( | unsigned int | index | ) |
ResultComponents * NUMLDocument::getResultComponents | ( | ) |
Returns the ResultComponents object stored in this NUMLDocument.
It is important to note that this method does not create a ResultComponent instance. The model in the NUMLDocument must have been created at some prior time, for example using NUMLDocument::createResultComponent() or This method returns NULL if a model does not yet exist.
const ResultComponents * NUMLDocument::getResultComponents | ( | ) | const |
Returns the ResultComponents object stored in this NUMLDocument.
It is important to note that this method does not create a ResultComponent instance. The model in the NUMLDocument must have been created at some prior time, for example using NUMLDocument::createResultComponent() or This method returns NULL if a model does not yet exist.
|
virtual |
Returns the libNUML type code for this NUML object.
NUML_UNKNOWN
(default).Reimplemented from NMBase.
|
protected |
|
protected |
void NUMLDocument::printErrors | ( | std::ostream & | stream = std::cerr | ) | const |
Prints to the given output stream all the errors or warnings encountered during parsing, consistency checking, or attempted translation of this model. If no errors have occurred, i.e., <code>getNumErrors() == 0</code>, no output will be sent to the stream. The format of the output is: @verbatim
N error(s): line NNN: (id) message
@docnote The native C++ implementation of this method defines a default argument value. In the documentation generated for different libNUML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java, a default argument is handled by declaring two separate methods, with one of them having the argument and the other one lacking the argument. However, the libNUML documentation will be @em identical for both methods. Consequently, if you are reading this and do not see an argument even though one is described, please look for descriptions of other variants of this method near where this one appears in the documentation.
|
protectedvirtual |
Subclasses should override this method to read values from the given XMLAttributes set into their specific fields.
Be sure to call your parents implementation of this method as well.
Reimplemented from NMBase.
bool NUMLDocument::setLevelAndVersion | ( | unsigned int | level, |
unsigned int | version, | ||
bool | strict = true |
||
) |
Sets the NUML Level and Version of this NUMLDocument instance, attempting to convert the model as needed.
check for the case where the numl namespace has been expicitly declared as well as being the default
|
virtual |
No-op; it is provided for consistency with the method available on other libNUML object classes but has no effect on NUMLDocument.
Reimplemented from NMBase.
|
virtual |
Sets the parent NUML object of this NUML object.
sb | the NUML object to use |
Reimplemented from NMBase.
|
protectedvirtual |
Subclasses should override this method to write their XML attributes to the XMLOutputStream.
Be sure to call your parents implementation of this method as well.
Reimplemented from NMBase.
|
virtual |
Subclasses should override this method to write out their contained NUML objects as XML elements.
Be sure to call your parents implementation of this method as well.
Reimplemented from NMBase.
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |