001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.10 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * Overall SBML container object. 013 <p> 014 * LibSBML uses the class {@link SBMLDocument} as a top-level 015 * container for storing SBML content and data associated with it (such as 016 * warnings and error messages). The two primary means of reading an SBML 017 * model, {@link SBMLReader#readSBML(String filename)} and 018 * {@link SBMLReader#readSBMLFromString(String xml)}, both return an {@link SBMLDocument} 019 * object. From there, callers can inquire about any errors encountered 020 * (e.g., using {@link SBMLDocument#getNumErrors()}), access the {@link Model} object, and 021 * perform other actions such as consistency-checking and model 022 * translation. 023 <p> 024 * When creating fresh models programmatically, the starting point is 025 * typically the creation of an {@link SBMLDocument} object instance. The 026 * {@link SBMLDocument} constructor accepts arguments for the SBML Level and 027 * Version of the model to be created. After creating the {@link SBMLDocument} 028 * object, calling programs then typically call {@link SBMLDocument#createModel()} 029 * almost immediately, and then proceed to call the methods on the {@link Model} 030 * object to fill out the model's contents. 031 <p> 032 * {@link SBMLDocument} corresponds roughly to the class <i>Sbml</i> defined in the 033 * SBML Level 2 specification and <i>SBML</i> in the Level 3 034 * specification. It does not have a direct correspondence in SBML 035 * Level 1. (However, to make matters simpler for applications, 036 * libSBML creates an {@link SBMLDocument} no matter whether the model is 037 * Level 1, Level 2 or Level 3.) In its barest form, when written out in 038 * XML format for (e.g.) SBML Level 2 Version 4, the corresponding 039 * structure is the following: 040 * <pre class='fragment'> 041<sbml xmlns='http://www.sbml.org/sbml/level2/version4' level='2' version='4'> 042 ... 043</sbml></pre> 044 <p> 045 * {@link SBMLDocument} is derived from {@link SBase}, and therefore contains the usual {@link SBase} 046 * attributes (in SBML Level 2 and Level 3) of 'metaid' and 'sboTerm', as 047 * well as the subelements 'notes' and 'annotation'. It also contains the 048 * attributes 'level' and 'version' indicating the Level and Version of the 049 * SBML data structure. These can be accessed using the methods defined by 050 * the {@link SBase} class for that purpose. 051 <p> 052 * <h2>Checking consistency and adherence to SBML specifications</h2> 053 <p> 054 * One of the most important features of libSBML is its ability to perform 055 * SBML validation to ensure that a model adheres to the SBML specification 056 * for whatever Level+Version combination the model uses. {@link SBMLDocument} 057 * provides the methods for running consistency-checking and validation 058 * rules on the SBML content. 059 <p> 060 * First, a brief explanation of the rationale is in order. In libSBML 061 * versions up to and including the version 3.3.x series, the 062 * individual methods for creating and setting attributes and other 063 * components were quite lenient, and allowed a caller to compose SBML 064 * entities that might not, in the end, represent valid SBML. This allowed 065 * applications the freedom to do things such as save incomplete models 066 * (which is useful when models are being developed over long periods of 067 * time). In the version 4.x series, libSBML is somewhat stricter, 068 * but still permits structures to be created independently and the results 069 * to be combined in a separate step. In all these cases, it means that a 070 * separate validation step is necessary when a calling program finally 071 * wants to finish a complete SBML document. 072 <p> 073 * The primary interface to this validation facility is {@link SBMLDocument}'s 074 * {@link SBMLDocument#checkInternalConsistency()} and 075 * {@link SBMLDocument#checkConsistency()}. The former verifies the basic 076 * internal consistency and syntax of an SBML document, and the latter 077 * implements more elaborate validation rules (both those defined by the 078 * SBML specifications, as well as additional rules offered by libSBML). 079 <p> 080 * The checks performed by {@link SBMLDocument#checkInternalConsistency()} are 081 * hardwired and cannot be changed by calling programs, but the validation 082 * performed by {@link SBMLDocument#checkConsistency()} is under program control 083 * using the method {@link SBMLDocument#setConsistencyChecks(int categ, boolean 084 * onoff)}. Applications can selectively disable specific kinds of checks 085 * that they may not be interested by calling 086 * {@link SBMLDocument#setConsistencyChecks(int categ, boolean onoff)} with 087 * appropriate parameters. 088 <p> 089 * These methods have slightly different relevance depending on whether a 090 * model is created programmaticaly from scratch, or whether it is read in 091 * from a file or data stream. The following list summarizes the possible 092 * scenarios. 093 <p> 094 * <em>Scenario 1: Creating a model from scratch</em>. Before writing out 095 * the model, 096 <p> 097 * <ul> 098 * <li> Call {@link SBMLDocument#checkInternalConsistency()}, then inquire about 099 * the results by calling {@link SBMLDocument#getNumErrors()} 100 <p> 101 * <li> Call {@link SBMLDocument#setConsistencyChecks(int categ, boolean 102 * onoff)} to configure 103 * which checks will be performed by {@link SBMLDocument#checkConsistency()} 104 <p> 105 * <li> Call {@link SBMLDocument#checkConsistency()}, then inquire about the results by 106 * calling {@link SBMLDocument#getNumErrors()} 107 * 108 * </ul> <p> 109 * <em>Scenario 2: Reading a model from a file or data stream.</em> After 110 * reading the model, 111 <p> 112 * <ul> 113 * <li> Basic consistency checks will have been performed automatically by 114 * libSBML upon reading the content, so you only need to inquire about the 115 * results by using {@link SBMLDocument#getNumErrors()} 116 <p> 117 * <li> Call {@link SBMLDocument#setConsistencyChecks(int categ, boolean 118 * onoff)} to configure 119 * which checks are performed by {@link SBMLDocument#checkConsistency()} 120 <p> 121 * <li> Call {@link SBMLDocument#checkConsistency()}, then inquire about the results 122 * by calling {@link SBMLDocument#getNumErrors()} 123 * 124 * </ul> <p> 125 * <h2>Converting documents between Levels and Versions of SBML</h2> 126 <p> 127 * LibSBML provides facilities for limited translation of SBML between 128 * Levels and Versions of the SBML specifications. The method for doing is 129 * is {@link SBMLDocument#setLevelAndVersion(long lev, long ver, boolean strict)} . In 130 * general, models can be converted upward without difficulty (e.g., from 131 * SBML Level 1 to Level 2, or from an earlier Version of 132 * Level 2 to the latest Version of Level 2). Sometimes models 133 * can be translated downward as well, if they do not use constructs 134 * specific to more advanced Levels of SBML. 135 <p> 136 * Calling {@link SBMLDocument#setLevelAndVersion(long lev, long ver, boolean strict)} will not <em>necessarily</em> lead 137 * to a successful conversion. The method will return a boolean value 138 * to indicate success or failure. Callers must check the error log (see 139 * next section) attached to the {@link SBMLDocument} object after calling 140 * {@link SBMLDocument#setLevelAndVersion(long lev, long ver)} in order to assess whether any 141 * problems arose. 142 <p> 143 * If an application is interested in translating to a lower Level and/or 144 * Version of SBML within a Level, the following methods allow for prior 145 * assessment of whether there is sufficient compatibility to make a 146 * translation possible: 147 <p> 148 * <ul> 149 * <li> {@link SBMLDocument#checkL1Compatibility()}, 150 * <li> {@link SBMLDocument#checkL2v1Compatibility()}, 151 * <li> {@link SBMLDocument#checkL2v2Compatibility()}, 152 * <li> {@link SBMLDocument#checkL2v3Compatibility()}, 153 * <li> {@link SBMLDocument#checkL2v4Compatibility()}, and 154 * <li> {@link SBMLDocument#checkL3v1Compatibility()}. 155 * 156 * </ul> <p> 157 * Some changes between Versions of SBML Level 2 may lead to 158 * unexpected behaviors when attempting conversions in either direction. 159 * For example, SBML Level 2 Version 4 relaxed the requirement 160 * for consistency in units of measurement between expressions annd 161 * quantities in a model. As a result, a model written in Version 4, 162 * if converted to Version 3 with no other changes, may fail 163 * validation as a Version 3 model because Version 3 imposed 164 * stricter requirements on unit consistency. 165 <p> 166 * Other changes between SBML Level 2 and Level 3 make downward conversions 167 * challenging. In some cases, it means that a model converted to 168 * Level 2 from Level 3 will contain attributes that were not 169 * explicitly given in the Level 3 model, because in Level 2 170 * these attributes may have been optional or have default values. 171 <p> 172 * <h2>Error handling</h2> 173 <p> 174 * Upon reading a model, {@link SBMLDocument} logs any problems encountered while 175 * reading the model from the file or data stream. The log contains 176 * objects that record diagnostic information about any notable issues that 177 * arose. Whether the problems are warnings or errors, they are both 178 * reported through a single common interface involving the object class 179 * {@link SBMLError}. 180 <p> 181 * The methods {@link SBMLDocument#getNumErrors()}, {@link SBMLDocument#getError(long n)} and 182 * {@link SBMLDocument#printErrors()} allow callers to interact with the warnings 183 * or errors logged. Alternatively, callers may retrieve the entire log as 184 * an {@link SBMLErrorLog} object using the method {@link SBMLDocument#getErrorLog()}. 185 * The {@link SBMLErrorLog} object provides some alternative methods for 186 * interacting with the set of errors and warnings. In either case, 187 * applications typically should first call {@link SBMLDocument#getNumErrors()} to 188 * find out if any issues have been logged after specific libSBML 189 * operations such as the ones discussed in the sections above. If they 190 * have, then an application will should proceed to inspect the individual 191 * reports using either the direct interfaces on {@link SBMLDocument} or using the 192 * methods on the {@link SBMLErrorLog} object. 193 */ 194 195public class SBMLDocument extends SBase { 196 private long swigCPtr; 197 198 protected SBMLDocument(long cPtr, boolean cMemoryOwn) 199 { 200 super(libsbmlJNI.SBMLDocument_SWIGUpcast(cPtr), cMemoryOwn); 201 swigCPtr = cPtr; 202 } 203 204 protected static long getCPtr(SBMLDocument obj) 205 { 206 return (obj == null) ? 0 : obj.swigCPtr; 207 } 208 209 protected static long getCPtrAndDisown (SBMLDocument obj) 210 { 211 long ptr = 0; 212 213 if (obj != null) 214 { 215 ptr = obj.swigCPtr; 216 obj.swigCMemOwn = false; 217 } 218 219 return ptr; 220 } 221 222 protected void finalize() { 223 delete(); 224 } 225 226 public synchronized void delete() { 227 if (swigCPtr != 0) { 228 if (swigCMemOwn) { 229 swigCMemOwn = false; 230 libsbmlJNI.delete_SBMLDocument(swigCPtr); 231 } 232 swigCPtr = 0; 233 } 234 super.delete(); 235 } 236 237 238/** 239 * The default SBML Level of new {@link SBMLDocument} objects. 240 <p> 241 * <p> 242 * This 'default Level' corresponds to the most recent SBML specification 243 * Level available at the time libSBML version 5.13.0 244 was released. The default Level is used by 245 * {@link SBMLDocument} if no Level is explicitly specified at the time of the 246 * construction of an {@link SBMLDocument} instance. 247 <p> 248 * @return an integer indicating the most recent SBML specification Level 249 <p> 250 * 251 <p> 252 * @see SBMLDocument#getDefaultVersion() 253 */ public 254 static long getDefaultLevel() { 255 return libsbmlJNI.SBMLDocument_getDefaultLevel(); 256 } 257 258 259/** 260 * The default Version of new {@link SBMLDocument} objects. 261 <p> 262 * <p> 263 * This 'default Version' corresponds to the most recent Version within the 264 * most recent Level of SBML available at the time libSBML version 265 * 5.13.0 266 was released. The default Version is 267 * used by {@link SBMLDocument} if no Version is explicitly specified at the time of 268 * the construction of an {@link SBMLDocument} instance. 269 <p> 270 * @return an integer indicating the most recent SBML specification 271 * Version 272 <p> 273 * 274 <p> 275 * @see SBMLDocument#getDefaultLevel() 276 */ public 277 static long getDefaultVersion() { 278 return libsbmlJNI.SBMLDocument_getDefaultVersion(); 279 } 280 281 282/** 283 * Creates a new {@link SBMLDocument}, optionally with given values for the SBML 284 * Level and Version. 285 <p> 286 * If <em>both</em> the SBML Level and Version attributes are not 287 * specified, the SBML document is treated as having the latest Level and 288 * Version of SBML as determined by {@link SBMLDocument#getDefaultLevel()} and 289 * {@link SBMLDocument#getDefaultVersion()}; <em>however</em>, the {@link SBMLDocument} 290 * object is otherwise left blank. In particular, the blank {@link SBMLDocument} 291 * object has no associated XML attributes, including (but not limited 292 * to) an XML namespace declaration. The XML namespace declaration is 293 * not added until the model is written out, <em>or</em> the method 294 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} 295 * is called. This may be important to keep in mind 296 * if an application needs to add additional XML namespace declarations 297 * on the <code><sbml></code> element. Application writers should 298 * either provide values for <code>level</code> and <code>version</code> on the call to this 299 * constructor, or else call 300 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} 301 * shortly after creating the {@link SBMLDocument} object. 302 <p> 303 * @param level an integer for the SBML Level 304 <p> 305 * @param version an integer for the Version within the SBML Level 306 <p> 307 * <p> 308 * @throws SBMLConstructorException 309 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 310 * or if this object is incompatible with the given level and version. 311 <p> 312 * 313</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 314The native C++ implementation of this method defines a default argument 315value. In the documentation generated for different libSBML language 316bindings, you may or may not see corresponding arguments in the method 317declarations. For example, in Java and C#, a default argument is handled by 318declaring two separate methods, with one of them having the argument and 319the other one lacking the argument. However, the libSBML documentation will 320be <em>identical</em> for both methods. Consequently, if you are reading 321this and do not see an argument even though one is described, please look 322for descriptions of other variants of this method near where this one 323appears in the documentation. 324</dd></dl> 325 326 <p> 327 * @see SBMLDocument#setLevelAndVersion(long, long, boolean) 328 * @see #getDefaultLevel() 329 * @see #getDefaultVersion() 330 */ public 331 SBMLDocument(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 332 this(libsbmlJNI.new_SBMLDocument__SWIG_0(level, version), true); 333 } 334 335 336/** 337 * Creates a new {@link SBMLDocument}, optionally with given values for the SBML 338 * Level and Version. 339 <p> 340 * If <em>both</em> the SBML Level and Version attributes are not 341 * specified, the SBML document is treated as having the latest Level and 342 * Version of SBML as determined by {@link SBMLDocument#getDefaultLevel()} and 343 * {@link SBMLDocument#getDefaultVersion()}; <em>however</em>, the {@link SBMLDocument} 344 * object is otherwise left blank. In particular, the blank {@link SBMLDocument} 345 * object has no associated XML attributes, including (but not limited 346 * to) an XML namespace declaration. The XML namespace declaration is 347 * not added until the model is written out, <em>or</em> the method 348 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} 349 * is called. This may be important to keep in mind 350 * if an application needs to add additional XML namespace declarations 351 * on the <code><sbml></code> element. Application writers should 352 * either provide values for <code>level</code> and <code>version</code> on the call to this 353 * constructor, or else call 354 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} 355 * shortly after creating the {@link SBMLDocument} object. 356 <p> 357 * @param level an integer for the SBML Level 358 <p> 359 * @param version an integer for the Version within the SBML Level 360 <p> 361 * <p> 362 * @throws SBMLConstructorException 363 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 364 * or if this object is incompatible with the given level and version. 365 <p> 366 * 367</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 368The native C++ implementation of this method defines a default argument 369value. In the documentation generated for different libSBML language 370bindings, you may or may not see corresponding arguments in the method 371declarations. For example, in Java and C#, a default argument is handled by 372declaring two separate methods, with one of them having the argument and 373the other one lacking the argument. However, the libSBML documentation will 374be <em>identical</em> for both methods. Consequently, if you are reading 375this and do not see an argument even though one is described, please look 376for descriptions of other variants of this method near where this one 377appears in the documentation. 378</dd></dl> 379 380 <p> 381 * @see SBMLDocument#setLevelAndVersion(long, long, boolean) 382 * @see #getDefaultLevel() 383 * @see #getDefaultVersion() 384 */ public 385 SBMLDocument(long level) throws org.sbml.libsbml.SBMLConstructorException { 386 this(libsbmlJNI.new_SBMLDocument__SWIG_1(level), true); 387 } 388 389 390/** 391 * Creates a new {@link SBMLDocument}, optionally with given values for the SBML 392 * Level and Version. 393 <p> 394 * If <em>both</em> the SBML Level and Version attributes are not 395 * specified, the SBML document is treated as having the latest Level and 396 * Version of SBML as determined by {@link SBMLDocument#getDefaultLevel()} and 397 * {@link SBMLDocument#getDefaultVersion()}; <em>however</em>, the {@link SBMLDocument} 398 * object is otherwise left blank. In particular, the blank {@link SBMLDocument} 399 * object has no associated XML attributes, including (but not limited 400 * to) an XML namespace declaration. The XML namespace declaration is 401 * not added until the model is written out, <em>or</em> the method 402 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} 403 * is called. This may be important to keep in mind 404 * if an application needs to add additional XML namespace declarations 405 * on the <code><sbml></code> element. Application writers should 406 * either provide values for <code>level</code> and <code>version</code> on the call to this 407 * constructor, or else call 408 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} 409 * shortly after creating the {@link SBMLDocument} object. 410 <p> 411 * @param level an integer for the SBML Level 412 <p> 413 * @param version an integer for the Version within the SBML Level 414 <p> 415 * <p> 416 * @throws SBMLConstructorException 417 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 418 * or if this object is incompatible with the given level and version. 419 <p> 420 * 421</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 422The native C++ implementation of this method defines a default argument 423value. In the documentation generated for different libSBML language 424bindings, you may or may not see corresponding arguments in the method 425declarations. For example, in Java and C#, a default argument is handled by 426declaring two separate methods, with one of them having the argument and 427the other one lacking the argument. However, the libSBML documentation will 428be <em>identical</em> for both methods. Consequently, if you are reading 429this and do not see an argument even though one is described, please look 430for descriptions of other variants of this method near where this one 431appears in the documentation. 432</dd></dl> 433 434 <p> 435 * @see SBMLDocument#setLevelAndVersion(long, long, boolean) 436 * @see #getDefaultLevel() 437 * @see #getDefaultVersion() 438 */ public 439 SBMLDocument() throws org.sbml.libsbml.SBMLConstructorException { 440 this(libsbmlJNI.new_SBMLDocument__SWIG_2(), true); 441 } 442 443 444/** 445 * Creates a new {@link SBMLDocument} using the given {@link SBMLNamespaces} object 446 * <code>sbmlns</code>. 447 <p> 448 * <p> 449 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 450 * information. It is used to communicate the SBML Level, Version, and (in 451 * Level 3) packages used in addition to SBML Level 3 Core. A 452 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 453 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 454 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 455 <p> 456 * @param sbmlns an {@link SBMLNamespaces} object. 457 <p> 458 * <p> 459 * @throws SBMLConstructorException 460 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible 461 * with this object. 462 */ public 463 SBMLDocument(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 464 this(libsbmlJNI.new_SBMLDocument__SWIG_3(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 465 } 466 467 468/** 469 * Copy constructor; creates a copy of this {@link SBMLDocument}. 470 <p> 471 * @param orig the object to copy. 472 */ public 473 SBMLDocument(SBMLDocument orig) throws org.sbml.libsbml.SBMLConstructorException { 474 this(libsbmlJNI.new_SBMLDocument__SWIG_4(SBMLDocument.getCPtr(orig), orig), true); 475 } 476 477 478/** 479 * Creates and returns a deep copy of this {@link SBMLDocument} object. 480 <p> 481 * @return the (deep) copy of this {@link SBMLDocument} object. 482 */ public 483 SBMLDocument cloneObject() { 484 long cPtr = libsbmlJNI.SBMLDocument_cloneObject(swigCPtr, this); 485 return (cPtr == 0) ? null : new SBMLDocument(cPtr, true); 486 } 487 488 489/** 490 * Returns <code>true</code> if the {@link Model} object has been set, otherwise 491 * returns <code>false.</code> 492 <p> 493 * @return <code>true</code> if the {@link Model} object has been set 494 */ public 495 boolean isSetModel() { 496 return libsbmlJNI.SBMLDocument_isSetModel(swigCPtr, this); 497 } 498 499 500/** 501 * Returns the {@link Model} object stored in this {@link SBMLDocument}. 502 <p> 503 * It is important to note that this method <em>does not create</em> a 504 * {@link Model} instance. The model in the {@link SBMLDocument} must have been created 505 * at some prior time, for example using {@link SBMLDocument#createModel()} 506 * or {@link SBMLDocument#setModel(Model)}. 507 * This method returns <code>null</code> if a model does not yet exist. 508 <p> 509 * @return the {@link Model} contained in this {@link SBMLDocument}. 510 <p> 511 * @see #createModel() 512 */ public 513 Model getModel() { 514 long cPtr = libsbmlJNI.SBMLDocument_getModel__SWIG_0(swigCPtr, this); 515 return (cPtr == 0) ? null : new Model(cPtr, false); 516 } 517 518 519/** 520 * Returns the first child element found that has the given <code>id</code> in the 521 * model-wide SId namespace, or <code>null</code> if no such object is found. 522 <p> 523 * @param id string representing the id of objects to find 524 <p> 525 * @return pointer to the first element found with the given <code>id</code>. 526 */ public 527 SBase getElementBySId(String id) { 528 return libsbml.DowncastSBase(libsbmlJNI.SBMLDocument_getElementBySId(swigCPtr, this, id), false); 529} 530 531 532/** 533 * Returns the first child element it can find with the given <code>metaid</code>, or 534 * itself if it has the given <code>metaid</code>, or <code>null</code> if no such object is 535 * found. 536 <p> 537 * @param metaid string representing the metaid of objects to find 538 <p> 539 * @return pointer to the first element found with the given <code>metaid</code>. 540 */ public 541 SBase getElementByMetaId(String metaid) { 542 return libsbml.DowncastSBase(libsbmlJNI.SBMLDocument_getElementByMetaId(swigCPtr, this, metaid), false); 543} 544 545 546/** 547 * Removes {@link FunctionDefinition} constructs from the document and expands 548 * any instances of their use within <code><math></code> elements. 549 <p> 550 * For example, suppose a {@link Model} contains a {@link FunctionDefinition} with 551 * identifier <code>'f'</code> representing the math expression: <em>f(x, y) = x * 552 * y</em>. Suppose further that there is a reaction in which the 553 * <code><math></code> element of the {@link KineticLaw} object contains 554 * <code>f(s, p)</code>, where <code>s</code> and <code>p</code> are other identifiers 555 * defined in the model. The outcome of invoking this method is that the 556 * <code><math></code> of the {@link KineticLaw} now represents the 557 * expression <em>s * p</em> and the model no longer contains any 558 * {@link FunctionDefinition} objects. 559 <p> 560 * @return boolean <code>true</code> if the transformation was successful, 561 * <code>false</code>, otherwise. 562 <p> 563 * @note This function will check the consistency of a model before 564 * attemptimg the transformation. If the model is not valid SBML, the 565 * transformation will not be performed and the function will return 566 * <code>false.</code> 567 */ public 568 boolean expandFunctionDefinitions() { 569 return libsbmlJNI.SBMLDocument_expandFunctionDefinitions(swigCPtr, this); 570 } 571 572 573/** 574 * Removes {@link InitialAssignment} constructs from the document and 575 * replaces them with appropriate values. 576 <p> 577 * For example, suppose a {@link Model} contains a {@link InitialAssignment} to a symbol 578 * <code>'k'</code> where <code>'k'</code> is the identifier of a {@link Parameter}. The outcome of 579 * invoking this method is that the 'value' attribute of the {@link Parameter} 580 * definition is set to the result calculated using the {@link InitialAssignment} 581 * object's <code><math></code> formula, and the corresponding 582 * {@link InitialAssignment} is then removed from the {@link Model}. 583 <p> 584 * @return boolean <code>true</code> if the transformation was successful, 585 * <code>false</code>, otherwise. 586 <p> 587 * @note This function will check the consistency of a model before 588 * attemptimg the transformation. If the model is not valid SBML, the 589 * transformation will not be performed and the function will return 590 * <code>false.</code> As part of that process, this method will check that it has 591 * values for any components referred to by the <code><math></code> 592 * elements of {@link InitialAssignment} objects. In cases where not all of the 593 * values have been declared (e.g., if the mathematical expression refers 594 * to model entities that have no declared values), the {@link InitialAssignment} 595 * in question will <em>not</em> be removed and this method will return 596 * <code>false.</code> 597 */ public 598 boolean expandInitialAssignments() { 599 return libsbmlJNI.SBMLDocument_expandInitialAssignments(swigCPtr, this); 600 } 601 602 603/** 604 * Sets the SBML Level and Version of this {@link SBMLDocument} instance, 605 * attempting to convert the model as needed. 606 <p> 607 * This method is the principal way in libSBML to convert models between 608 * Levels and Versions of SBML. Generally, models can be converted 609 * upward without difficulty (e.g., from SBML Level 1 to 610 * Level 2, or from an earlier Version of Level 2 to the latest 611 * Version of Level 2). Sometimes models can be translated downward 612 * as well, if they do not use constructs specific to more advanced 613 * Levels of SBML. 614 <p> 615 * Before calling this method, callers may check compatibility directly 616 * using the methods {@link SBMLDocument#checkL1Compatibility()}, 617 * {@link SBMLDocument#checkL2v1Compatibility()}, 618 * {@link SBMLDocument#checkL2v2Compatibility()}, 619 * {@link SBMLDocument#checkL2v3Compatibility()}, 620 * {@link SBMLDocument#checkL2v4Compatibility()}, and 621 * {@link SBMLDocument#checkL3v1Compatibility()}. 622 <p> 623 * The valid combinations of SBML Level and Version as of this release 624 * of libSBML are the following: 625 * <ul> 626 * <li> Level 1 Version 2 627 * <li> Level 2 Version 1 628 * <li> Level 2 Version 2 629 * <li> Level 2 Version 3 630 * <li> Level 2 Version 4 631 * <li> Level 3 Version 1 632 * </ul> 633 <p> 634 * Strict conversion applies the additional criteria that both the 635 * source and the target model must be consistent SBML. Users can 636 * control the consistency checks that are applied using the 637 * {@link SBMLDocument#setConsistencyChecksForConversion(int, boolean)} method. If either 638 * the source or the potential target model have validation errors, the 639 * conversion is not performed. When a strict conversion is successful, 640 * the underlying SBML object model is altered to reflect the new level 641 * and version. Thus, information that cannot be converted 642 * (e.g. sboTerms) will be lost. 643 <p> 644 * @param level the desired SBML Level 645 <p> 646 * @param version the desired Version within the SBML Level 647 <p> 648 * @param strict boolean indicating whether to check consistency 649 * of both the source and target model when performing 650 * conversion (defaults to <code> true </code>) 651 <p> 652 * @param ignorePackages boolean indicating whether the presence of 653 * packages should be ignored by the conversion routine 654 * (defaults to <code> false </code>) 655 <p> 656 * @return <code>true</code> if the level and version of the document were 657 * successfully set to the requested values (which may have required 658 * conversion of the model), <code>false</code> otherwise. 659 <p> 660 * @note Calling this method will not <em>necessarily</em> lead to a successful 661 * conversion. If the conversion fails, it will be logged in the error 662 * list associated with this {@link SBMLDocument}. Callers should consult 663 * getNumErrors() to find out if the conversion succeeded without 664 * problems. For conversions from Level 2 to Level 1, callers 665 * can also check the Level of the model after calling this method to 666 * find out whether it is Level 1. (If the conversion to 667 * Level 1 failed, the Level of this model will be left unchanged.) 668 <p> 669 * 670</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 671The native C++ implementation of this method defines a default argument 672value. In the documentation generated for different libSBML language 673bindings, you may or may not see corresponding arguments in the method 674declarations. For example, in Java and C#, a default argument is handled by 675declaring two separate methods, with one of them having the argument and 676the other one lacking the argument. However, the libSBML documentation will 677be <em>identical</em> for both methods. Consequently, if you are reading 678this and do not see an argument even though one is described, please look 679for descriptions of other variants of this method near where this one 680appears in the documentation. 681</dd></dl> 682 683 <p> 684 * @see #checkL1Compatibility() 685 * @see #checkL2v1Compatibility() 686 * @see #checkL2v2Compatibility() 687 * @see #checkL2v3Compatibility() 688 * @see #checkL2v4Compatibility() 689 * @see #checkL3v1Compatibility() 690 * @see #checkL3v1Compatibility() 691 */ public 692 boolean setLevelAndVersion(long level, long version, boolean strict, boolean ignorePackages) { 693 return libsbmlJNI.SBMLDocument_setLevelAndVersion__SWIG_0(swigCPtr, this, level, version, strict, ignorePackages); 694 } 695 696 697/** 698 * Sets the SBML Level and Version of this {@link SBMLDocument} instance, 699 * attempting to convert the model as needed. 700 <p> 701 * This method is the principal way in libSBML to convert models between 702 * Levels and Versions of SBML. Generally, models can be converted 703 * upward without difficulty (e.g., from SBML Level 1 to 704 * Level 2, or from an earlier Version of Level 2 to the latest 705 * Version of Level 2). Sometimes models can be translated downward 706 * as well, if they do not use constructs specific to more advanced 707 * Levels of SBML. 708 <p> 709 * Before calling this method, callers may check compatibility directly 710 * using the methods {@link SBMLDocument#checkL1Compatibility()}, 711 * {@link SBMLDocument#checkL2v1Compatibility()}, 712 * {@link SBMLDocument#checkL2v2Compatibility()}, 713 * {@link SBMLDocument#checkL2v3Compatibility()}, 714 * {@link SBMLDocument#checkL2v4Compatibility()}, and 715 * {@link SBMLDocument#checkL3v1Compatibility()}. 716 <p> 717 * The valid combinations of SBML Level and Version as of this release 718 * of libSBML are the following: 719 * <ul> 720 * <li> Level 1 Version 2 721 * <li> Level 2 Version 1 722 * <li> Level 2 Version 2 723 * <li> Level 2 Version 3 724 * <li> Level 2 Version 4 725 * <li> Level 3 Version 1 726 * </ul> 727 <p> 728 * Strict conversion applies the additional criteria that both the 729 * source and the target model must be consistent SBML. Users can 730 * control the consistency checks that are applied using the 731 * {@link SBMLDocument#setConsistencyChecksForConversion(int, boolean)} method. If either 732 * the source or the potential target model have validation errors, the 733 * conversion is not performed. When a strict conversion is successful, 734 * the underlying SBML object model is altered to reflect the new level 735 * and version. Thus, information that cannot be converted 736 * (e.g. sboTerms) will be lost. 737 <p> 738 * @param level the desired SBML Level 739 <p> 740 * @param version the desired Version within the SBML Level 741 <p> 742 * @param strict boolean indicating whether to check consistency 743 * of both the source and target model when performing 744 * conversion (defaults to <code> true </code>) 745 <p> 746 * @param ignorePackages boolean indicating whether the presence of 747 * packages should be ignored by the conversion routine 748 * (defaults to <code> false </code>) 749 <p> 750 * @return <code>true</code> if the level and version of the document were 751 * successfully set to the requested values (which may have required 752 * conversion of the model), <code>false</code> otherwise. 753 <p> 754 * @note Calling this method will not <em>necessarily</em> lead to a successful 755 * conversion. If the conversion fails, it will be logged in the error 756 * list associated with this {@link SBMLDocument}. Callers should consult 757 * getNumErrors() to find out if the conversion succeeded without 758 * problems. For conversions from Level 2 to Level 1, callers 759 * can also check the Level of the model after calling this method to 760 * find out whether it is Level 1. (If the conversion to 761 * Level 1 failed, the Level of this model will be left unchanged.) 762 <p> 763 * 764</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 765The native C++ implementation of this method defines a default argument 766value. In the documentation generated for different libSBML language 767bindings, you may or may not see corresponding arguments in the method 768declarations. For example, in Java and C#, a default argument is handled by 769declaring two separate methods, with one of them having the argument and 770the other one lacking the argument. However, the libSBML documentation will 771be <em>identical</em> for both methods. Consequently, if you are reading 772this and do not see an argument even though one is described, please look 773for descriptions of other variants of this method near where this one 774appears in the documentation. 775</dd></dl> 776 777 <p> 778 * @see #checkL1Compatibility() 779 * @see #checkL2v1Compatibility() 780 * @see #checkL2v2Compatibility() 781 * @see #checkL2v3Compatibility() 782 * @see #checkL2v4Compatibility() 783 * @see #checkL3v1Compatibility() 784 * @see #checkL3v1Compatibility() 785 */ public 786 boolean setLevelAndVersion(long level, long version, boolean strict) { 787 return libsbmlJNI.SBMLDocument_setLevelAndVersion__SWIG_1(swigCPtr, this, level, version, strict); 788 } 789 790 791/** 792 * Sets the SBML Level and Version of this {@link SBMLDocument} instance, 793 * attempting to convert the model as needed. 794 <p> 795 * This method is the principal way in libSBML to convert models between 796 * Levels and Versions of SBML. Generally, models can be converted 797 * upward without difficulty (e.g., from SBML Level 1 to 798 * Level 2, or from an earlier Version of Level 2 to the latest 799 * Version of Level 2). Sometimes models can be translated downward 800 * as well, if they do not use constructs specific to more advanced 801 * Levels of SBML. 802 <p> 803 * Before calling this method, callers may check compatibility directly 804 * using the methods {@link SBMLDocument#checkL1Compatibility()}, 805 * {@link SBMLDocument#checkL2v1Compatibility()}, 806 * {@link SBMLDocument#checkL2v2Compatibility()}, 807 * {@link SBMLDocument#checkL2v3Compatibility()}, 808 * {@link SBMLDocument#checkL2v4Compatibility()}, and 809 * {@link SBMLDocument#checkL3v1Compatibility()}. 810 <p> 811 * The valid combinations of SBML Level and Version as of this release 812 * of libSBML are the following: 813 * <ul> 814 * <li> Level 1 Version 2 815 * <li> Level 2 Version 1 816 * <li> Level 2 Version 2 817 * <li> Level 2 Version 3 818 * <li> Level 2 Version 4 819 * <li> Level 3 Version 1 820 * </ul> 821 <p> 822 * Strict conversion applies the additional criteria that both the 823 * source and the target model must be consistent SBML. Users can 824 * control the consistency checks that are applied using the 825 * {@link SBMLDocument#setConsistencyChecksForConversion(int, boolean)} method. If either 826 * the source or the potential target model have validation errors, the 827 * conversion is not performed. When a strict conversion is successful, 828 * the underlying SBML object model is altered to reflect the new level 829 * and version. Thus, information that cannot be converted 830 * (e.g. sboTerms) will be lost. 831 <p> 832 * @param level the desired SBML Level 833 <p> 834 * @param version the desired Version within the SBML Level 835 <p> 836 * @param strict boolean indicating whether to check consistency 837 * of both the source and target model when performing 838 * conversion (defaults to <code> true </code>) 839 <p> 840 * @param ignorePackages boolean indicating whether the presence of 841 * packages should be ignored by the conversion routine 842 * (defaults to <code> false </code>) 843 <p> 844 * @return <code>true</code> if the level and version of the document were 845 * successfully set to the requested values (which may have required 846 * conversion of the model), <code>false</code> otherwise. 847 <p> 848 * @note Calling this method will not <em>necessarily</em> lead to a successful 849 * conversion. If the conversion fails, it will be logged in the error 850 * list associated with this {@link SBMLDocument}. Callers should consult 851 * getNumErrors() to find out if the conversion succeeded without 852 * problems. For conversions from Level 2 to Level 1, callers 853 * can also check the Level of the model after calling this method to 854 * find out whether it is Level 1. (If the conversion to 855 * Level 1 failed, the Level of this model will be left unchanged.) 856 <p> 857 * 858</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 859The native C++ implementation of this method defines a default argument 860value. In the documentation generated for different libSBML language 861bindings, you may or may not see corresponding arguments in the method 862declarations. For example, in Java and C#, a default argument is handled by 863declaring two separate methods, with one of them having the argument and 864the other one lacking the argument. However, the libSBML documentation will 865be <em>identical</em> for both methods. Consequently, if you are reading 866this and do not see an argument even though one is described, please look 867for descriptions of other variants of this method near where this one 868appears in the documentation. 869</dd></dl> 870 871 <p> 872 * @see #checkL1Compatibility() 873 * @see #checkL2v1Compatibility() 874 * @see #checkL2v2Compatibility() 875 * @see #checkL2v3Compatibility() 876 * @see #checkL2v4Compatibility() 877 * @see #checkL3v1Compatibility() 878 * @see #checkL3v1Compatibility() 879 */ public 880 boolean setLevelAndVersion(long level, long version) { 881 return libsbmlJNI.SBMLDocument_setLevelAndVersion__SWIG_2(swigCPtr, this, level, version); 882 } 883 884 885/** * @internal */ public 886 void updateSBMLNamespace(String arg0, long level, long version) { 887 libsbmlJNI.SBMLDocument_updateSBMLNamespace(swigCPtr, this, arg0, level, version); 888 } 889 890 891/** 892 * Sets the {@link Model} for this {@link SBMLDocument} to a copy of the given {@link Model}. 893 <p> 894 * @param m the new {@link Model} to use. 895 <p> 896 * <p> 897 * @return integer value indicating success/failure of the 898 * function. The possible values 899 * returned by this function are: 900 * <ul> 901 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 902 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 903 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 904 * 905 * </ul> <p> 906 * @see #createModel() 907 * @see #getModel() 908 */ public 909 int setModel(Model m) { 910 return libsbmlJNI.SBMLDocument_setModel(swigCPtr, this, Model.getCPtr(m), m); 911 } 912 913 914/** 915 * Creates a new {@link Model} inside this {@link SBMLDocument}, and returns a pointer to 916 * it. 917 <p> 918 * In SBML Level 2, the use of an identifier on a {@link Model} object is 919 * optional. This method takes an optional argument, <code>sid</code>, for setting 920 * the identifier. If not supplied, the identifier attribute on the 921 * {@link Model} instance is not set. 922 <p> 923 * @param sid the identifier of the new {@link Model} to create. 924 <p> 925 * 926</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 927The native C++ implementation of this method defines a default argument 928value. In the documentation generated for different libSBML language 929bindings, you may or may not see corresponding arguments in the method 930declarations. For example, in Java and C#, a default argument is handled by 931declaring two separate methods, with one of them having the argument and 932the other one lacking the argument. However, the libSBML documentation will 933be <em>identical</em> for both methods. Consequently, if you are reading 934this and do not see an argument even though one is described, please look 935for descriptions of other variants of this method near where this one 936appears in the documentation. 937</dd></dl> 938 939 <p> 940 * @see #getModel() 941 * @see SBMLDocument#setModel(Model) 942 */ public 943 Model createModel(String sid) { 944 long cPtr = libsbmlJNI.SBMLDocument_createModel__SWIG_0(swigCPtr, this, sid); 945 return (cPtr == 0) ? null : new Model(cPtr, false); 946 } 947 948 949/** 950 * Creates a new {@link Model} inside this {@link SBMLDocument}, and returns a pointer to 951 * it. 952 <p> 953 * In SBML Level 2, the use of an identifier on a {@link Model} object is 954 * optional. This method takes an optional argument, <code>sid</code>, for setting 955 * the identifier. If not supplied, the identifier attribute on the 956 * {@link Model} instance is not set. 957 <p> 958 * @param sid the identifier of the new {@link Model} to create. 959 <p> 960 * 961</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 962The native C++ implementation of this method defines a default argument 963value. In the documentation generated for different libSBML language 964bindings, you may or may not see corresponding arguments in the method 965declarations. For example, in Java and C#, a default argument is handled by 966declaring two separate methods, with one of them having the argument and 967the other one lacking the argument. However, the libSBML documentation will 968be <em>identical</em> for both methods. Consequently, if you are reading 969this and do not see an argument even though one is described, please look 970for descriptions of other variants of this method near where this one 971appears in the documentation. 972</dd></dl> 973 974 <p> 975 * @see #getModel() 976 * @see SBMLDocument#setModel(Model) 977 */ public 978 Model createModel() { 979 long cPtr = libsbmlJNI.SBMLDocument_createModel__SWIG_1(swigCPtr, this); 980 return (cPtr == 0) ? null : new Model(cPtr, false); 981 } 982 983 984/** 985 * Sets the location of this {@link SBMLDocument}. 986 <p> 987 * Called automatically when readSBMLFromFile is used, but may be set 988 * manually as well. 989 */ public 990 void setLocationURI(String uri) { 991 libsbmlJNI.SBMLDocument_setLocationURI(swigCPtr, this, uri); 992 } 993 994 995/** 996 * Get the location of this {@link SBMLDocument}. 997 <p> 998 * If this document was read from a file or had its location set manually, 999 * that filename or set location will be returned, otherwise, an empty 1000 * string is returned. 1001 */ public 1002 String getLocationURI() { 1003 return libsbmlJNI.SBMLDocument_getLocationURI__SWIG_0(swigCPtr, this); 1004 } 1005 1006 1007/** 1008 * Controls the consistency checks that are performed when 1009 * {@link SBMLDocument#checkConsistency()} is called. 1010 <p> 1011 * This method works by adding or subtracting consistency checks from the 1012 * set of all possible checks that {@link SBMLDocument#checkConsistency()} knows 1013 * how to perform. This method may need to be called multiple times in 1014 * order to achieve the desired combination of checks. The first 1015 * argument (<code>category</code>) in a call to this method indicates the category 1016 * of consistency/error checks that are to be turned on or off, and the 1017 * second argument (<code>apply</code>, a boolean) indicates whether to turn it on 1018 * (value of <code>true</code>) or off (value of <code>false</code>). 1019 <p> 1020 * The possible categories (values to the argument <code>category</code>) are the 1021 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1022 * in the interface class {@link libsbmlConstants}. 1023 * The following are the possible choices: 1024 <p> 1025 * <ul> 1026 * <li> {@link libsbmlConstants#LIBSBML_CAT_GENERAL_CONSISTENCY LIBSBML_CAT_GENERAL_CONSISTENCY}: 1027 * Correctness and consistency of specific SBML language constructs. 1028 * Performing this set of checks is highly recommended. With respect to 1029 * the SBML specification, these concern failures in applying the 1030 * validation rules numbered 2xxxx in the Level 2 1031 * Versions 2–4 and Level 3 Version 1 specifications. 1032 <p> 1033 * <li> {@link libsbmlConstants#LIBSBML_CAT_IDENTIFIER_CONSISTENCY LIBSBML_CAT_IDENTIFIER_CONSISTENCY}: 1034 * Correctness and consistency of identifiers used for model entities. An 1035 * example of inconsistency would be using a species identifier in a 1036 * reaction rate formula without first having declared the species. With 1037 * respect to the SBML specification, these concern failures in applying 1038 * the validation rules numbered 103xx in the Level 2 1039 * Versions 2–4 and Level 3 Version 1 specifications. 1040 <p> 1041 * <li> {@link libsbmlConstants#LIBSBML_CAT_UNITS_CONSISTENCY LIBSBML_CAT_UNITS_CONSISTENCY}: 1042 * Consistency of measurement units associated with quantities in a model. 1043 * With respect to the SBML specification, these concern failures in 1044 * applying the validation rules numbered 105xx in the Level 2 1045 * Versions 2–4 and Level 3 Version 1 specifications. 1046 <p> 1047 * <li> {@link libsbmlConstants#LIBSBML_CAT_MATHML_CONSISTENCY LIBSBML_CAT_MATHML_CONSISTENCY}: 1048 * Syntax of MathML constructs. With respect to the SBML specification, 1049 * these concern failures in applying the validation rules numbered 102xx 1050 * in the Level 2 Versions 2–4 and Level 3 1051 * Version 1 specifications. 1052 <p> 1053 * <li> {@link libsbmlConstants#LIBSBML_CAT_SBO_CONSISTENCY LIBSBML_CAT_SBO_CONSISTENCY}: 1054 * Consistency and validity of SBO identifiers (if any) used in the model. 1055 * With respect to the SBML specification, these concern failures in 1056 * applying the validation rules numbered 107xx in the Level 2 1057 * Versions 2–4 and Level 3 Version 1 specifications. 1058 <p> 1059 * <li> {@link libsbmlConstants#LIBSBML_CAT_OVERDETERMINED_MODEL LIBSBML_CAT_OVERDETERMINED_MODEL}: 1060 * Static analysis of whether the system of equations implied by a model is 1061 * mathematically overdetermined. With respect to the SBML specification, 1062 * this is validation rule #10601 in the Level 2 1063 * Versions 2–4 and Level 3 Version 1 specifications. 1064 <p> 1065 * <li> {@link libsbmlConstants#LIBSBML_CAT_MODELING_PRACTICE LIBSBML_CAT_MODELING_PRACTICE}: 1066 * Additional checks for recommended good modeling practice. (These are 1067 * tests performed by libSBML and do not have equivalent SBML validation 1068 * rules.) </ul> 1069 <p> 1070 * <em>By default, all validation checks are applied</em> to the model in 1071 * an {@link SBMLDocument} object <em>unless</em> 1072 * {@link SBMLDocument#setConsistencyChecks(int categ, boolean onoff)} 1073 * is called to indicate that only a subset should be applied. Further, 1074 * this default (i.e., performing all checks) applies separately to 1075 * <em>each new {@link SBMLDocument} object</em> created. In other words, each 1076 * time a model is read using {@link SBMLReader#readSBML(String filename)}, 1077 * {@link SBMLReader#readSBMLFromString(String xml)}, 1078 * or the global functions readSBML() and readSBMLFromString(), a new 1079 * {@link SBMLDocument} is created and for that document, a call to 1080 * {@link SBMLDocument#checkConsistency()} will default to applying all possible checks. 1081 * Calling programs must invoke 1082 * {@link SBMLDocument#setConsistencyChecks(int categ, boolean onoff)} 1083 * for each such new model if they wish to change the consistency checks 1084 * applied. 1085 <p> 1086 * @param category a value drawn from * the set of SBML error categories indicating the 1087 * consistency checking/validation to be turned on or off. 1088 <p> 1089 * @param apply a boolean indicating whether the checks indicated by 1090 * <code>category</code> should be applied or not. 1091 <p> 1092 * @see SBMLDocument#checkConsistency() 1093 */ public 1094 void setConsistencyChecks(int category, boolean apply) { 1095 libsbmlJNI.SBMLDocument_setConsistencyChecks(swigCPtr, this, category, apply); 1096 } 1097 1098 1099/** 1100 * Controls the consistency checks that are performed when 1101 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} is called. 1102 <p> 1103 * This method works by adding or subtracting consistency checks from the 1104 * set of all possible checks that may be performed to avoid conversion 1105 * to or from an invalid document. This method may need to be called 1106 * multiple times in 1107 * order to achieve the desired combination of checks. The first 1108 * argument (<code>category</code>) in a call to this method indicates the category 1109 * of consistency/error checks that are to be turned on or off, and the 1110 * second argument (<code>apply</code>, a boolean) indicates whether to turn it on 1111 * (value of <code>true</code>) or off (value of <code>false</code>). 1112 <p> 1113 * The possible categories (values to the argument <code>category</code>) are the 1114 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1115 * in the interface class {@link libsbmlConstants}. 1116 * The following are the possible choices: 1117 <p> 1118 * <ul> 1119 * <li> {@link libsbmlConstants#LIBSBML_CAT_GENERAL_CONSISTENCY LIBSBML_CAT_GENERAL_CONSISTENCY}: 1120 * Correctness and consistency of specific SBML language constructs. 1121 * Performing this set of checks is highly recommended. With respect to 1122 * the SBML specification, these concern failures in applying the 1123 * validation rules numbered 2xxxx in the Level 2 1124 * Versions 2–4 and Level 3 Version 1 specifications. 1125 <p> 1126 * <li> {@link libsbmlConstants#LIBSBML_CAT_IDENTIFIER_CONSISTENCY LIBSBML_CAT_IDENTIFIER_CONSISTENCY}: 1127 * Correctness and consistency of identifiers used for model entities. An 1128 * example of inconsistency would be using a species identifier in a 1129 * reaction rate formula without first having declared the species. With 1130 * respect to the SBML specification, these concern failures in applying 1131 * the validation rules numbered 103xx in the Level 2 1132 * Versions 2–4 and Level 3 Version 1 specifications. 1133 <p> 1134 * <li> {@link libsbmlConstants#LIBSBML_CAT_UNITS_CONSISTENCY LIBSBML_CAT_UNITS_CONSISTENCY}: 1135<p> 1136 * Consistency of measurement units associated with quantities in a model. 1137 * With respect to the SBML specification, these concern failures in 1138 * applying the validation rules numbered 105xx in the Level 2 1139 * Versions 2–4 and Level 3 Version 1 specifications. 1140 <p> 1141 * <li> {@link libsbmlConstants#LIBSBML_CAT_MATHML_CONSISTENCY LIBSBML_CAT_MATHML_CONSISTENCY}: 1142 * Syntax of MathML constructs. With respect to the SBML specification, 1143 * these concern failures in applying the validation rules numbered 102xx 1144 * in the Level 2 Versions 2–4 and Level 3 1145 * Version 1 specifications. 1146 <p> 1147 * <li> {@link libsbmlConstants#LIBSBML_CAT_SBO_CONSISTENCY LIBSBML_CAT_SBO_CONSISTENCY}: 1148 * Consistency and validity of SBO identifiers (if any) used in the model. 1149 * With respect to the SBML specification, these concern failures in 1150 * applying the validation rules numbered 107xx in the Level 2 1151 * Versions 2–4 and Level 3 Version 1 specifications. 1152 <p> 1153 * <li> {@link libsbmlConstants#LIBSBML_CAT_OVERDETERMINED_MODEL LIBSBML_CAT_OVERDETERMINED_MODEL}: 1154 * Static analysis of whether the system of equations implied by a model is 1155 * mathematically overdetermined. With respect to the SBML specification, 1156 * this is validation rule #10601 in the Level 2 1157 * Versions 2–4 and Level 3 Version 1 specifications. 1158 <p> 1159 * <li> {@link libsbmlConstants#LIBSBML_CAT_MODELING_PRACTICE LIBSBML_CAT_MODELING_PRACTICE}: 1160 * Additional checks for recommended good modeling practice. (These are 1161 * tests performed by libSBML and do not have equivalent SBML validation 1162 * rules.) 1163 * </ul> 1164 <p> 1165 * <em>By default, all validation checks are applied</em> to the model in 1166 * an {@link SBMLDocument} object <em>unless</em> 1167 * {@link SBMLDocument#setConsistencyChecks(int, boolean)} 1168 * is called to indicate that only a subset should be applied. Further, 1169 * this default (i.e., performing all checks) applies separately to 1170 * <em>each new {@link SBMLDocument} object</em> created. In other words, each 1171 * time a model is read using {@link SBMLReader#readSBML(String)}, 1172 * {@link SBMLReader#readSBMLFromString(String)}, 1173 * or the global functions readSBML() and readSBMLFromString(), a new 1174 * {@link SBMLDocument} is created and for that document, a call to 1175 * {@link SBMLDocument#checkConsistency()} will default to applying all possible checks. 1176 * Calling programs must invoke 1177 * {@link SBMLDocument#setConsistencyChecks(int, boolean)} 1178 * for each such new model if they wish to change the consistency checks 1179 * applied. 1180 <p> 1181 * @param category a value drawn from * the set of SBML error categories indicating the consistency 1182 * checking/validation to be turned on or off. 1183 <p> 1184 * @param apply a boolean indicating whether the checks indicated by 1185 * <code>category</code> should be applied or not. 1186 <p> 1187 * @see SBMLDocument#setLevelAndVersion(long, long, boolean) 1188 */ public 1189 void setConsistencyChecksForConversion(int category, boolean apply) { 1190 libsbmlJNI.SBMLDocument_setConsistencyChecksForConversion(swigCPtr, this, category, apply); 1191 } 1192 1193 1194/** 1195 * Performs consistency checking and validation on this SBML document. 1196 <p> 1197 * If this method returns a nonzero value (meaning, one or more 1198 * consistency checks have failed for SBML document), the failures may be 1199 * due to warnings <em>or</em> errors. Callers should inspect the severity 1200 * flag in the individual {@link SBMLError} objects returned by 1201 * {@link SBMLDocument#getError(long)} to determine the nature of the failures. 1202 <p> 1203 * @return the number of failed checks (errors) encountered. 1204 <p> 1205 * @see SBMLDocument#checkInternalConsistency() 1206 */ public 1207 long checkConsistency() { 1208 return libsbmlJNI.SBMLDocument_checkConsistency(swigCPtr, this); 1209 } 1210 1211 1212/** 1213 * Performs consistency checking and validation on this SBML document 1214 * using the ultra strict units validator that assumes that there 1215 * are no hidden numerical conversion factors. 1216 <p> 1217 * If this method returns a nonzero value (meaning, one or more 1218 * consistency checks have failed for SBML document), the failures may be 1219 * due to warnings <em>or</em> errors. Callers should inspect the severity 1220 * flag in the individual {@link SBMLError} objects returned by 1221 * {@link SBMLDocument#getError(long)} to determine the nature of the failures. 1222 <p> 1223 * @return the number of failed checks (errors) encountered. 1224 <p> 1225 * @see SBMLDocument#checkInternalConsistency() 1226 */ public 1227 long checkConsistencyWithStrictUnits() { 1228 return libsbmlJNI.SBMLDocument_checkConsistencyWithStrictUnits(swigCPtr, this); 1229 } 1230 1231 1232/** 1233 * Performs consistency checking and validation on this SBML document. 1234 <p> 1235 * If this method returns a nonzero value (meaning, one or more 1236 * consistency checks have failed for SBML document), the failures may be 1237 * due to warnings <em>or</em> errors. Callers should inspect the severity 1238 * flag in the individual {@link SBMLError} objects returned by 1239 * {@link SBMLDocument#getError(long)} to determine the nature of the failures. 1240 <p> 1241 * @note unlike checkConsistency this method will write the document 1242 * in order to determine all errors for the document. This will 1243 * also clear the error log. 1244 <p> 1245 * @return the number of failed checks (errors) encountered. 1246 <p> 1247 * @see SBMLDocument#checkConsistency() 1248 */ public 1249 long validateSBML() { 1250 return libsbmlJNI.SBMLDocument_validateSBML(swigCPtr, this); 1251 } 1252 1253 1254/** 1255 * Performs consistency checking on libSBML's internal representation of 1256 * an SBML {@link Model}. 1257 <p> 1258 * Callers should query the results of the consistency check by calling 1259 * {@link SBMLDocument#getError(long)}. 1260 <p> 1261 * @return the number of failed checks (errors) encountered. 1262 <p> 1263 * The distinction between this method and 1264 * {@link SBMLDocument#checkConsistency()} is that this method reports on 1265 * fundamental syntactic and structural errors that violate the XML 1266 * Schema for SBML; by contrast, {@link SBMLDocument#checkConsistency()} 1267 * performs more elaborate model verifications and also validation 1268 * according to the validation rules written in the appendices of the 1269 * SBML Level 2 Versions 2–4 specification documents. 1270 <p> 1271 * @see SBMLDocument#checkConsistency() 1272 */ public 1273 long checkInternalConsistency() { 1274 return libsbmlJNI.SBMLDocument_checkInternalConsistency(swigCPtr, this); 1275 } 1276 1277 1278/** 1279 * Performs a set of consistency checks on the document to establish 1280 * whether it is compatible with SBML Level 1 and can be converted 1281 * to Level 1. 1282 <p> 1283 * Callers should query the results of the consistency check by calling 1284 * {@link SBMLDocument#getError(long)}. 1285 <p> 1286 * @return the number of failed checks (errors) encountered. 1287 */ public 1288 long checkL1Compatibility(boolean inConversion) { 1289 return libsbmlJNI.SBMLDocument_checkL1Compatibility__SWIG_0(swigCPtr, this, inConversion); 1290 } 1291 1292 1293/** 1294 * Performs a set of consistency checks on the document to establish 1295 * whether it is compatible with SBML Level 1 and can be converted 1296 * to Level 1. 1297 <p> 1298 * Callers should query the results of the consistency check by calling 1299 * {@link SBMLDocument#getError(long)}. 1300 <p> 1301 * @return the number of failed checks (errors) encountered. 1302 */ public 1303 long checkL1Compatibility() { 1304 return libsbmlJNI.SBMLDocument_checkL1Compatibility__SWIG_1(swigCPtr, this); 1305 } 1306 1307 1308/** 1309 * Performs a set of consistency checks on the document to establish 1310 * whether it is compatible with SBML Level 2 Version 1 and can 1311 * be converted to Level 2 Version 1. 1312 <p> 1313 * Callers should query the results of the consistency check by calling 1314 * {@link SBMLDocument#getError(long)}. 1315 <p> 1316 * @return the number of failed checks (errors) encountered. 1317 */ public 1318 long checkL2v1Compatibility(boolean inConversion) { 1319 return libsbmlJNI.SBMLDocument_checkL2v1Compatibility__SWIG_0(swigCPtr, this, inConversion); 1320 } 1321 1322 1323/** 1324 * Performs a set of consistency checks on the document to establish 1325 * whether it is compatible with SBML Level 2 Version 1 and can 1326 * be converted to Level 2 Version 1. 1327 <p> 1328 * Callers should query the results of the consistency check by calling 1329 * {@link SBMLDocument#getError(long)}. 1330 <p> 1331 * @return the number of failed checks (errors) encountered. 1332 */ public 1333 long checkL2v1Compatibility() { 1334 return libsbmlJNI.SBMLDocument_checkL2v1Compatibility__SWIG_1(swigCPtr, this); 1335 } 1336 1337 1338/** 1339 * Performs a set of consistency checks on the document to establish 1340 * whether it is compatible with SBML Level 2 Version 2 and can 1341 * be converted to Level 2 Version 2. 1342 <p> 1343 * Callers should query the results of the consistency check by calling 1344 * {@link SBMLDocument#getError(long)}. 1345 <p> 1346 * @return the number of failed checks (errors) encountered. 1347 */ public 1348 long checkL2v2Compatibility(boolean inConversion) { 1349 return libsbmlJNI.SBMLDocument_checkL2v2Compatibility__SWIG_0(swigCPtr, this, inConversion); 1350 } 1351 1352 1353/** 1354 * Performs a set of consistency checks on the document to establish 1355 * whether it is compatible with SBML Level 2 Version 2 and can 1356 * be converted to Level 2 Version 2. 1357 <p> 1358 * Callers should query the results of the consistency check by calling 1359 * {@link SBMLDocument#getError(long)}. 1360 <p> 1361 * @return the number of failed checks (errors) encountered. 1362 */ public 1363 long checkL2v2Compatibility() { 1364 return libsbmlJNI.SBMLDocument_checkL2v2Compatibility__SWIG_1(swigCPtr, this); 1365 } 1366 1367 1368/** 1369 * Performs a set of consistency checks on the document to establish 1370 * whether it is compatible with SBML Level 2 Version 3 and can 1371 * be converted to Level 2 Version 3. 1372 <p> 1373 * Callers should query the results of the consistency check by calling 1374 * {@link SBMLDocument#getError(long)}. 1375 <p> 1376 * @return the number of failed checks (errors) encountered. 1377 */ public 1378 long checkL2v3Compatibility(boolean inConversion) { 1379 return libsbmlJNI.SBMLDocument_checkL2v3Compatibility__SWIG_0(swigCPtr, this, inConversion); 1380 } 1381 1382 1383/** 1384 * Performs a set of consistency checks on the document to establish 1385 * whether it is compatible with SBML Level 2 Version 3 and can 1386 * be converted to Level 2 Version 3. 1387 <p> 1388 * Callers should query the results of the consistency check by calling 1389 * {@link SBMLDocument#getError(long)}. 1390 <p> 1391 * @return the number of failed checks (errors) encountered. 1392 */ public 1393 long checkL2v3Compatibility() { 1394 return libsbmlJNI.SBMLDocument_checkL2v3Compatibility__SWIG_1(swigCPtr, this); 1395 } 1396 1397 1398/** 1399 * Performs a set of consistency checks on the document to establish 1400 * whether it is compatible with SBML Level 2 Version 4 and can 1401 * be converted to Level 2 Version 4. 1402 <p> 1403 * Callers should query the results of the consistency check by calling 1404 * {@link SBMLDocument#getError(long)}. 1405 <p> 1406 * @return the number of failed checks (errors) encountered. 1407 */ public 1408 long checkL2v4Compatibility() { 1409 return libsbmlJNI.SBMLDocument_checkL2v4Compatibility(swigCPtr, this); 1410 } 1411 1412 1413/** 1414 * Performs a set of consistency checks on the document to establish 1415 * whether it is compatible with SBML Level 3 Version 1 and can 1416 * be converted to Level 3 Version 1. 1417 <p> 1418 * Callers should query the results of the consistency check by calling 1419 * {@link SBMLDocument#getError(long)}. 1420 <p> 1421 * @return the number of failed checks (errors) encountered. 1422 */ public 1423 long checkL3v1Compatibility() { 1424 return libsbmlJNI.SBMLDocument_checkL3v1Compatibility(swigCPtr, this); 1425 } 1426 1427 1428/** 1429 * Returns the nth error or warning encountered during parsing, 1430 * consistency checking, or attempted translation of this model. 1431 <p> 1432 * Callers can use method {@link XMLError#getSeverity()} on the result to assess 1433 * the severity of the problem. The possible severity levels range from 1434 * informational messages to fatal errors. 1435 <p> 1436 * @return the error or warning indexed by integer <code>n</code>, or return 1437 * <code>null</code> if <code>n > (getNumErrors() - 1)</code>. 1438 <p> 1439 * @param n the integer index of the error sought. 1440 <p> 1441 * @see SBMLDocument#getNumErrors() 1442 */ public 1443 SBMLError getError(long n) { 1444 long cPtr = libsbmlJNI.SBMLDocument_getError(swigCPtr, this, n); 1445 return (cPtr == 0) ? null : new SBMLError(cPtr, false); 1446 } 1447 1448 1449/** 1450 * Returns the nth error or warning with the given severity 1451 * encountered during parsing, consistency checking, or attempted 1452 * translation of this model. 1453 <p> 1454 * @return the error or warning indexed by integer <code>n</code>, or return 1455 * <code>null</code> if <code>n > (getNumErrors(severity) - 1)</code>. 1456 <p> 1457 * @param n the integer index of the error sought. 1458 * @param severity the severity of the error sought. 1459 <p> 1460 * @see SBMLDocument#getNumErrors() 1461 */ public 1462 SBMLError getErrorWithSeverity(long n, long severity) { 1463 long cPtr = libsbmlJNI.SBMLDocument_getErrorWithSeverity(swigCPtr, this, n, severity); 1464 return (cPtr == 0) ? null : new SBMLError(cPtr, false); 1465 } 1466 1467 1468/** 1469 * Returns the number of errors or warnings encountered during parsing, 1470 * consistency checking, or attempted translation of this model. 1471 <p> 1472 * @return the number of errors or warnings encountered 1473 <p> 1474 * @see SBMLDocument#getError(long n) 1475 */ public 1476 long getNumErrors() { 1477 return libsbmlJNI.SBMLDocument_getNumErrors__SWIG_0(swigCPtr, this); 1478 } 1479 1480 1481/** 1482 * Returns the number of errors or warnings encountered with the given 1483 * severity during parsing, 1484 * consistency checking, or attempted translation of this model. 1485 <p> 1486 * @param severity the severity of the error sought. 1487 <p> 1488 * @return the number of errors or warnings encountered 1489 <p> 1490 * @see SBMLDocument#getError(long n) 1491 */ public 1492 long getNumErrors(long severity) { 1493 return libsbmlJNI.SBMLDocument_getNumErrors__SWIG_1(swigCPtr, this, severity); 1494 } 1495 1496 1497/** 1498 * Prints all the errors or warnings encountered trying to parse, 1499 * check, or translate this SBML document. 1500 <p> 1501 * It prints the text to the stream given by the optional parameter 1502 * <code>stream</code>. If no parameter is given, it prints the output to the 1503 * standard error stream. 1504 <p> 1505 * If no errors have occurred, i.e., <code>getNumErrors() == 0</code>, no 1506 * output will be sent to the stream. 1507 <p> 1508 * The format of the output is: 1509 * <pre class='fragment'> 1510 N error(s): 1511 line NNN: (id) message 1512 </pre> 1513 <p> 1514 * @param stream the ostream or ostringstream object indicating where 1515 * the output should be printed. 1516 <p> 1517 * 1518</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 1519The native C++ implementation of this method defines a default argument 1520value. In the documentation generated for different libSBML language 1521bindings, you may or may not see corresponding arguments in the method 1522declarations. For example, in Java and C#, a default argument is handled by 1523declaring two separate methods, with one of them having the argument and 1524the other one lacking the argument. However, the libSBML documentation will 1525be <em>identical</em> for both methods. Consequently, if you are reading 1526this and do not see an argument even though one is described, please look 1527for descriptions of other variants of this method near where this one 1528appears in the documentation. 1529</dd></dl> 1530 1531 <p> 1532 * @see #getNumErrors() 1533 * @see #getErrorLog() 1534 * @see SBMLDocument#getError(long n) 1535 */ public 1536 void printErrors(OStream stream) { 1537 libsbmlJNI.SBMLDocument_printErrors__SWIG_0(swigCPtr, this, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream); 1538 } 1539 1540 1541/** 1542 * Prints all the errors or warnings encountered trying to parse, 1543 * check, or translate this SBML document. 1544 <p> 1545 * It prints the text to the stream given by the optional parameter 1546 * <code>stream</code>. If no parameter is given, it prints the output to the 1547 * standard error stream. 1548 <p> 1549 * If no errors have occurred, i.e., <code>getNumErrors() == 0</code>, no 1550 * output will be sent to the stream. 1551 <p> 1552 * The format of the output is: 1553 * <pre class='fragment'> 1554 N error(s): 1555 line NNN: (id) message 1556 </pre> 1557 <p> 1558 * @param stream the ostream or ostringstream object indicating where 1559 * the output should be printed. 1560 <p> 1561 * 1562</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 1563The native C++ implementation of this method defines a default argument 1564value. In the documentation generated for different libSBML language 1565bindings, you may or may not see corresponding arguments in the method 1566declarations. For example, in Java and C#, a default argument is handled by 1567declaring two separate methods, with one of them having the argument and 1568the other one lacking the argument. However, the libSBML documentation will 1569be <em>identical</em> for both methods. Consequently, if you are reading 1570this and do not see an argument even though one is described, please look 1571for descriptions of other variants of this method near where this one 1572appears in the documentation. 1573</dd></dl> 1574 1575 <p> 1576 * @see #getNumErrors() 1577 * @see #getErrorLog() 1578 * @see SBMLDocument#getError(long n) 1579 */ public 1580 void printErrors() { 1581 libsbmlJNI.SBMLDocument_printErrors__SWIG_1(swigCPtr, this); 1582 } 1583 1584 1585/** 1586 * Prints all the errors or warnings with the given severity encountered 1587 * trying to parse, check, or translate this SBML document. 1588 <p> 1589 * It prints the text to the stream given by the parameter 1590 * <code>stream</code>. 1591 <p> 1592 * If no errors have occurred, i.e., <code>getNumErrors(severity) == 0</code>, no 1593 * output will be sent to the stream. 1594 <p> 1595 * The format of the output is: 1596 * <pre class='fragment'> 1597 N error(s): 1598 line NNN: (id) message 1599</pre> 1600 <p> 1601 * @param stream the ostream or ostringstream object indicating where 1602 * the output should be printed. 1603 * @param severity of the errors sought. 1604 <p> 1605 * @see #getNumErrors(long severity) 1606 * @see #getErrorLog() 1607 * @see SBMLDocument#getErrorWithSeverity(long n, long severity) 1608 */ public 1609 void printErrors(OStream stream, long severity) { 1610 libsbmlJNI.SBMLDocument_printErrors__SWIG_2(swigCPtr, this, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, severity); 1611 } 1612 1613 public void connectToChild() { 1614 libsbmlJNI.SBMLDocument_connectToChild(swigCPtr, this); 1615 } 1616 1617 1618/** 1619 * Converts this document using the converter that best matches 1620 * the given conversion properties. 1621 <p> 1622 * @param props the conversion properties to use 1623 <p> 1624 * <p> 1625 * @return integer value indicating success/failure of the 1626 * function. The possible values 1627 * returned by this function are: 1628 * <ul> 1629 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1630 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1631 * <li> {@link libsbmlConstants#LIBSBML_CONV_CONVERSION_NOT_AVAILABLE LIBSBML_CONV_CONVERSION_NOT_AVAILABLE} 1632 * </ul> 1633 */ public 1634 int convert(ConversionProperties props) { 1635 return libsbmlJNI.SBMLDocument_convert(swigCPtr, this, ConversionProperties.getCPtr(props), props); 1636 } 1637 1638 1639/** * @internal */ public 1640 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 1641 libsbmlJNI.SBMLDocument_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 1642 } 1643 1644 1645/** 1646 * Returns the libSBML type code for this SBML object. 1647 <p> 1648 * <p> 1649 * LibSBML attaches an identifying code to every kind of SBML object. These 1650 * are integer constants known as <em>SBML type codes</em>. The names of all 1651 * the codes begin with the characters <code>SBML_</code>. 1652 * In the Java language interface for libSBML, the 1653 * type codes are defined as static integer constants in the interface class 1654 * {@link libsbmlConstants}. Note that different Level 3 1655 * package plug-ins may use overlapping type codes; to identify the package 1656 * to which a given object belongs, call the <code>getPackageName()</code> 1657 * method on the object. 1658 <p> 1659 * @return the SBML type code for this object: 1660 * {@link libsbmlConstants#SBML_DOCUMENT SBML_DOCUMENT} (default). 1661 <p> 1662 * <p> 1663 * @warning <span class='warning'>The specific integer values of the possible 1664 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 1665 * packages, To fully identify the correct code, <strong>it is necessary to 1666 * invoke both getTypeCode() and getPackageName()</strong>.</span> 1667 <p> 1668 * @see SBMLDocument#getElementName() 1669 * @see #getPackageName() 1670 */ public 1671 int getTypeCode() { 1672 return libsbmlJNI.SBMLDocument_getTypeCode(swigCPtr, this); 1673 } 1674 1675 1676/** 1677 * Returns the XML element name of this object, which for {@link SBMLDocument}, 1678 * is always <code>'sbml'.</code> 1679 <p> 1680 * @return the name of this element, i.e., <code>'sbml'.</code> 1681 */ public 1682 String getElementName() { 1683 return libsbmlJNI.SBMLDocument_getElementName(swigCPtr, this); 1684 } 1685 1686 1687/** 1688 * Returns the list of errors or warnings logged during parsing, 1689 * consistency checking, or attempted translation of this model. 1690 <p> 1691 * @return the {@link SBMLErrorLog} used for this {@link SBMLDocument} 1692 <p> 1693 * @see SBMLDocument#getNumErrors() 1694 */ public 1695 SBMLErrorLog getErrorLog() { 1696 long cPtr = libsbmlJNI.SBMLDocument_getErrorLog__SWIG_0(swigCPtr, this); 1697 return (cPtr == 0) ? null : new SBMLErrorLog(cPtr, false); 1698 } 1699 1700 1701/** 1702 * Returns a list of XML Namespaces associated with the XML content 1703 * of this SBML document. 1704 <p> 1705 * @return the XML Namespaces associated with this SBML object 1706 */ public 1707 XMLNamespaces getNamespaces() { 1708 long cPtr = libsbmlJNI.SBMLDocument_getNamespaces(swigCPtr, this); 1709 return (cPtr == 0) ? null : new XMLNamespaces(cPtr, false); 1710 } 1711 1712 1713/** 1714 * Set/unset default namespace to each top-level element defined in the 1715 * given package extension. 1716 <p> 1717 * This works by adding a <code>xmlns="..."</code> attribute. No 1718 * prefix will be written when writing elements defined in the given 1719 * package extension if <code>true</code> is given as second argument. 1720 <p> 1721 * @param package the name or URI of the package extension. 1722 * @param flag boolean value to indicate whether to write a namespace 1723 * prefix. 1724 <p> 1725 * <p> 1726 * @return integer value indicating success/failure of the 1727 * function. The possible values 1728 * returned by this function are: 1729 * <ul> 1730 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1731 * <li> {@link libsbmlConstants#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION} 1732 * </ul> 1733 */ public 1734 int enableDefaultNS(String arg0, boolean flag) { 1735 return libsbmlJNI.SBMLDocument_enableDefaultNS(swigCPtr, this, arg0, flag); 1736 } 1737 1738 1739/** 1740 * Returns <code>true</code> if a default namespace is added to each top-level 1741 * element defined in the given package extension, otherwise returns 1742 * <code>false.</code> 1743 <p> 1744 * This basically checks if the attribute 1745 * <code>xmlns="..."</code> is present. 1746 <p> 1747 * @param package the name or URI of the package extension. 1748 <p> 1749 * @return a boolean 1750 */ public 1751 boolean isEnabledDefaultNS(String arg0) { 1752 return libsbmlJNI.SBMLDocument_isEnabledDefaultNS(swigCPtr, this, arg0); 1753 } 1754 1755 1756/** 1757 * Sets the <code>required</code> attribute value of the given package 1758 * extension. 1759 <p> 1760 * @note The name of package must not be given if the package is not 1761 * enabled. 1762 <p> 1763 * @param package the name or URI of the package extension. 1764 * @param flag Boolean value indicating whether the package is required. 1765 <p> 1766 * <p> 1767 * @return integer value indicating success/failure of the 1768 * function. The possible values 1769 * returned by this function are: 1770 * <ul> 1771 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1772 * <li> {@link libsbmlConstants#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION} 1773 * </ul> 1774 */ public 1775 int setPackageRequired(String arg0, boolean flag) { 1776 return libsbmlJNI.SBMLDocument_setPackageRequired(swigCPtr, this, arg0, flag); 1777 } 1778 1779 1780/** 1781 * Returns the <code>required</code> attribute of the given package 1782 * extension. 1783 <p> 1784 * @note The name of package must not be given if the package is not 1785 * enabled. 1786 <p> 1787 * @param package the name or URI of the package extension. 1788 <p> 1789 * @return Boolean flag indicating whether the package is flagged as 1790 * being required. 1791 */ public 1792 boolean getPackageRequired(String arg0) { 1793 return libsbmlJNI.SBMLDocument_getPackageRequired(swigCPtr, this, arg0); 1794 } 1795 1796 1797/** 1798 * Returns <code>true</code> if the required attribute of the given package extension 1799 * is defined, otherwise returns <code>false.</code> 1800 <p> 1801 * @note The name of package must not be given if the package is not 1802 * enabled. 1803 <p> 1804 * @param package the name or URI of the package extension. 1805 <p> 1806 * @return a Boolean 1807 */ public 1808 boolean isSetPackageRequired(String arg0) { 1809 return libsbmlJNI.SBMLDocument_isSetPackageRequired(swigCPtr, this, arg0); 1810 } 1811 1812 1813/** 1814 * Returns <code>true</code> if the given package extension is one of an ignored 1815 * packages, otherwise returns <code>false.</code> 1816 <p> 1817 * An ignored package is one that is defined to be used in this SBML 1818 * document, but the package is not enabled in this copy of libSBML. 1819 <p> 1820 * @param pkgURI the URI of the package extension. 1821 <p> 1822 * @return a Boolean, <code>true</code> if the package is being ignored and 1823 * <code>false</code> otherwise. 1824 */ public 1825 boolean isIgnoredPackage(String pkgURI) { 1826 return libsbmlJNI.SBMLDocument_isIgnoredPackage(swigCPtr, this, pkgURI); 1827 } 1828 1829 1830/** 1831 * Returns <code>true</code> if the given package extension is one of an ignored 1832 * packages that has been disabled, otherwise returns <code>false.</code> 1833 <p> 1834 * An ignored package is one that is defined to be used in this SBML 1835 * document, but the package is not enabled in this copy of libSBML. 1836 * It may have been disabled to avoid reproducing the package 1837 * information when writing out the file. 1838 <p> 1839 * @param pkgURI the URI of the package extension. 1840 <p> 1841 * @return a Boolean, <code>true</code> if the package is being ignored and 1842 * <code>false</code> otherwise. 1843 */ public 1844 boolean isDisabledIgnoredPackage(String pkgURI) { 1845 return libsbmlJNI.SBMLDocument_isDisabledIgnoredPackage(swigCPtr, this, pkgURI); 1846 } 1847 1848 1849/** 1850 * Sets the value of the <code>required</code> attribute for the given 1851 * package. 1852 <p> 1853 * @note The name of package must not be given if the package is not 1854 * enabled. 1855 <p> 1856 * @param package the name or URI of the package extension. 1857 * @param flag a Boolean value. 1858 <p> 1859 * <p> 1860 * @return integer value indicating success/failure of the 1861 * function. The possible values 1862 * returned by this function are: 1863 * <ul> 1864 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1865 * <li> {@link libsbmlConstants#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION} 1866 * 1867 * </ul> <p> 1868 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1869 * setPackageRequired(String, boolean) 1870 </div> 1871 * */ public 1872 int setPkgRequired(String arg0, boolean flag) { 1873 return libsbmlJNI.SBMLDocument_setPkgRequired(swigCPtr, this, arg0, flag); 1874 } 1875 1876 1877/** 1878 * Returns the <code>required</code> attribute of the given package 1879 * extension. 1880 <p> 1881 * @note The name of package must not be given if the package is not 1882 * enabled. 1883 <p> 1884 * @param package the name or URI of the package extension. 1885 <p> 1886 * @return a Boolean value indicating whether the package is flagged as 1887 * being required in this SBML document. 1888 <p> 1889 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1890 * getPackageRequired(String) 1891 </div> 1892 * */ public 1893 boolean getPkgRequired(String arg0) { 1894 return libsbmlJNI.SBMLDocument_getPkgRequired(swigCPtr, this, arg0); 1895 } 1896 1897 1898/** 1899 * Returns <code>true</code> if the required attribute of the given package extension 1900 * is defined, otherwise returns <code>false.</code> 1901 <p> 1902 * @note The name of package must not be given if the package is not 1903 * enabled. 1904 <p> 1905 * @param package the name or URI of the package extension. 1906 <p> 1907 * @return a Boolean value. 1908 <p> 1909 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1910 * isSetPackageRequired(String) 1911 </div> 1912 * */ public 1913 boolean isSetPkgRequired(String arg0) { 1914 return libsbmlJNI.SBMLDocument_isSetPkgRequired(swigCPtr, this, arg0); 1915 } 1916 1917 1918/** 1919 * Returns <code>true</code> if the given package extension is one of ignored 1920 * packages, otherwise returns <code>false.</code> 1921 <p> 1922 * An ignored package is one that is defined to be used in this SBML 1923 * document, but the package is not enabled in this copy of libSBML. 1924 <p> 1925 * @param pkgURI the URI of the package extension. 1926 <p> 1927 * @return a boolean 1928 <p> 1929 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1930 * isIgnoredPackage(String) 1931 </div> 1932 * */ public 1933 boolean isIgnoredPkg(String pkgURI) { 1934 return libsbmlJNI.SBMLDocument_isIgnoredPkg(swigCPtr, this, pkgURI); 1935 } 1936 1937 1938/** * @internal */ public 1939 short getApplicableValidators() { 1940 return libsbmlJNI.SBMLDocument_getApplicableValidators(swigCPtr, this); 1941 } 1942 1943 1944/** * @internal */ public 1945 short getConversionValidators() { 1946 return libsbmlJNI.SBMLDocument_getConversionValidators(swigCPtr, this); 1947 } 1948 1949 1950/** * @internal */ public 1951 void setApplicableValidators(short appl) { 1952 libsbmlJNI.SBMLDocument_setApplicableValidators(swigCPtr, this, appl); 1953 } 1954 1955 1956/** * @internal */ public 1957 void setConversionValidators(short appl) { 1958 libsbmlJNI.SBMLDocument_setConversionValidators(swigCPtr, this, appl); 1959 } 1960 1961 1962/** * @internal */ public 1963 long getNumValidators() { 1964 return libsbmlJNI.SBMLDocument_getNumValidators(swigCPtr, this); 1965 } 1966 1967 1968/** * @internal */ public 1969 int clearValidators() { 1970 return libsbmlJNI.SBMLDocument_clearValidators(swigCPtr, this); 1971 } 1972 1973 1974/** * @internal */ public 1975 int addValidator(SBMLValidator validator) { 1976 return libsbmlJNI.SBMLDocument_addValidator(swigCPtr, this, SBMLValidator.getCPtr(validator), validator); 1977 } 1978 1979 1980/** * @internal */ public 1981 SBMLValidator getValidator(long index) { 1982 long cPtr = libsbmlJNI.SBMLDocument_getValidator(swigCPtr, this, index); 1983 return (cPtr == 0) ? null : new SBMLValidator(cPtr, false); 1984 } 1985 1986 1987/** * @internal */ public 1988 int addUnknownPackageRequired(String pkgURI, String prefix, boolean flag) { 1989 return libsbmlJNI.SBMLDocument_addUnknownPackageRequired(swigCPtr, this, pkgURI, prefix, flag); 1990 } 1991 1992 1993/** * @internal */ public 1994 boolean hasUnknownPackage(String pkgURI) { 1995 return libsbmlJNI.SBMLDocument_hasUnknownPackage(swigCPtr, this, pkgURI); 1996 } 1997 1998 1999/** * @internal */ public 2000 int getNumUnknownPackages() { 2001 return libsbmlJNI.SBMLDocument_getNumUnknownPackages(swigCPtr, this); 2002 } 2003 2004 2005/** * @internal */ public 2006 String getUnknownPackageURI(int index) { 2007 return libsbmlJNI.SBMLDocument_getUnknownPackageURI(swigCPtr, this, index); 2008 } 2009 2010 2011/** * @internal */ public 2012 String getUnknownPackagePrefix(int index) { 2013 return libsbmlJNI.SBMLDocument_getUnknownPackagePrefix(swigCPtr, this, index); 2014 } 2015 2016}