From 4df06fdc4b29086611d473ba524809cbd55ef152 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Tue, 16 Oct 2007 12:37:27 +0000 Subject: [PATCH] SBML translator now complains at anything but Level 1 files. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@449 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/prism/SBML2Prism.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/prism/src/prism/SBML2Prism.java b/prism/src/prism/SBML2Prism.java index 63e3b8a1..06760844 100644 --- a/prism/src/prism/SBML2Prism.java +++ b/prism/src/prism/SBML2Prism.java @@ -61,7 +61,7 @@ public class SBML2Prism implements EntityResolver new SBML2Prism().load(new File(args[0]), (args.length>1)?args[1]:"100"); } catch (PrismException e) { - System.err.println("Error: "+e.getMessage()); + System.err.println("Error: "+e.getMessage()+"."); } } @@ -81,6 +81,7 @@ public class SBML2Prism implements EntityResolver catch (NumberFormatException e) { throw new PrismException("Invalid max amount \""+maxAmount+"\""); } Document doc = parseSBML(f); extractModelFromSBML(doc); + checkSBMLVersion(doc); //printModel(System.err); processModel(); printPRISMModel(f); @@ -154,6 +155,19 @@ public class SBML2Prism implements EntityResolver return inputSource; } + // Check that we can handle whatever level/version this file is + + private void checkSBMLVersion(Document doc) throws PrismException + { + String level, s; + + level = doc.getDocumentElement().getAttribute("level"); + if (!("2".equals(level))) { + s = "The translator only handles Level 2 SBML files - this is a Level "+level+" file"; + throw new PrismException(s); + } + } + // Extract the information about the model from the parsed SBML file private void extractModelFromSBML(Document doc) throws PrismException