-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented the methods in SBMLDocument that are dealing with validat…
…ing the SBML model. Anyway, the overall checkConsistency is not working anymore but the code in SBMLDocument should be fine now + added a test to easily try to validate a model
- Loading branch information
1 parent
f274cae
commit a096664
Showing
3 changed files
with
143 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.sbml.jsbml.test; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
|
||
import javax.xml.stream.XMLStreamException; | ||
|
||
import org.sbml.jsbml.SBMLDocument; | ||
import org.sbml.jsbml.SBMLReader; | ||
|
||
public class ValidateSBML { | ||
|
||
public static void main (String[] args) throws FileNotFoundException, XMLStreamException | ||
{ | ||
if (args.length < 1) | ||
{ | ||
System.out.println("Usage: java validateSBML filename"); | ||
System.exit(1); | ||
} | ||
|
||
String filename = args[0]; | ||
SBMLReader reader = new SBMLReader(); | ||
SBMLDocument document; | ||
long start, stop; | ||
|
||
start = System.currentTimeMillis(); | ||
document = reader.readSBML(filename); | ||
stop = System.currentTimeMillis(); | ||
|
||
if (document.getNumErrors() > 0) | ||
{ | ||
print("Encountered the following errors while reading the SBML file:\n"); | ||
document.printErrors(); | ||
print("\nFurther consistency checking and validation aborted.\n"); | ||
System.exit(1); | ||
} | ||
else | ||
{ | ||
long errors = document.checkConsistency(); | ||
long size = new File(filename).length(); | ||
|
||
println(" filename: " + filename); | ||
println(" file size: " + size); | ||
println(" read time (ms): " + (stop - start)); | ||
println(" validation error(s): " + errors); | ||
|
||
if (errors > 0) | ||
{ | ||
document.printErrors(); | ||
System.exit(1); | ||
} | ||
} | ||
} | ||
|
||
|
||
static void print (String msg) | ||
{ | ||
System.out.print(msg); | ||
} | ||
|
||
static void println (String msg) | ||
{ | ||
System.out.println(msg); | ||
} | ||
|
||
} |