Class BioPAXIOHandlerAdapter

java.lang.Object
org.biopax.paxtools.io.BioPAXIOHandlerAdapter
All Implemented Interfaces:
BioPAXIOHandler
Direct Known Subclasses:
SimpleIOHandler

public abstract class BioPAXIOHandlerAdapter extends Object implements BioPAXIOHandler
  • Field Details

  • Constructor Details

    • BioPAXIOHandlerAdapter

      public BioPAXIOHandlerAdapter()
    • BioPAXIOHandlerAdapter

      public BioPAXIOHandlerAdapter(BioPAXLevel level)
    • BioPAXIOHandlerAdapter

      public BioPAXIOHandlerAdapter(BioPAXFactory factory, BioPAXLevel level)
  • Method Details

    • resetLevel

      protected final void resetLevel(BioPAXLevel level, BioPAXFactory factory)
      Updates the level and factory for this I/O (final - because used in the constructor)
      Parameters:
      level - BioPAX Level
      factory - concrete BioPAX factory impl.
    • resetEditorMap

      protected abstract void resetEditorMap()
      Updates the member EditorMap for the new BioPAX level and factory (different implementations of EditorMap can be used in modules, e.g. SimpleEditorMap and JenaEditorMap.)
    • fixReusedPEPs

      public void fixReusedPEPs(boolean fixReusedPEPs)
      Enables (true) or disables (false) the fixing of reused peps.
      Specified by:
      fixReusedPEPs in interface BioPAXIOHandler
      Parameters:
      fixReusedPEPs - true if fixing is desired
      See Also:
      • fixReusedPEPs
    • isFixReusedPEPs

      public boolean isFixReusedPEPs()
      Workaround for a very common Level 2 issue. Most level2 exports in the past reused PhysicalEntityParticipants as if they represent states. This is problematic because PEPs also contain stoichiometry information which is specific to a reaction. BioPAX spec says that PEPs should not be reused across reactions. As Level2 exports getting obsolete this method is slated for deprecation.
      Specified by:
      isFixReusedPEPs in interface BioPAXIOHandler
      Returns:
      true if this Handler automatically splits reused PEPs to interaction specific PEPS.
    • getReusedPEPHelper

      protected ReusedPEPHelper getReusedPEPHelper()
      This is a helper class initialized only if fixReusedPEPs is true.
      Returns:
      helper object
    • getFactory

      public BioPAXFactory getFactory()
      Specified by:
      getFactory in interface BioPAXIOHandler
      Returns:
      the factory that is used to create new BioPAX POJOs during a BioPAXIOHandler operation.
    • setFactory

      public void setFactory(BioPAXFactory factory)
      Specified by:
      setFactory in interface BioPAXIOHandler
      Parameters:
      factory - used for creating objects
    • getEditorMap

      public EditorMap getEditorMap()
      Specified by:
      getEditorMap in interface BioPAXIOHandler
      Returns:
      EditorMap used for this handler.
    • setEditorMap

      public void setEditorMap(EditorMap editorMap)
      Specified by:
      setEditorMap in interface BioPAXIOHandler
      Parameters:
      editorMap - used for this handler.
    • getLevel

      public BioPAXLevel getLevel()
      Specified by:
      getLevel in interface BioPAXIOHandler
      Returns:
      The level of the model that is being read.
    • convertFromOWL

      public Model convertFromOWL(InputStream in)
      Reads a BioPAX model from an OWL file input stream (in) and converts it to a model.
      Specified by:
      convertFromOWL in interface BioPAXIOHandler
      Parameters:
      in - inputStream from which the model will be read
      Returns:
      an empty model in case of invalid input.
    • reset

      protected void reset(InputStream in)
    • createAndAdd

      protected void createAndAdd(Model model, String id, String localName)
      This method is called by the reader for each OWL instance in the OWL model. It creates a POJO instance, with the given id and inserts it into the model. The inserted object is "clean" in the sense that its properties are not set yet. Implementers of this abstract class can override this method to inject code during object creation.
      Parameters:
      model - to be inserted
      id - of the new object. The model should not contain another object with the same ID.
      localName - of the class to be instantiated.
    • init

      protected abstract void init(InputStream in)
      This method provides a hook for the implementers of this abstract class to perform the initial reading from the input stream.
      Parameters:
      in - BioPAX RDF/XML input stream
    • readNameSpaces

      protected abstract Map<String,String> readNameSpaces()
      This method provides a hook for the implementers of this abstract class to set the namespaces of the model.
      Returns:
      a map of namespaces.
    • createAndBind

      protected abstract void createAndBind(Model model)
      This method provides a hook for the implementers of this abstract class to create objects themselves and bind the properties to the objects.
      Parameters:
      model - to be populated
    • resourceFixes

      protected Object resourceFixes(BioPAXElement bpe, Object value)
      This method currently only fixes reusedPEPs if the option is set. As L2 is becoming obsolete this method will be slated for deprecation.
      Parameters:
      bpe - to be bound
      value - to be assigned.
      Returns:
      a "fixed" value.
    • bindValue

      protected void bindValue(String valueString, PropertyEditor editor, BioPAXElement bpe, Model model)
      This method binds the value to the bpe. Actual assignment is handled by the editor - but this method performs most of the workarounds and also error handling due to invalid parameters.
      Parameters:
      valueString - to be assigned
      editor - that maps to the property
      bpe - to be bound
      model - to be populated.
    • getRDFCommentEditor

      protected StringPropertyEditor getRDFCommentEditor(BioPAXElement bpe)
      Paxtools maps BioPAX:comment (L3) and BioPAX:COMMENT (L2) to rdf:comment. This method handles that.
      Parameters:
      bpe - to be bound.
      Returns:
      a property editor responsible for editing comments.
    • convertToOWL

      public void convertToOWL(Model model, OutputStream outputStream, String... ids)
      Similar to BioPAXIOHandler.convertToOWL(org.biopax.paxtools.model.Model, java.io.OutputStream) (org.biopax.paxtools.model.Model, Object)}, but extracts a sub-model, converts it into BioPAX (OWL) format, and writes it into the outputStream. Saved data can be then read via BioPAXIOHandler interface (e.g., SimpleIOHandler).
      Specified by:
      convertToOWL in interface BioPAXIOHandler
      Parameters:
      model - model to be converted into OWL format
      outputStream - output stream into which the output will be written
      ids - optional list of "root" element absolute URIs; direct/indirect child objects are auto-exported as well.