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 * 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.15.2 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.15.2 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()}, and 629 * {@link SBMLDocument#checkL3v1Compatibility()}. 630 <p> 631 * The valid combinations of SBML Level and Version as of this release 632 * of libSBML are the following: 633 * <ul> 634 * <li> Level 1 Version 2 635 * <li> Level 2 Version 1 636 * <li> Level 2 Version 2 637 * <li> Level 2 Version 3 638 * <li> Level 2 Version 4 639 * <li> Level 2 Version 5 640 * <li> Level 3 Version 1 641 * <li> Level 3 Version 2 642 * </ul> 643 <p> 644 * Strict conversion applies the additional criteria that both the 645 * source and the target model must be consistent SBML. Users can 646 * control the consistency checks that are applied using the 647 * {@link SBMLDocument#setConsistencyChecksForConversion(int, boolean)} method. If either 648 * the source or the potential target model have validation errors, the 649 * conversion is not performed. When a strict conversion is successful, 650 * the underlying SBML object model is altered to reflect the new level 651 * and version. Thus, information that cannot be converted 652 * (e.g. sboTerms) will be lost. 653 <p> 654 * @param level the desired SBML Level. 655 <p> 656 * @param version the desired Version within the SBML Level. 657 <p> 658 * @param strict boolean indicating whether to check consistency 659 * of both the source and target model when performing 660 * conversion (defaults to <code> true </code>). 661 <p> 662 * @param ignorePackages boolean indicating whether the presence of 663 * packages should be ignored by the conversion routine 664 * (defaults to <code> false </code>). 665 <p> 666 * @return <code>true</code> if the level and version of the document were 667 * successfully set to the requested values (which may have required 668 * conversion of the model), <code>false</code> otherwise. 669 <p> 670 * @note Calling this method will not <em>necessarily</em> lead to a successful 671 * conversion. If the conversion fails, it will be logged in the error 672 * list associated with this {@link SBMLDocument}. Callers should consult 673 * getNumErrors() to find out if the conversion succeeded without 674 * problems. For conversions from Level 2 to Level 1, callers 675 * can also check the Level of the model after calling this method to 676 * find out whether it is Level 1. (If the conversion to 677 * Level 1 failed, the Level of this model will be left unchanged.) 678 <p> 679 * 680</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 681The native C++ implementation of this method defines a default argument 682value. In the documentation generated for different libSBML language 683bindings, you may or may not see corresponding arguments in the method 684declarations. For example, in Java and C#, a default argument is handled by 685declaring two separate methods, with one of them having the argument and 686the other one lacking the argument. However, the libSBML documentation will 687be <em>identical</em> for both methods. Consequently, if you are reading 688this and do not see an argument even though one is described, please look 689for descriptions of other variants of this method near where this one 690appears in the documentation. 691</dd></dl> 692 693 <p> 694 * @see #checkL1Compatibility() 695 * @see #checkL2v1Compatibility() 696 * @see #checkL2v2Compatibility() 697 * @see #checkL2v3Compatibility() 698 * @see #checkL2v4Compatibility() 699 * @see #checkL2v5Compatibility() 700 * @see #checkL3v1Compatibility() 701 */ public 702 boolean setLevelAndVersion(long level, long version, boolean strict, boolean ignorePackages) { 703 return libsbmlJNI.SBMLDocument_setLevelAndVersion__SWIG_0(swigCPtr, this, level, version, strict, ignorePackages); 704 } 705 706 707/** 708 * Sets the SBML Level and Version of this {@link SBMLDocument} instance, 709 * attempting to convert the model as needed. 710 <p> 711 * This method is the principal way in libSBML to convert models between 712 * Levels and Versions of SBML. Generally, models can be converted 713 * upward without difficulty (e.g., from SBML Level 1 to 714 * Level 2, or from an earlier Version of Level 2 to the latest 715 * Version of Level 2). Sometimes models can be translated downward 716 * as well, if they do not use constructs specific to more advanced 717 * Levels of SBML. 718 <p> 719 * Before calling this method, callers may check compatibility directly 720 * using the methods {@link SBMLDocument#checkL1Compatibility()}, 721 * {@link SBMLDocument#checkL2v1Compatibility()}, 722 * {@link SBMLDocument#checkL2v2Compatibility()}, 723 * {@link SBMLDocument#checkL2v3Compatibility()}, 724 * {@link SBMLDocument#checkL2v4Compatibility()}, 725 * {@link SBMLDocument#checkL2v5Compatibility()}, and 726 * {@link SBMLDocument#checkL3v1Compatibility()}. 727 <p> 728 * The valid combinations of SBML Level and Version as of this release 729 * of libSBML are the following: 730 * <ul> 731 * <li> Level 1 Version 2 732 * <li> Level 2 Version 1 733 * <li> Level 2 Version 2 734 * <li> Level 2 Version 3 735 * <li> Level 2 Version 4 736 * <li> Level 2 Version 5 737 * <li> Level 3 Version 1 738 * <li> Level 3 Version 2 739 * </ul> 740 <p> 741 * Strict conversion applies the additional criteria that both the 742 * source and the target model must be consistent SBML. Users can 743 * control the consistency checks that are applied using the 744 * {@link SBMLDocument#setConsistencyChecksForConversion(int, boolean)} method. If either 745 * the source or the potential target model have validation errors, the 746 * conversion is not performed. When a strict conversion is successful, 747 * the underlying SBML object model is altered to reflect the new level 748 * and version. Thus, information that cannot be converted 749 * (e.g. sboTerms) will be lost. 750 <p> 751 * @param level the desired SBML Level. 752 <p> 753 * @param version the desired Version within the SBML Level. 754 <p> 755 * @param strict boolean indicating whether to check consistency 756 * of both the source and target model when performing 757 * conversion (defaults to <code> true </code>). 758 <p> 759 * @param ignorePackages boolean indicating whether the presence of 760 * packages should be ignored by the conversion routine 761 * (defaults to <code> false </code>). 762 <p> 763 * @return <code>true</code> if the level and version of the document were 764 * successfully set to the requested values (which may have required 765 * conversion of the model), <code>false</code> otherwise. 766 <p> 767 * @note Calling this method will not <em>necessarily</em> lead to a successful 768 * conversion. If the conversion fails, it will be logged in the error 769 * list associated with this {@link SBMLDocument}. Callers should consult 770 * getNumErrors() to find out if the conversion succeeded without 771 * problems. For conversions from Level 2 to Level 1, callers 772 * can also check the Level of the model after calling this method to 773 * find out whether it is Level 1. (If the conversion to 774 * Level 1 failed, the Level of this model will be left unchanged.) 775 <p> 776 * 777</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 778The native C++ implementation of this method defines a default argument 779value. In the documentation generated for different libSBML language 780bindings, you may or may not see corresponding arguments in the method 781declarations. For example, in Java and C#, a default argument is handled by 782declaring two separate methods, with one of them having the argument and 783the other one lacking the argument. However, the libSBML documentation will 784be <em>identical</em> for both methods. Consequently, if you are reading 785this and do not see an argument even though one is described, please look 786for descriptions of other variants of this method near where this one 787appears in the documentation. 788</dd></dl> 789 790 <p> 791 * @see #checkL1Compatibility() 792 * @see #checkL2v1Compatibility() 793 * @see #checkL2v2Compatibility() 794 * @see #checkL2v3Compatibility() 795 * @see #checkL2v4Compatibility() 796 * @see #checkL2v5Compatibility() 797 * @see #checkL3v1Compatibility() 798 */ public 799 boolean setLevelAndVersion(long level, long version, boolean strict) { 800 return libsbmlJNI.SBMLDocument_setLevelAndVersion__SWIG_1(swigCPtr, this, level, version, strict); 801 } 802 803 804/** 805 * Sets the SBML Level and Version of this {@link SBMLDocument} instance, 806 * attempting to convert the model as needed. 807 <p> 808 * This method is the principal way in libSBML to convert models between 809 * Levels and Versions of SBML. Generally, models can be converted 810 * upward without difficulty (e.g., from SBML Level 1 to 811 * Level 2, or from an earlier Version of Level 2 to the latest 812 * Version of Level 2). Sometimes models can be translated downward 813 * as well, if they do not use constructs specific to more advanced 814 * Levels of SBML. 815 <p> 816 * Before calling this method, callers may check compatibility directly 817 * using the methods {@link SBMLDocument#checkL1Compatibility()}, 818 * {@link SBMLDocument#checkL2v1Compatibility()}, 819 * {@link SBMLDocument#checkL2v2Compatibility()}, 820 * {@link SBMLDocument#checkL2v3Compatibility()}, 821 * {@link SBMLDocument#checkL2v4Compatibility()}, 822 * {@link SBMLDocument#checkL2v5Compatibility()}, and 823 * {@link SBMLDocument#checkL3v1Compatibility()}. 824 <p> 825 * The valid combinations of SBML Level and Version as of this release 826 * of libSBML are the following: 827 * <ul> 828 * <li> Level 1 Version 2 829 * <li> Level 2 Version 1 830 * <li> Level 2 Version 2 831 * <li> Level 2 Version 3 832 * <li> Level 2 Version 4 833 * <li> Level 2 Version 5 834 * <li> Level 3 Version 1 835 * <li> Level 3 Version 2 836 * </ul> 837 <p> 838 * Strict conversion applies the additional criteria that both the 839 * source and the target model must be consistent SBML. Users can 840 * control the consistency checks that are applied using the 841 * {@link SBMLDocument#setConsistencyChecksForConversion(int, boolean)} method. If either 842 * the source or the potential target model have validation errors, the 843 * conversion is not performed. When a strict conversion is successful, 844 * the underlying SBML object model is altered to reflect the new level 845 * and version. Thus, information that cannot be converted 846 * (e.g. sboTerms) will be lost. 847 <p> 848 * @param level the desired SBML Level. 849 <p> 850 * @param version the desired Version within the SBML Level. 851 <p> 852 * @param strict boolean indicating whether to check consistency 853 * of both the source and target model when performing 854 * conversion (defaults to <code> true </code>). 855 <p> 856 * @param ignorePackages boolean indicating whether the presence of 857 * packages should be ignored by the conversion routine 858 * (defaults to <code> false </code>). 859 <p> 860 * @return <code>true</code> if the level and version of the document were 861 * successfully set to the requested values (which may have required 862 * conversion of the model), <code>false</code> otherwise. 863 <p> 864 * @note Calling this method will not <em>necessarily</em> lead to a successful 865 * conversion. If the conversion fails, it will be logged in the error 866 * list associated with this {@link SBMLDocument}. Callers should consult 867 * getNumErrors() to find out if the conversion succeeded without 868 * problems. For conversions from Level 2 to Level 1, callers 869 * can also check the Level of the model after calling this method to 870 * find out whether it is Level 1. (If the conversion to 871 * Level 1 failed, the Level of this model will be left unchanged.) 872 <p> 873 * 874</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 875The native C++ implementation of this method defines a default argument 876value. In the documentation generated for different libSBML language 877bindings, you may or may not see corresponding arguments in the method 878declarations. For example, in Java and C#, a default argument is handled by 879declaring two separate methods, with one of them having the argument and 880the other one lacking the argument. However, the libSBML documentation will 881be <em>identical</em> for both methods. Consequently, if you are reading 882this and do not see an argument even though one is described, please look 883for descriptions of other variants of this method near where this one 884appears in the documentation. 885</dd></dl> 886 887 <p> 888 * @see #checkL1Compatibility() 889 * @see #checkL2v1Compatibility() 890 * @see #checkL2v2Compatibility() 891 * @see #checkL2v3Compatibility() 892 * @see #checkL2v4Compatibility() 893 * @see #checkL2v5Compatibility() 894 * @see #checkL3v1Compatibility() 895 */ public 896 boolean setLevelAndVersion(long level, long version) { 897 return libsbmlJNI.SBMLDocument_setLevelAndVersion__SWIG_2(swigCPtr, this, level, version); 898 } 899 900 901/** * @internal */ public 902 void updateSBMLNamespace(String arg0, long level, long version) { 903 libsbmlJNI.SBMLDocument_updateSBMLNamespace(swigCPtr, this, arg0, level, version); 904 } 905 906 907/** 908 * Sets the {@link Model} for this {@link SBMLDocument} to a copy of the given {@link Model}. 909 <p> 910 * @param m the new {@link Model} to use. 911 <p> 912 * <p> 913 * @return integer value indicating success/failure of the 914 * function. The possible values 915 * returned by this function are: 916 * <ul> 917 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 918 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 919 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 920 * 921 * </ul> <p> 922 * @see #createModel() 923 * @see #getModel() 924 */ public 925 int setModel(Model m) { 926 return libsbmlJNI.SBMLDocument_setModel(swigCPtr, this, Model.getCPtr(m), m); 927 } 928 929 930/** 931 * Creates a new {@link Model} inside this {@link SBMLDocument}, and returns a pointer to 932 * it. 933 <p> 934 * In SBML Level 2, the use of an identifier on a {@link Model} object is 935 * optional. This method takes an optional argument, <code>sid</code>, for setting 936 * the identifier. If not supplied, the identifier attribute on the 937 * {@link Model} instance is not set. 938 <p> 939 * @param sid the identifier of the new {@link Model} to create. 940 <p> 941 * 942</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 943The native C++ implementation of this method defines a default argument 944value. In the documentation generated for different libSBML language 945bindings, you may or may not see corresponding arguments in the method 946declarations. For example, in Java and C#, a default argument is handled by 947declaring two separate methods, with one of them having the argument and 948the other one lacking the argument. However, the libSBML documentation will 949be <em>identical</em> for both methods. Consequently, if you are reading 950this and do not see an argument even though one is described, please look 951for descriptions of other variants of this method near where this one 952appears in the documentation. 953</dd></dl> 954 955 <p> 956 * @see #getModel() 957 * @see SBMLDocument#setModel(Model) 958 */ public 959 Model createModel(String sid) { 960 long cPtr = libsbmlJNI.SBMLDocument_createModel__SWIG_0(swigCPtr, this, sid); 961 return (cPtr == 0) ? null : new Model(cPtr, false); 962 } 963 964 965/** 966 * Creates a new {@link Model} inside this {@link SBMLDocument}, and returns a pointer to 967 * it. 968 <p> 969 * In SBML Level 2, the use of an identifier on a {@link Model} object is 970 * optional. This method takes an optional argument, <code>sid</code>, for setting 971 * the identifier. If not supplied, the identifier attribute on the 972 * {@link Model} instance is not set. 973 <p> 974 * @param sid the identifier of the new {@link Model} to create. 975 <p> 976 * 977</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 978The native C++ implementation of this method defines a default argument 979value. In the documentation generated for different libSBML language 980bindings, you may or may not see corresponding arguments in the method 981declarations. For example, in Java and C#, a default argument is handled by 982declaring two separate methods, with one of them having the argument and 983the other one lacking the argument. However, the libSBML documentation will 984be <em>identical</em> for both methods. Consequently, if you are reading 985this and do not see an argument even though one is described, please look 986for descriptions of other variants of this method near where this one 987appears in the documentation. 988</dd></dl> 989 990 <p> 991 * @see #getModel() 992 * @see SBMLDocument#setModel(Model) 993 */ public 994 Model createModel() { 995 long cPtr = libsbmlJNI.SBMLDocument_createModel__SWIG_1(swigCPtr, this); 996 return (cPtr == 0) ? null : new Model(cPtr, false); 997 } 998 999 1000/** 1001 * Sets the location of this {@link SBMLDocument}. 1002 <p> 1003 * Called automatically when readSBMLFromFile is used, but may be set 1004 * manually as well. 1005 */ public 1006 void setLocationURI(String uri) { 1007 libsbmlJNI.SBMLDocument_setLocationURI(swigCPtr, this, uri); 1008 } 1009 1010 1011/** 1012 * Get the location of this {@link SBMLDocument}. 1013 <p> 1014 * If this document was read from a file or had its location set manually, 1015 * that filename or set location will be returned, otherwise, an empty 1016 * string is returned. 1017 */ public 1018 String getLocationURI() { 1019 return libsbmlJNI.SBMLDocument_getLocationURI__SWIG_0(swigCPtr, this); 1020 } 1021 1022 1023/** 1024 * Controls the consistency checks that are performed when 1025 * {@link SBMLDocument#checkConsistency()} is called. 1026 <p> 1027 * This method works by adding or subtracting consistency checks from the 1028 * set of all possible checks that {@link SBMLDocument#checkConsistency()} knows 1029 * how to perform. This method may need to be called multiple times in 1030 * order to achieve the desired combination of checks. The first 1031 * argument (<code>category</code>) in a call to this method indicates the category 1032 * of consistency/error checks that are to be turned on or off, and the 1033 * second argument (<code>apply</code>, a boolean) indicates whether to turn it on 1034 * (value of <code>true</code>) or off (value of <code>false</code>). 1035 <p> 1036 * The possible categories (values to the argument <code>category</code>) are the 1037 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1038 * in the interface class {@link libsbmlConstants}. 1039 * The following are the possible choices: 1040 <p> 1041 * <ul> 1042 * <li> {@link libsbmlConstants#LIBSBML_CAT_GENERAL_CONSISTENCY LIBSBML_CAT_GENERAL_CONSISTENCY}: 1043 * Correctness and consistency of specific SBML language constructs. 1044 * Performing this set of checks is highly recommended. With respect to 1045 * the SBML specification, these concern failures in applying the 1046 * validation rules numbered 2xxxx in the Level 2 1047 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1048 <p> 1049 * <li> {@link libsbmlConstants#LIBSBML_CAT_IDENTIFIER_CONSISTENCY LIBSBML_CAT_IDENTIFIER_CONSISTENCY}: 1050 * Correctness and consistency of identifiers used for model entities. An 1051 * example of inconsistency would be using a species identifier in a 1052 * reaction rate formula without first having declared the species. With 1053 * respect to the SBML specification, these concern failures in applying 1054 * the validation rules numbered 103xx in the Level 2 1055 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1056 <p> 1057 * <li> {@link libsbmlConstants#LIBSBML_CAT_UNITS_CONSISTENCY LIBSBML_CAT_UNITS_CONSISTENCY}: 1058 * Consistency of measurement units associated with quantities in a model. 1059 * With respect to the SBML specification, these concern failures in 1060 * applying the validation rules numbered 105xx in the Level 2 1061 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1062 <p> 1063 * <li> {@link libsbmlConstants#LIBSBML_CAT_MATHML_CONSISTENCY LIBSBML_CAT_MATHML_CONSISTENCY}: 1064 * Syntax of MathML constructs. With respect to the SBML specification, 1065 * these concern failures in applying the validation rules numbered 102xx 1066 * in the Level 2 Versions 2–4 and Level 3 1067 * Versions 1–2 specifications. 1068 <p> 1069 * <li> {@link libsbmlConstants#LIBSBML_CAT_SBO_CONSISTENCY LIBSBML_CAT_SBO_CONSISTENCY}: 1070 * Consistency and validity of SBO identifiers (if any) used in the model. 1071 * With respect to the SBML specification, these concern failures in 1072 * applying the validation rules numbered 107xx in the Level 2 1073 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1074 <p> 1075 * <li> {@link libsbmlConstants#LIBSBML_CAT_OVERDETERMINED_MODEL LIBSBML_CAT_OVERDETERMINED_MODEL}: 1076 * Static analysis of whether the system of equations implied by a model is 1077 * mathematically overdetermined. With respect to the SBML specification, 1078 * this is validation rule #10601 in the Level 2 1079 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1080 <p> 1081 * <li> {@link libsbmlConstants#LIBSBML_CAT_MODELING_PRACTICE LIBSBML_CAT_MODELING_PRACTICE}: 1082 * Additional checks for recommended good modeling practice. (These are 1083 * tests performed by libSBML and do not have equivalent SBML validation 1084 * rules.) </ul> 1085 <p> 1086 * <em>By default, all validation checks are applied</em> to the model in 1087 * an {@link SBMLDocument} object <em>unless</em> 1088 * {@link SBMLDocument#setConsistencyChecks(int categ, boolean onoff)} 1089 * is called to indicate that only a subset should be applied. Further, 1090 * this default (i.e., performing all checks) applies separately to 1091 * <em>each new {@link SBMLDocument} object</em> created. In other words, each 1092 * time a model is read using {@link SBMLReader#readSBML(String filename)}, 1093 * {@link SBMLReader#readSBMLFromString(String xml)}, 1094 * or the global functions readSBML() and readSBMLFromString(), a new 1095 * {@link SBMLDocument} is created and for that document, a call to 1096 * {@link SBMLDocument#checkConsistency()} will default to applying all possible checks. 1097 * Calling programs must invoke 1098 * {@link SBMLDocument#setConsistencyChecks(int categ, boolean onoff)} 1099 * for each such new model if they wish to change the consistency checks 1100 * applied. 1101 <p> 1102 * @param category a value drawn from * the set of SBML error categories indicating the 1103 * consistency checking/validation to be turned on or off. 1104 <p> 1105 * @param apply a boolean indicating whether the checks indicated by 1106 * <code>category</code> should be applied or not. 1107 <p> 1108 * @see SBMLDocument#checkConsistency() 1109 */ public 1110 void setConsistencyChecks(int category, boolean apply) { 1111 libsbmlJNI.SBMLDocument_setConsistencyChecks(swigCPtr, this, category, apply); 1112 } 1113 1114 1115/** 1116 * Controls the consistency checks that are performed when 1117 * {@link SBMLDocument#setLevelAndVersion(long, long, boolean)} is called. 1118 <p> 1119 * This method works by adding or subtracting consistency checks from the 1120 * set of all possible checks that may be performed to avoid conversion 1121 * to or from an invalid document. This method may need to be called 1122 * multiple times in 1123 * order to achieve the desired combination of checks. The first 1124 * argument (<code>category</code>) in a call to this method indicates the category 1125 * of consistency/error checks that are to be turned on or off, and the 1126 * second argument (<code>apply</code>, a boolean) indicates whether to turn it on 1127 * (value of <code>true</code>) or off (value of <code>false</code>). 1128 <p> 1129 * The possible categories (values to the argument <code>category</code>) are the 1130 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1131 * in the interface class {@link libsbmlConstants}. 1132 * The following are the possible choices: 1133 <p> 1134 * <ul> 1135 * <li> {@link libsbmlConstants#LIBSBML_CAT_GENERAL_CONSISTENCY LIBSBML_CAT_GENERAL_CONSISTENCY}: 1136 * Correctness and consistency of specific SBML language constructs. 1137 * Performing this set of checks is highly recommended. With respect to 1138 * the SBML specification, these concern failures in applying the 1139 * validation rules numbered 2xxxx in the Level 2 1140 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1141 <p> 1142 * <li> {@link libsbmlConstants#LIBSBML_CAT_IDENTIFIER_CONSISTENCY LIBSBML_CAT_IDENTIFIER_CONSISTENCY}: 1143 * Correctness and consistency of identifiers used for model entities. An 1144 * example of inconsistency would be using a species identifier in a 1145 * reaction rate formula without first having declared the species. With 1146 * respect to the SBML specification, these concern failures in applying 1147 * the validation rules numbered 103xx in the Level 2 1148 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1149 <p> 1150 * <li> {@link libsbmlConstants#LIBSBML_CAT_UNITS_CONSISTENCY LIBSBML_CAT_UNITS_CONSISTENCY}: 1151<p> 1152 * Consistency of measurement units associated with quantities in a model. 1153 * With respect to the SBML specification, these concern failures in 1154 * applying the validation rules numbered 105xx in the Level 2 1155 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1156 <p> 1157 * <li> {@link libsbmlConstants#LIBSBML_CAT_MATHML_CONSISTENCY LIBSBML_CAT_MATHML_CONSISTENCY}: 1158 * Syntax of MathML constructs. With respect to the SBML specification, 1159 * these concern failures in applying the validation rules numbered 102xx 1160 * in the Level 2 Versions 2–4 and Level 3 1161 * Versions 1–2 specifications. 1162 <p> 1163 * <li> {@link libsbmlConstants#LIBSBML_CAT_SBO_CONSISTENCY LIBSBML_CAT_SBO_CONSISTENCY}: 1164 * Consistency and validity of SBO identifiers (if any) used in the model. 1165 * With respect to the SBML specification, these concern failures in 1166 * applying the validation rules numbered 107xx in the Level 2 1167 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1168 <p> 1169 * <li> {@link libsbmlConstants#LIBSBML_CAT_OVERDETERMINED_MODEL LIBSBML_CAT_OVERDETERMINED_MODEL}: 1170 * Static analysis of whether the system of equations implied by a model is 1171 * mathematically overdetermined. With respect to the SBML specification, 1172 * this is validation rule #10601 in the Level 2 1173 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1174 <p> 1175 * <li> {@link libsbmlConstants#LIBSBML_CAT_MODELING_PRACTICE LIBSBML_CAT_MODELING_PRACTICE}: 1176 * Additional checks for recommended good modeling practice. (These are 1177 * tests performed by libSBML and do not have equivalent SBML validation 1178 * rules.) 1179 * </ul> 1180 <p> 1181 * <em>By default, all validation checks are applied</em> to the model in 1182 * an {@link SBMLDocument} object <em>unless</em> 1183 * {@link SBMLDocument#setConsistencyChecks(int, boolean)} 1184 * is called to indicate that only a subset should be applied. Further, 1185 * this default (i.e., performing all checks) applies separately to 1186 * <em>each new {@link SBMLDocument} object</em> created. In other words, each 1187 * time a model is read using {@link SBMLReader#readSBML(String)}, 1188 * {@link SBMLReader#readSBMLFromString(String)}, 1189 * or the global functions readSBML() and readSBMLFromString(), a new 1190 * {@link SBMLDocument} is created and for that document, a call to 1191 * {@link SBMLDocument#checkConsistency()} will default to applying all possible checks. 1192 * Calling programs must invoke 1193 * {@link SBMLDocument#setConsistencyChecks(int, boolean)} 1194 * for each such new model if they wish to change the consistency checks 1195 * applied. 1196 <p> 1197 * @param category a value drawn from * the set of SBML error categories indicating the consistency 1198 * checking/validation to be turned on or off. 1199 <p> 1200 * @param apply a boolean indicating whether the checks indicated by 1201 * <code>category</code> should be applied or not. 1202 <p> 1203 * @see SBMLDocument#setLevelAndVersion(long, long, boolean) 1204 */ public 1205 void setConsistencyChecksForConversion(int category, boolean apply) { 1206 libsbmlJNI.SBMLDocument_setConsistencyChecksForConversion(swigCPtr, this, category, apply); 1207 } 1208 1209 1210/** 1211 * Performs consistency checking and validation on this SBML document. 1212 <p> 1213 * If this method returns a nonzero value (meaning, one or more 1214 * consistency checks have failed for SBML document), the failures may be 1215 * due to warnings <em>or</em> errors. Callers should inspect the severity 1216 * flag in the individual {@link SBMLError} objects returned by 1217 * {@link SBMLDocument#getError(long)} to determine the nature of the failures. 1218 <p> 1219 * @return the number of failed checks (errors) encountered. 1220 <p> 1221 * @see SBMLDocument#checkInternalConsistency() 1222 */ public 1223 long checkConsistency() { 1224 return libsbmlJNI.SBMLDocument_checkConsistency(swigCPtr, this); 1225 } 1226 1227 1228/** 1229 * Performs consistency checking and validation on this SBML document 1230 * using the ultra strict units validator that assumes that there 1231 * are no hidden numerical conversion factors. 1232 <p> 1233 * If this method returns a nonzero value (meaning, one or more 1234 * consistency checks have failed for SBML document), the failures may be 1235 * due to warnings <em>or</em> errors. Callers should inspect the severity 1236 * flag in the individual {@link SBMLError} objects returned by 1237 * {@link SBMLDocument#getError(long)} to determine the nature of the failures. 1238 <p> 1239 * @return the number of failed checks (errors) encountered. 1240 <p> 1241 * @see SBMLDocument#checkInternalConsistency() 1242 */ public 1243 long checkConsistencyWithStrictUnits() { 1244 return libsbmlJNI.SBMLDocument_checkConsistencyWithStrictUnits(swigCPtr, this); 1245 } 1246 1247 1248/** 1249 * Performs consistency checking and validation on this SBML document. 1250 <p> 1251 * If this method returns a nonzero value (meaning, one or more 1252 * consistency checks have failed for SBML document), the failures may be 1253 * due to warnings <em>or</em> errors. Callers should inspect the severity 1254 * flag in the individual {@link SBMLError} objects returned by 1255 * {@link SBMLDocument#getError(long)} to determine the nature of the failures. 1256 <p> 1257 * @note unlike checkConsistency this method will write the document 1258 * in order to determine all errors for the document. This will 1259 * also clear the error log. 1260 <p> 1261 * @return the number of failed checks (errors) encountered. 1262 <p> 1263 * @see SBMLDocument#checkConsistency() 1264 */ public 1265 long validateSBML() { 1266 return libsbmlJNI.SBMLDocument_validateSBML(swigCPtr, this); 1267 } 1268 1269 1270/** 1271 * Performs consistency checking on libSBML's internal representation of 1272 * an SBML {@link Model}. 1273 <p> 1274 * Callers should query the results of the consistency check by calling 1275 * {@link SBMLDocument#getError(long)}. 1276 <p> 1277 * @return the number of failed checks (errors) encountered. 1278 <p> 1279 * The distinction between this method and 1280 * {@link SBMLDocument#checkConsistency()} is that this method reports on 1281 * fundamental syntactic and structural errors that violate the XML 1282 * Schema for SBML; by contrast, {@link SBMLDocument#checkConsistency()} 1283 * performs more elaborate model verifications and also validation 1284 * according to the validation rules written in the appendices of the 1285 * SBML Level 2 Versions 2–4 specification documents. 1286 <p> 1287 * @see SBMLDocument#checkConsistency() 1288 */ public 1289 long checkInternalConsistency() { 1290 return libsbmlJNI.SBMLDocument_checkInternalConsistency(swigCPtr, this); 1291 } 1292 1293 1294/** 1295 * Performs a set of consistency checks on the document to establish 1296 * whether it is compatible with SBML Level 1 and can be converted 1297 * to Level 1. 1298 <p> 1299 * Callers should query the results of the consistency check by calling 1300 * {@link SBMLDocument#getError(long)}. 1301 <p> 1302 * @return the number of failed checks (errors) encountered. 1303 */ public 1304 long checkL1Compatibility(boolean inConversion) { 1305 return libsbmlJNI.SBMLDocument_checkL1Compatibility__SWIG_0(swigCPtr, this, inConversion); 1306 } 1307 1308 1309/** 1310 * Performs a set of consistency checks on the document to establish 1311 * whether it is compatible with SBML Level 1 and can be converted 1312 * to Level 1. 1313 <p> 1314 * Callers should query the results of the consistency check by calling 1315 * {@link SBMLDocument#getError(long)}. 1316 <p> 1317 * @return the number of failed checks (errors) encountered. 1318 */ public 1319 long checkL1Compatibility() { 1320 return libsbmlJNI.SBMLDocument_checkL1Compatibility__SWIG_1(swigCPtr, this); 1321 } 1322 1323 1324/** 1325 * Performs a set of consistency checks on the document to establish 1326 * whether it is compatible with SBML Level 2 Version 1 and can 1327 * be converted to Level 2 Version 1. 1328 <p> 1329 * Callers should query the results of the consistency check by calling 1330 * {@link SBMLDocument#getError(long)}. 1331 <p> 1332 * @return the number of failed checks (errors) encountered. 1333 */ public 1334 long checkL2v1Compatibility(boolean inConversion) { 1335 return libsbmlJNI.SBMLDocument_checkL2v1Compatibility__SWIG_0(swigCPtr, this, inConversion); 1336 } 1337 1338 1339/** 1340 * Performs a set of consistency checks on the document to establish 1341 * whether it is compatible with SBML Level 2 Version 1 and can 1342 * be converted to Level 2 Version 1. 1343 <p> 1344 * Callers should query the results of the consistency check by calling 1345 * {@link SBMLDocument#getError(long)}. 1346 <p> 1347 * @return the number of failed checks (errors) encountered. 1348 */ public 1349 long checkL2v1Compatibility() { 1350 return libsbmlJNI.SBMLDocument_checkL2v1Compatibility__SWIG_1(swigCPtr, this); 1351 } 1352 1353 1354/** 1355 * Performs a set of consistency checks on the document to establish 1356 * whether it is compatible with SBML Level 2 Version 2 and can 1357 * be converted to Level 2 Version 2. 1358 <p> 1359 * Callers should query the results of the consistency check by calling 1360 * {@link SBMLDocument#getError(long)}. 1361 <p> 1362 * @return the number of failed checks (errors) encountered. 1363 */ public 1364 long checkL2v2Compatibility(boolean inConversion) { 1365 return libsbmlJNI.SBMLDocument_checkL2v2Compatibility__SWIG_0(swigCPtr, this, inConversion); 1366 } 1367 1368 1369/** 1370 * Performs a set of consistency checks on the document to establish 1371 * whether it is compatible with SBML Level 2 Version 2 and can 1372 * be converted to Level 2 Version 2. 1373 <p> 1374 * Callers should query the results of the consistency check by calling 1375 * {@link SBMLDocument#getError(long)}. 1376 <p> 1377 * @return the number of failed checks (errors) encountered. 1378 */ public 1379 long checkL2v2Compatibility() { 1380 return libsbmlJNI.SBMLDocument_checkL2v2Compatibility__SWIG_1(swigCPtr, this); 1381 } 1382 1383 1384/** 1385 * Performs a set of consistency checks on the document to establish 1386 * whether it is compatible with SBML Level 2 Version 3 and can 1387 * be converted to Level 2 Version 3. 1388 <p> 1389 * Callers should query the results of the consistency check by calling 1390 * {@link SBMLDocument#getError(long)}. 1391 <p> 1392 * @return the number of failed checks (errors) encountered. 1393 */ public 1394 long checkL2v3Compatibility(boolean inConversion) { 1395 return libsbmlJNI.SBMLDocument_checkL2v3Compatibility__SWIG_0(swigCPtr, this, inConversion); 1396 } 1397 1398 1399/** 1400 * Performs a set of consistency checks on the document to establish 1401 * whether it is compatible with SBML Level 2 Version 3 and can 1402 * be converted to Level 2 Version 3. 1403 <p> 1404 * Callers should query the results of the consistency check by calling 1405 * {@link SBMLDocument#getError(long)}. 1406 <p> 1407 * @return the number of failed checks (errors) encountered. 1408 */ public 1409 long checkL2v3Compatibility() { 1410 return libsbmlJNI.SBMLDocument_checkL2v3Compatibility__SWIG_1(swigCPtr, this); 1411 } 1412 1413 1414/** 1415 * Performs a set of consistency checks on the document to establish 1416 * whether it is compatible with SBML Level 2 Version 4 and can 1417 * be converted to Level 2 Version 4. 1418 <p> 1419 * Callers should query the results of the consistency check by calling 1420 * {@link SBMLDocument#getError(long)}. 1421 <p> 1422 * @return the number of failed checks (errors) encountered. 1423 */ public 1424 long checkL2v4Compatibility() { 1425 return libsbmlJNI.SBMLDocument_checkL2v4Compatibility(swigCPtr, this); 1426 } 1427 1428 1429/** 1430 * Performs a set of consistency checks on the document to establish 1431 * whether it is compatible with SBML Level 2 Version 5 and can 1432 * be converted to Level 2 Version 5. 1433 <p> 1434 * Callers should query the results of the consistency check by calling 1435 * {@link SBMLDocument#getError(long)}. 1436 <p> 1437 * @return the number of failed checks (errors) encountered. 1438 */ public 1439 long checkL2v5Compatibility() { 1440 return libsbmlJNI.SBMLDocument_checkL2v5Compatibility(swigCPtr, this); 1441 } 1442 1443 1444/** 1445 * Performs a set of consistency checks on the document to establish 1446 * whether it is compatible with SBML Level 3 Version 1 and can 1447 * be converted to Level 3 Version 1. 1448 <p> 1449 * Callers should query the results of the consistency check by calling 1450 * {@link SBMLDocument#getError(long)}. 1451 <p> 1452 * @return the number of failed checks (errors) encountered. 1453 */ public 1454 long checkL3v1Compatibility() { 1455 return libsbmlJNI.SBMLDocument_checkL3v1Compatibility(swigCPtr, this); 1456 } 1457 1458 1459/** 1460 * Performs a set of consistency checks on the document to establish 1461 * whether it is compatible with SBML Level 3 Version 2 and can 1462 * be converted to Level 3 Version 2. 1463 <p> 1464 * Callers should query the results of the consistency check by calling 1465 * {@link SBMLDocument#getError(long)}. 1466 <p> 1467 * @return the number of failed checks (errors) encountered. 1468 */ public 1469 long checkL3v2Compatibility() { 1470 return libsbmlJNI.SBMLDocument_checkL3v2Compatibility(swigCPtr, this); 1471 } 1472 1473 1474/** 1475 * Returns the nth error or warning encountered during parsing, 1476 * consistency checking, or attempted translation of this model. 1477 <p> 1478 * Callers can use method {@link XMLError#getSeverity()} on the result to assess 1479 * the severity of the problem. The possible severity levels range from 1480 * informational messages to fatal errors. 1481 <p> 1482 * @return the error or warning indexed by integer <code>n</code>, or return 1483 * <code>null</code> if <code>n > (getNumErrors() - 1)</code>. 1484 <p> 1485 * @param n the integer index of the error sought. 1486 <p> 1487 * @see SBMLDocument#getNumErrors() 1488 */ public 1489 SBMLError getError(long n) { 1490 long cPtr = libsbmlJNI.SBMLDocument_getError(swigCPtr, this, n); 1491 return (cPtr == 0) ? null : new SBMLError(cPtr, false); 1492 } 1493 1494 1495/** 1496 * Returns the nth error or warning with the given severity 1497 * encountered during parsing, consistency checking, or attempted 1498 * translation of this model. 1499 <p> 1500 * @return the error or warning indexed by integer <code>n</code>, or return 1501 * <code>null</code> if <code>n > (getNumErrors(severity) - 1)</code>. 1502 <p> 1503 * @param n the integer index of the error sought. 1504 * @param severity the severity of the error sought. 1505 <p> 1506 * @see SBMLDocument#getNumErrors() 1507 */ public 1508 SBMLError getErrorWithSeverity(long n, long severity) { 1509 long cPtr = libsbmlJNI.SBMLDocument_getErrorWithSeverity(swigCPtr, this, n, severity); 1510 return (cPtr == 0) ? null : new SBMLError(cPtr, false); 1511 } 1512 1513 1514/** 1515 * Returns the number of errors or warnings encountered during parsing, 1516 * consistency checking, or attempted translation of this model. 1517 <p> 1518 * @return the number of errors or warnings encountered. 1519 <p> 1520 * @see SBMLDocument#getError(long n) 1521 */ public 1522 long getNumErrors() { 1523 return libsbmlJNI.SBMLDocument_getNumErrors__SWIG_0(swigCPtr, this); 1524 } 1525 1526 1527/** 1528 * Returns the number of errors or warnings encountered with the given 1529 * severity during parsing, 1530 * consistency checking, or attempted translation of this model. 1531 <p> 1532 * @param severity the severity of the error sought. 1533 <p> 1534 * @return the number of errors or warnings encountered. 1535 <p> 1536 * @see SBMLDocument#getError(long n) 1537 */ public 1538 long getNumErrors(long severity) { 1539 return libsbmlJNI.SBMLDocument_getNumErrors__SWIG_1(swigCPtr, this, severity); 1540 } 1541 1542 1543/** 1544 * Prints all the errors or warnings encountered trying to parse, 1545 * check, or translate this SBML document. 1546 <p> 1547 * It prints the text to the stream given by the optional parameter 1548 * <code>stream</code>. If no parameter is given, it prints the output to the 1549 * standard error stream. 1550 <p> 1551 * If no errors have occurred, i.e., <code>getNumErrors() == 0</code>, no 1552 * output will be sent to the stream. 1553 <p> 1554 * The format of the output is: 1555 * <pre class='fragment'> 1556 N error(s): 1557 line NNN: (id) message 1558 </pre> 1559 <p> 1560 * @param stream the ostream or ostringstream object indicating where 1561 * the output should be printed. 1562 <p> 1563 * 1564</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 1565The native C++ implementation of this method defines a default argument 1566value. In the documentation generated for different libSBML language 1567bindings, you may or may not see corresponding arguments in the method 1568declarations. For example, in Java and C#, a default argument is handled by 1569declaring two separate methods, with one of them having the argument and 1570the other one lacking the argument. However, the libSBML documentation will 1571be <em>identical</em> for both methods. Consequently, if you are reading 1572this and do not see an argument even though one is described, please look 1573for descriptions of other variants of this method near where this one 1574appears in the documentation. 1575</dd></dl> 1576 1577 <p> 1578 * @see #getNumErrors() 1579 * @see #getErrorLog() 1580 * @see SBMLDocument#getError(long n) 1581 */ public 1582 void printErrors(OStream stream) { 1583 libsbmlJNI.SBMLDocument_printErrors__SWIG_0(swigCPtr, this, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream); 1584 } 1585 1586 1587/** 1588 * Prints all the errors or warnings encountered trying to parse, 1589 * check, or translate this SBML document. 1590 <p> 1591 * It prints the text to the stream given by the optional parameter 1592 * <code>stream</code>. If no parameter is given, it prints the output to the 1593 * standard error stream. 1594 <p> 1595 * If no errors have occurred, i.e., <code>getNumErrors() == 0</code>, no 1596 * output will be sent to the stream. 1597 <p> 1598 * The format of the output is: 1599 * <pre class='fragment'> 1600 N error(s): 1601 line NNN: (id) message 1602 </pre> 1603 <p> 1604 * @param stream the ostream or ostringstream object indicating where 1605 * the output should be printed. 1606 <p> 1607 * 1608</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 1609The native C++ implementation of this method defines a default argument 1610value. In the documentation generated for different libSBML language 1611bindings, you may or may not see corresponding arguments in the method 1612declarations. For example, in Java and C#, a default argument is handled by 1613declaring two separate methods, with one of them having the argument and 1614the other one lacking the argument. However, the libSBML documentation will 1615be <em>identical</em> for both methods. Consequently, if you are reading 1616this and do not see an argument even though one is described, please look 1617for descriptions of other variants of this method near where this one 1618appears in the documentation. 1619</dd></dl> 1620 1621 <p> 1622 * @see #getNumErrors() 1623 * @see #getErrorLog() 1624 * @see SBMLDocument#getError(long n) 1625 */ public 1626 void printErrors() { 1627 libsbmlJNI.SBMLDocument_printErrors__SWIG_1(swigCPtr, this); 1628 } 1629 1630 1631/** 1632 * Prints all the errors or warnings with the given severity encountered 1633 * trying to parse, check, or translate this SBML document. 1634 <p> 1635 * It prints the text to the stream given by the parameter 1636 * <code>stream</code>. 1637 <p> 1638 * If no errors have occurred, i.e., <code>getNumErrors(severity) == 0</code>, no 1639 * output will be sent to the stream. 1640 <p> 1641 * The format of the output is: 1642 * <pre class='fragment'> 1643 N error(s): 1644 line NNN: (id) message 1645</pre> 1646 <p> 1647 * @param stream the ostream or ostringstream object indicating where 1648 * the output should be printed. 1649 * @param severity of the errors sought. 1650 <p> 1651 * @see #getNumErrors(long severity) 1652 * @see #getErrorLog() 1653 * @see SBMLDocument#getErrorWithSeverity(long n, long severity) 1654 */ public 1655 void printErrors(OStream stream, long severity) { 1656 libsbmlJNI.SBMLDocument_printErrors__SWIG_2(swigCPtr, this, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, severity); 1657 } 1658 1659 public void connectToChild() { 1660 libsbmlJNI.SBMLDocument_connectToChild(swigCPtr, this); 1661 } 1662 1663 1664/** 1665 * Converts this document using the converter that best matches 1666 * the given conversion properties. 1667 <p> 1668 * @param props the conversion properties to use. 1669 <p> 1670 * <p> 1671 * @return integer value indicating success/failure of the 1672 * function. The possible values 1673 * returned by this function are: 1674 * <ul> 1675 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1676 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1677 * <li> {@link libsbmlConstants#LIBSBML_CONV_CONVERSION_NOT_AVAILABLE LIBSBML_CONV_CONVERSION_NOT_AVAILABLE} 1678 * </ul> 1679 */ public 1680 int convert(ConversionProperties props) { 1681 return libsbmlJNI.SBMLDocument_convert(swigCPtr, this, ConversionProperties.getCPtr(props), props); 1682 } 1683 1684 1685/** * @internal */ public 1686 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 1687 libsbmlJNI.SBMLDocument_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 1688 } 1689 1690 1691/** 1692 * Returns the libSBML type code for this SBML object. 1693 <p> 1694 * <p> 1695 * LibSBML attaches an identifying code to every kind of SBML object. These 1696 * are integer constants known as <em>SBML type codes</em>. The names of all 1697 * the codes begin with the characters <code>SBML_</code>. 1698 * In the Java language interface for libSBML, the 1699 * type codes are defined as static integer constants in the interface class 1700 * {@link libsbmlConstants}. Note that different Level 3 1701 * package plug-ins may use overlapping type codes; to identify the package 1702 * to which a given object belongs, call the <code>getPackageName()</code> 1703 * method on the object. 1704 <p> 1705 * @return the SBML type code for this object: 1706 * {@link libsbmlConstants#SBML_DOCUMENT SBML_DOCUMENT} (default). 1707 <p> 1708 * <p> 1709 * @warning <span class='warning'>The specific integer values of the possible 1710 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 1711 * packages, To fully identify the correct code, <strong>it is necessary to 1712 * invoke both getTypeCode() and getPackageName()</strong>.</span> 1713 <p> 1714 * @see SBMLDocument#getElementName() 1715 * @see #getPackageName() 1716 */ public 1717 int getTypeCode() { 1718 return libsbmlJNI.SBMLDocument_getTypeCode(swigCPtr, this); 1719 } 1720 1721 1722/** 1723 * Returns the XML element name of this object, which for {@link SBMLDocument}, 1724 * is always <code>'sbml'.</code> 1725 <p> 1726 * @return the name of this element, i.e., <code>'sbml'.</code> 1727 */ public 1728 String getElementName() { 1729 return libsbmlJNI.SBMLDocument_getElementName(swigCPtr, this); 1730 } 1731 1732 1733/** 1734 * Returns the list of errors or warnings logged during parsing, 1735 * consistency checking, or attempted translation of this model. 1736 <p> 1737 * @return the {@link SBMLErrorLog} used for this {@link SBMLDocument}. 1738 <p> 1739 * @see SBMLDocument#getNumErrors() 1740 */ public 1741 SBMLErrorLog getErrorLog() { 1742 long cPtr = libsbmlJNI.SBMLDocument_getErrorLog__SWIG_0(swigCPtr, this); 1743 return (cPtr == 0) ? null : new SBMLErrorLog(cPtr, false); 1744 } 1745 1746 1747/** 1748 * Returns a list of XML Namespaces associated with the XML content 1749 * of this SBML document. 1750 <p> 1751 * @return the XML Namespaces associated with this SBML object. 1752 */ public 1753 XMLNamespaces getNamespaces() { 1754 long cPtr = libsbmlJNI.SBMLDocument_getNamespaces(swigCPtr, this); 1755 return (cPtr == 0) ? null : new XMLNamespaces(cPtr, false); 1756 } 1757 1758 1759/** 1760 * Set/unset default namespace to each top-level element defined in the 1761 * given package extension. 1762 <p> 1763 * This works by adding a <code>xmlns="..."</code> attribute. No 1764 * prefix will be written when writing elements defined in the given 1765 * package extension if <code>true</code> is given as second argument. 1766 <p> 1767 * @param package the name or URI of the package extension. 1768 * @param flag boolean value to indicate whether to write a namespace 1769 * prefix. 1770 <p> 1771 * <p> 1772 * @return integer value indicating success/failure of the 1773 * function. The possible values 1774 * returned by this function are: 1775 * <ul> 1776 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1777 * <li> {@link libsbmlConstants#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION} 1778 * </ul> 1779 */ public 1780 int enableDefaultNS(String arg0, boolean flag) { 1781 return libsbmlJNI.SBMLDocument_enableDefaultNS(swigCPtr, this, arg0, flag); 1782 } 1783 1784 1785/** 1786 * Returns <code>true</code> if a default namespace is added to each top-level 1787 * element defined in the given package extension, otherwise returns 1788 * <code>false.</code> 1789 <p> 1790 * This basically checks if the attribute 1791 * <code>xmlns="..."</code> is present. 1792 <p> 1793 * @param package the name or URI of the package extension. 1794 <p> 1795 * @return a boolean indicating whether the given package's default namespace is enabled. 1796 */ public 1797 boolean isEnabledDefaultNS(String arg0) { 1798 return libsbmlJNI.SBMLDocument_isEnabledDefaultNS(swigCPtr, this, arg0); 1799 } 1800 1801 1802/** 1803 * Sets the <code>required</code> attribute value of the given package 1804 * extension. 1805 <p> 1806 * @note The name of package must not be given if the package is not 1807 * enabled. 1808 <p> 1809 * @param package the name or URI of the package extension. 1810 * @param flag Boolean value indicating whether the package is required. 1811 <p> 1812 * <p> 1813 * @return integer value indicating success/failure of the 1814 * function. The possible values 1815 * returned by this function are: 1816 * <ul> 1817 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1818 * <li> {@link libsbmlConstants#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION} 1819 * </ul> 1820 */ public 1821 int setPackageRequired(String arg0, boolean flag) { 1822 return libsbmlJNI.SBMLDocument_setPackageRequired(swigCPtr, this, arg0, flag); 1823 } 1824 1825 1826/** 1827 * Returns the <code>required</code> attribute of the given package 1828 * extension. 1829 <p> 1830 * @note The name of package must not be given if the package is not 1831 * enabled. 1832 <p> 1833 * @param package the name or URI of the package extension. 1834 <p> 1835 * @return Boolean flag indicating whether the package is flagged as 1836 * being required. 1837 */ public 1838 boolean getPackageRequired(String arg0) { 1839 return libsbmlJNI.SBMLDocument_getPackageRequired(swigCPtr, this, arg0); 1840 } 1841 1842 1843/** 1844 * Returns <code>true</code> if the required attribute of the given package extension 1845 * is defined, otherwise returns <code>false.</code> 1846 <p> 1847 * @note The name of package must not be given if the package is not 1848 * enabled. 1849 <p> 1850 * @param package the name or URI of the package extension. 1851 <p> 1852 * @return a Boolean indicating whether the package's 'required' flag is set. 1853 */ public 1854 boolean isSetPackageRequired(String arg0) { 1855 return libsbmlJNI.SBMLDocument_isSetPackageRequired(swigCPtr, this, arg0); 1856 } 1857 1858 1859/** 1860 * Returns <code>true</code> if the given package extension is one of an ignored 1861 * packages, otherwise returns <code>false.</code> 1862 <p> 1863 * An ignored package is one that is defined to be used in this SBML 1864 * document, but the package is not enabled in this copy of libSBML. 1865 <p> 1866 * @param pkgURI the URI of the package extension. 1867 <p> 1868 * @return a Boolean, <code>true</code> if the package is being ignored and 1869 * <code>false</code> otherwise. 1870 */ public 1871 boolean isIgnoredPackage(String pkgURI) { 1872 return libsbmlJNI.SBMLDocument_isIgnoredPackage(swigCPtr, this, pkgURI); 1873 } 1874 1875 1876/** 1877 * Returns <code>true</code> if the given package extension is one of an ignored 1878 * packages that has been disabled, otherwise returns <code>false.</code> 1879 <p> 1880 * An ignored package is one that is defined to be used in this SBML 1881 * document, but the package is not enabled in this copy of libSBML. 1882 * It may have been disabled to avoid reproducing the package 1883 * information when writing out the file. 1884 <p> 1885 * @param pkgURI the URI of the package extension. 1886 <p> 1887 * @return a Boolean, <code>true</code> if the package is being ignored and 1888 * <code>false</code> otherwise. 1889 */ public 1890 boolean isDisabledIgnoredPackage(String pkgURI) { 1891 return libsbmlJNI.SBMLDocument_isDisabledIgnoredPackage(swigCPtr, this, pkgURI); 1892 } 1893 1894 1895/** 1896 * Sets the value of the <code>required</code> attribute for the given 1897 * package. 1898 <p> 1899 * @note The name of package must not be given if the package is not 1900 * enabled. 1901 <p> 1902 * @param package the name or URI of the package extension. 1903 * @param flag a Boolean value. 1904 <p> 1905 * <p> 1906 * @return integer value indicating success/failure of the 1907 * function. The possible values 1908 * returned by this function are: 1909 * <ul> 1910 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1911 * <li> {@link libsbmlConstants#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION} 1912 * 1913 * </ul> <p> 1914 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1915 * setPackageRequired(String, boolean) 1916 </div> 1917 * */ public 1918 int setPkgRequired(String arg0, boolean flag) { 1919 return libsbmlJNI.SBMLDocument_setPkgRequired(swigCPtr, this, arg0, flag); 1920 } 1921 1922 1923/** 1924 * Returns the <code>required</code> attribute of the given package 1925 * extension. 1926 <p> 1927 * @note The name of package must not be given if the package is not 1928 * enabled. 1929 <p> 1930 * @param package the name or URI of the package extension. 1931 <p> 1932 * @return a Boolean value indicating whether the package is flagged as 1933 * being required in this SBML document. 1934 <p> 1935 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1936 * getPackageRequired(String) 1937 </div> 1938 * */ public 1939 boolean getPkgRequired(String arg0) { 1940 return libsbmlJNI.SBMLDocument_getPkgRequired(swigCPtr, this, arg0); 1941 } 1942 1943 1944/** 1945 * Returns <code>true</code> if the required attribute of the given package extension 1946 * is defined, otherwise returns <code>false.</code> 1947 <p> 1948 * @note The name of package must not be given if the package is not 1949 * enabled. 1950 <p> 1951 * @param package the name or URI of the package extension. 1952 <p> 1953 * @return a Boolean value. 1954 <p> 1955 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1956 * isSetPackageRequired(String) 1957 </div> 1958 * */ public 1959 boolean isSetPkgRequired(String arg0) { 1960 return libsbmlJNI.SBMLDocument_isSetPkgRequired(swigCPtr, this, arg0); 1961 } 1962 1963 1964/** 1965 * Returns <code>true</code> if the given package extension is one of ignored 1966 * packages, otherwise returns <code>false.</code> 1967 <p> 1968 * An ignored package is one that is defined to be used in this SBML 1969 * document, but the package is not enabled in this copy of libSBML. 1970 <p> 1971 * @param pkgURI the URI of the package extension. 1972 <p> 1973 * @return a boolean indicating whether the given package is being ignored. 1974 <p> 1975 * @deprecated <div class='deprecated'>Replaced in libSBML 5.2.0 by 1976 * isIgnoredPackage(String) 1977 </div> 1978 * */ public 1979 boolean isIgnoredPkg(String pkgURI) { 1980 return libsbmlJNI.SBMLDocument_isIgnoredPkg(swigCPtr, this, pkgURI); 1981 } 1982 1983 1984/** * @internal */ public 1985 short getApplicableValidators() { 1986 return libsbmlJNI.SBMLDocument_getApplicableValidators(swigCPtr, this); 1987 } 1988 1989 1990/** * @internal */ public 1991 short getConversionValidators() { 1992 return libsbmlJNI.SBMLDocument_getConversionValidators(swigCPtr, this); 1993 } 1994 1995 1996/** * @internal */ public 1997 void setApplicableValidators(short appl) { 1998 libsbmlJNI.SBMLDocument_setApplicableValidators(swigCPtr, this, appl); 1999 } 2000 2001 2002/** * @internal */ public 2003 void setConversionValidators(short appl) { 2004 libsbmlJNI.SBMLDocument_setConversionValidators(swigCPtr, this, appl); 2005 } 2006 2007 2008/** * @internal */ public 2009 long getNumValidators() { 2010 return libsbmlJNI.SBMLDocument_getNumValidators(swigCPtr, this); 2011 } 2012 2013 2014/** * @internal */ public 2015 int clearValidators() { 2016 return libsbmlJNI.SBMLDocument_clearValidators(swigCPtr, this); 2017 } 2018 2019 2020/** * @internal */ public 2021 int addValidator(SBMLValidator validator) { 2022 return libsbmlJNI.SBMLDocument_addValidator(swigCPtr, this, SBMLValidator.getCPtr(validator), validator); 2023 } 2024 2025 2026/** * @internal */ public 2027 SBMLValidator getValidator(long index) { 2028 long cPtr = libsbmlJNI.SBMLDocument_getValidator(swigCPtr, this, index); 2029 return (cPtr == 0) ? null : new SBMLValidator(cPtr, false); 2030 } 2031 2032 2033/** * @internal */ public 2034 int addUnknownPackageRequired(String pkgURI, String prefix, boolean flag) { 2035 return libsbmlJNI.SBMLDocument_addUnknownPackageRequired(swigCPtr, this, pkgURI, prefix, flag); 2036 } 2037 2038 2039/** * @internal */ public 2040 boolean hasUnknownPackage(String pkgURI) { 2041 return libsbmlJNI.SBMLDocument_hasUnknownPackage(swigCPtr, this, pkgURI); 2042 } 2043 2044 2045/** * @internal */ public 2046 int getNumUnknownPackages() { 2047 return libsbmlJNI.SBMLDocument_getNumUnknownPackages(swigCPtr, this); 2048 } 2049 2050 2051/** * @internal */ public 2052 String getUnknownPackageURI(int index) { 2053 return libsbmlJNI.SBMLDocument_getUnknownPackageURI(swigCPtr, this, index); 2054 } 2055 2056 2057/** * @internal */ public 2058 String getUnknownPackagePrefix(int index) { 2059 return libsbmlJNI.SBMLDocument_getUnknownPackagePrefix(swigCPtr, this, index); 2060 } 2061 2062}