Examples of SBMLErrorLog

@author Nicolas Rodriguez @since 0.8 @version $Rev: 1533 $

Examples of org.sbml.jsbml.SBMLErrorLog

    parameters.put("output", output);
    parameters.put("offcheck", offcheck);

    System.out.println("Validating  " + filename + "\n");

    SBMLErrorLog sbmlErrorLog = checkConsistency(filename, parameters);
   
    System.out.println("There is " + sbmlErrorLog.getErrorCount() + " errors in the model.\n");
   
    // printErrors
    for (int j = 0; j < sbmlErrorLog.getErrorCount(); j++) {
      SBMLError error = sbmlErrorLog.getError(j);
     
      System.out.println(error.toString() + "\n");
    }
  }
View Full Code Here

Examples of org.sbml.jsbml.SBMLErrorLog

  public static SBMLErrorLog checkConsistency(String xmlValidationString)
  {
    Logger logger = Logger.getLogger(SBMLValidator.class);

    if (xmlValidationString == null || xmlValidationString.trim().length() == 0) {
      return new SBMLErrorLog();
    }

    StringReader reader = new StringReader(xmlValidationString);

    // DEBUG
    logger.debug(xmlValidationString);     

    // Defining all the rules to parse the XML
    XStream xstream = new XStream(new DomDriver()); // To parse XML using DOM
    // XStream xstream = new XStream(new StaxDriver()); // To parse XML using Stax

    xstream.alias("validation-results", SBMLErrorLog.class);
    xstream.alias("option", Option.class);
    xstream.alias("problem", SBMLError.class);
    xstream.alias("location", Location.class);
    xstream.alias("detail", Detail.class);
    // xstream.registerConverter(new MessageConverter(), XStream.PRIORITY_VERY_HIGH);
    xstream.registerLocalConverter(SBMLError.class, "message", new MessageConverter("message"));
    xstream.registerLocalConverter(SBMLError.class, "shortmessage", new MessageConverter("shortmessage"));
   
    xstream.alias("message", Message.class);
    xstream.alias("shortmessage", Message.class);

    xstream.addImplicitCollection(SBMLErrorLog.class, "options",
        "option", Option.class);
    xstream.addImplicitCollection(SBMLErrorLog.class,
        "validationErrors", "problem", SBMLError.class);

    xstream.aliasField("error", SBMLErrorLog.class, "status");
    xstream.aliasField("warning", SBMLErrorLog.class, "status");
    xstream.aliasField("no-errors", SBMLErrorLog.class, "status");
    xstream.aliasField("file-not-readable", SBMLErrorLog.class, "status");
    xstream.aliasField("out-of-memory", SBMLErrorLog.class, "status");
    xstream.aliasField("segmentation-fault", SBMLErrorLog.class, "status");
    xstream.aliasField("internal-error", SBMLErrorLog.class, "status");

    xstream.useAttributeFor(File.class);

    xstream.useAttributeFor(Option.class, "name");
    xstream.useAttributeFor(Option.class, "status");

    xstream.useAttributeFor(SBMLError.class, "category");
    xstream.useAttributeFor(SBMLError.class, "code");
    xstream.useAttributeFor(SBMLError.class, "severity");

    xstream.useAttributeFor(Location.class, "line");
    xstream.useAttributeFor(Location.class, "column");

    xstream.useAttributeFor(Detail.class, "category");
    xstream.useAttributeFor(Detail.class, "severity");

    try {
      SBMLErrorLog sbmlErrorLog = (SBMLErrorLog) xstream.fromXML(reader);

      logger.debug("Call and Parsing of the results done !!!");

      // logger.debug("File = " + resultsObj.getFile().getName());

      // logger.debug("Nb Options = " + resultsObj.getOptions().size());
      // logger.debug(resultsObj.getOptions());

      logger.debug("Nb Problems = "  + sbmlErrorLog.getValidationErrors().size());

      if (sbmlErrorLog.getValidationErrors().size() > 0) {
        logger.debug("ValidationError(0) = "  + sbmlErrorLog.getValidationErrors().get(0));
      }

      return sbmlErrorLog;
    } catch (XStreamException e) {
      logger.error("There has been an error parsing the consistency check XML result: " + e.getMessage());
     
      if (logger.isDebugEnabled()) {
        e.printStackTrace();
      }
    }

    return new SBMLErrorLog();
  }
View Full Code Here

Examples of org.sbml.jsbml.SBMLErrorLog

    return eList;
  }
 
  /* Validate the SBML and get the resulting ErrorLog */
  public static SBMLErrorLog validateSBML(SBMLDocument doc) throws SBMLException, XMLStreamException{
    SBMLErrorLog eLog = null;
    try {
        // Write SBML to temp file for validation
        File temp = File.createTempFile(CySBML.NAME, ".tmp");
        temp.deleteOnExit();
        SBMLWriter.write(doc, temp, CySBML.NAME, CySBML.VERSION, ' ' , (short) 2);
View Full Code Here

Examples of org.sbml.jsbml.SBMLErrorLog

    parameters.put("output", output);
    parameters.put("offcheck", offcheck);

    System.out.println("Validating  " + filename + "\n");

    SBMLErrorLog sbmlErrorLog = checkConsistency(filename, parameters);
   
    System.out.println("There is " + sbmlErrorLog.getNumErrors() + " errors in the model.\n");
   
    // printErrors
    for (int j = 0; j < sbmlErrorLog.getNumErrors(); j++) {
      SBMLError error = sbmlErrorLog.getError(j);
     
      System.out.println(error.toString() + "\n");
    }
  }
View Full Code Here

Examples of org.sbml.jsbml.SBMLErrorLog

  public static SBMLErrorLog checkConsistency(String xmlValidationString)
  {
    Logger logger = Logger.getLogger(SBMLValidator.class);

    if (xmlValidationString == null || xmlValidationString.trim().length() == 0) {
      return new SBMLErrorLog();
    }

    StringReader reader = new StringReader(xmlValidationString);

    // DEBUG
    logger.debug(xmlValidationString);     

    // Defining all the rules to parse the XML
    XStream xstream = new XStream(new DomDriver()); // To parse XML using DOM
    // XStream xstream = new XStream(new StaxDriver()); // To parse XML using Stax

    xstream.alias("validation-results", SBMLErrorLog.class);
    xstream.alias("option", Option.class);
    xstream.alias("problem", SBMLError.class);
    xstream.alias("location", Location.class);
    xstream.alias("detail", Detail.class);
    // xstream.registerConverter(new MessageConverter(), XStream.PRIORITY_VERY_HIGH);
    xstream.registerLocalConverter(SBMLError.class, "message", new MessageConverter("message"));
    xstream.registerLocalConverter(SBMLError.class, "shortmessage", new MessageConverter("shortmessage"));
   
    xstream.alias("message", Message.class);
    xstream.alias("shortmessage", Message.class);

    xstream.addImplicitCollection(SBMLErrorLog.class, "options",
        "option", Option.class);
    xstream.addImplicitCollection(SBMLErrorLog.class,
        "validationErrors", "problem", SBMLError.class);

    xstream.aliasField("error", SBMLErrorLog.class, "status");
    xstream.aliasField("warning", SBMLErrorLog.class, "status");
    xstream.aliasField("no-errors", SBMLErrorLog.class, "status");
    xstream.aliasField("file-not-readable", SBMLErrorLog.class, "status");
    xstream.aliasField("out-of-memory", SBMLErrorLog.class, "status");
    xstream.aliasField("segmentation-fault", SBMLErrorLog.class, "status");
    xstream.aliasField("internal-error", SBMLErrorLog.class, "status");

    xstream.useAttributeFor(File.class);

    xstream.useAttributeFor(Option.class, "name");
    xstream.useAttributeFor(Option.class, "status");

    xstream.useAttributeFor(SBMLError.class, "category");
    xstream.useAttributeFor(SBMLError.class, "code");
    xstream.useAttributeFor(SBMLError.class, "severity");

    xstream.useAttributeFor(Location.class, "line");
    xstream.useAttributeFor(Location.class, "column");

    xstream.useAttributeFor(Detail.class, "category");
    xstream.useAttributeFor(Detail.class, "severity");

    try {
      SBMLErrorLog sbmlErrorLog = (SBMLErrorLog) xstream.fromXML(reader);

      logger.debug("Call and Parsing of the results done !!!");

      // logger.debug("File = " + resultsObj.getFile().getName());

      // logger.debug("Nb Options = " + resultsObj.getOptions().size());
      // logger.debug(resultsObj.getOptions());

      logger.debug("Nb Problems = "  + sbmlErrorLog.getValidationErrors().size());

      if (sbmlErrorLog.getValidationErrors().size() > 0) {
        logger.debug("ValidationError(0) = "  + sbmlErrorLog.getValidationErrors().get(0));
      }

      return sbmlErrorLog;
    } catch (XStreamException e) {
      logger.error("There has been an error parsing the consistency check XML result : " + e.getMessage());
     
      if (logger.isDebugEnabled()) {
        e.printStackTrace();
      }
    }

    return new SBMLErrorLog();
  }
View Full Code Here

Examples of org.sbml.jsbml.SBMLErrorLog

    parameters.put("output", output);
    parameters.put("offcheck", offcheck);

    System.out.println("Validating  " + filename + "\n");

    SBMLErrorLog sbmlErrorLog = checkConsistency(filename, parameters);
   
    System.out.println("There is " + sbmlErrorLog.getNumErrors() + " errors in the model.\n");
   
    // printErrors
    for (int j = 0; j < sbmlErrorLog.getNumErrors(); j++) {
      SBMLError error = sbmlErrorLog.getError(j);
     
      System.out.println(error.toString() + "\n");
    }
  }
View Full Code Here

Examples of org.sbml.jsbml.SBMLErrorLog

  public static SBMLErrorLog checkConsistency(String xmlValidationString)
  {
    Logger logger = Logger.getLogger(SBMLValidator.class);

    if (xmlValidationString == null || xmlValidationString.trim().length() == 0) {
      return new SBMLErrorLog();
    }

    StringReader reader = new StringReader(xmlValidationString);

    // DEBUG
    logger.debug(xmlValidationString);     

    // Defining all the rules to parse the XML
    XStream xstream = new XStream(new DomDriver()); // To parse XML using DOM
    // XStream xstream = new XStream(new StaxDriver()); // To parse XML using Stax

    xstream.alias("validation-results", SBMLErrorLog.class);
    xstream.alias("option", Option.class);
    xstream.alias("problem", SBMLError.class);
    xstream.alias("location", Location.class);
    xstream.alias("detail", Detail.class);
    // xstream.registerConverter(new MessageConverter(), XStream.PRIORITY_VERY_HIGH);
    xstream.registerLocalConverter(SBMLError.class, "message", new MessageConverter("message"));
    xstream.registerLocalConverter(SBMLError.class, "shortmessage", new MessageConverter("shortmessage"));
   
    xstream.alias("message", Message.class);
    xstream.alias("shortmessage", Message.class);

    xstream.addImplicitCollection(SBMLErrorLog.class, "options",
        "option", Option.class);
    xstream.addImplicitCollection(SBMLErrorLog.class,
        "validationErrors", "problem", SBMLError.class);

    xstream.aliasField("error", SBMLErrorLog.class, "status");
    xstream.aliasField("warning", SBMLErrorLog.class, "status");
    xstream.aliasField("no-errors", SBMLErrorLog.class, "status");
    xstream.aliasField("file-not-readable", SBMLErrorLog.class, "status");
    xstream.aliasField("out-of-memory", SBMLErrorLog.class, "status");
    xstream.aliasField("segmentation-fault", SBMLErrorLog.class, "status");
    xstream.aliasField("internal-error", SBMLErrorLog.class, "status");

    xstream.useAttributeFor(File.class);

    xstream.useAttributeFor(Option.class, "name");
    xstream.useAttributeFor(Option.class, "status");

    xstream.useAttributeFor(SBMLError.class, "category");
    xstream.useAttributeFor(SBMLError.class, "code");
    xstream.useAttributeFor(SBMLError.class, "severity");

    xstream.useAttributeFor(Location.class, "line");
    xstream.useAttributeFor(Location.class, "column");

    xstream.useAttributeFor(Detail.class, "category");
    xstream.useAttributeFor(Detail.class, "severity");

    try {
      SBMLErrorLog sbmlErrorLog = (SBMLErrorLog) xstream.fromXML(reader);

      logger.debug("Call and Parsing of the results done !!!");

      // logger.debug("File = " + resultsObj.getFile().getName());

      // logger.debug("Nb Options = " + resultsObj.getOptions().size());
      // logger.debug(resultsObj.getOptions());

      logger.debug("Nb Problems = "  + sbmlErrorLog.getValidationErrors().size());

      if (sbmlErrorLog.getValidationErrors().size() > 0) {
        logger.debug("ValidationError(0) = "  + sbmlErrorLog.getValidationErrors().get(0));
      }

      return sbmlErrorLog;
    } catch (XStreamException e) {
      logger.error("There has been an error parsing the consistency check XML result : " + e.getMessage());
     
      if (logger.isDebugEnabled()) {
        e.printStackTrace();
      }
    }

    return new SBMLErrorLog();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.