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