Menu

#9 Problems retrieving model from URI resource

2.3
open-fixed
None
5
2016-07-24
2016-07-13
No

From Chris Myers
The method to get from a URI resource does not seem to work properly. This fails for me for BIOMD0000000012 found here:

http://svn.code.sf.net/p/libsedml/code/trunk/Samples/sedx-archives/

Related

Bugs: #9

Discussion

  • Richard Adams

    Richard Adams - 2016-07-13
    • status: open --> accepted
    • assigned_to: Richard Adams
     
  • Richard Adams

    Richard Adams - 2016-07-18

    So,there are various implementations of IModelResolver that can load models from BioModels, generic URLs, files or archives.
    The URL in the Sedx file is :
    http://www.ebi.ac.uk/biomodels/models-main/publ/BIOMD0000000012/BIOMD0000000012.xml

    BioModels retreiver just recognises MIRIAM URNs, not URLs.
    Use the URLResourceRetriever for URLs
    This URL is actually used in test URLResourceRetrieverTest#testGetModelXMLReturnSBML() and works fine.

    if you don't know in advance what are the sources of the models, use the ModelRetriever class and register all the IModelRetrieves you think you'll need.

     
    • Chris Myers

      Chris Myers - 2016-07-21

      Here are some more details about this one (see below). I get the document as a String, then when I’m reading the String, I get the exception below. This does not happen though for the biomodelsModelsRetriever.

      I’m using the following code:

      if (model.getSource().startsWith("urn:miriam:biomodels.db")) {
      BioModelsModelsRetriever retriever = new BioModelsModelsRetriever();
      String docStr = retriever.getModelXMLFor(URI.create(model.getSource()));
      SBMLDocument doc = SBMLReader.read(docStr);
      newFile = importSBMLDocument("model",doc);
      } else if (model.getSource().startsWith("http://")) {
      URLResourceRetriever retriever = new URLResourceRetriever();
      String docStr = retriever.getModelXMLFor(URI.create(model.getSource()));
      SBMLDocument doc = SBMLReader.read(docStr);
      newFile = importSBMLDocument("model",doc);
      } else {

      Here is the exception that I get:

      com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character (NULL, unicode 0) encountered: not valid in any content
      at [row,col {unknown-source}]: [179,24]
      at com.ctc.wstx.sr.StreamScanner.constructNullCharException(StreamScanner.java:642)
      at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:672)
      at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:663)
      at com.ctc.wstx.sr.StreamScanner.getNextInCurrAfterWS(StreamScanner.java:891)
      at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3102)
      at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:3036)
      at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2912)
      at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1115)
      at org.codehaus.stax2.ri.Stax2EventReaderImpl.nextEvent(Stax2EventReaderImpl.java:255)
      at org.sbml.jsbml.xml.stax.SBMLReader.readXMLFromXMLEventReader(SBMLReader.java:568)
      at org.sbml.jsbml.xml.stax.SBMLReader.readXMLFromStream(SBMLReader.java:533)
      at org.sbml.jsbml.xml.stax.SBMLReader.readSBMLFromString(SBMLReader.java:834)
      at org.sbml.jsbml.xml.stax.SBMLReader.readSBMLFromString(SBMLReader.java:848)
      at org.sbml.jsbml.SBMLReader.readSBMLFromString(SBMLReader.java:267)
      at org.sbml.jsbml.SBMLReader.read(SBMLReader.java:143)
      at main.Gui.importModels(Gui.java:5427)
      at main.Gui.importSEDMLDocument(Gui.java:5639)
      at main.Gui.importSEDML(Gui.java:5720)
      at main.Gui.actionPerformed(Gui.java:3660)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
      at com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:128)
      at java.awt.MenuItem.processActionEvent(MenuItem.java:669)
      at java.awt.MenuItem.processEvent(MenuItem.java:628)
      at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:351)
      at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:339)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:738)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
      at java.awt.EventQueue$4.run(EventQueue.java:708)
      at java.awt.EventQueue$4.run(EventQueue.java:706)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

      On Jul 18, 2016, at 2:59 PM, Richard Adams otter606@users.sf.net wrote:

      So,there are various implementations of IModelResolver that can load models from BioModels, generic URLs, files or archives.
      The URL in the Sedx file is :
      http://www.ebi.ac.uk/biomodels/models-main/publ/BIOMD0000000012/BIOMD0000000012.xml http://www.ebi.ac.uk/biomodels/models-main/publ/BIOMD0000000012/BIOMD0000000012.xml
      BioModels retreiver just recognises MIRIAM URNs, not URLs.
      Use the URLResourceRetriever for URLs
      This URL is actually used in test URLResourceRetrieverTest#testGetModelXMLReturnSBML() and works fine.

      if you don't know in advance what are the sources of the models, use the ModelRetriever class and register all the IModelRetrieves you think you'll need.

      [bugs:#9] https://sourceforge.net/p/jlibsedml/bugs/9/ Problems retrieving model from URI resource

      Status: accepted
      Group: 2.3
      Created: Wed Jul 13, 2016 09:07 PM UTC by Richard Adams
      Last Updated: Wed Jul 13, 2016 09:19 PM UTC
      Owner: Richard Adams

      From Chris Myers
      The method to get from a URI resource does not seem to work properly. This fails for me for BIOMD0000000012 found here:

      http://svn.code.sf.net/p/libsedml/code/trunk/Samples/sedx-archives/ http://svn.code.sf.net/p/libsedml/code/trunk/Samples/sedx-archives/
      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/jlibsedml/bugs/9/ https://sourceforge.net/p/jlibsedml/bugs/9/
      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #9

  • Richard Adams

    Richard Adams - 2016-07-18

    So not fixing as I think this is a usage issue, not an actual bug

     
  • Richard Adams

    Richard Adams - 2016-07-18
    • status: accepted --> wont-fix
     
  • Richard Adams

    Richard Adams - 2016-07-22

    OK, I could reproduce the error in the sense that XML couldn't be parsed. . Looks like some characters weren't valid XML so have added some code to strip them out, let me know if it works now for you reading into jsbml

     
  • Richard Adams

    Richard Adams - 2016-07-24

    Don't know - the URL is different from that resolved from the URN - which is http://www.ebi.ac.uk/biomodels-main/download?mid=BIOMD0000000012

    which is perhaps the official download site.
    But marking this as fixed

     
  • Richard Adams

    Richard Adams - 2016-07-24
    • status: accepted --> open-fixed