org.biopax.paxtools.io
Class BioPAXIOHandlerAdapter

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

public abstract class BioPAXIOHandlerAdapter
extends java.lang.Object
implements BioPAXIOHandler


Field Summary
protected static java.lang.String bp
           
protected  EditorMap editorMap
           
protected  BioPAXFactory factory
           
protected  BioPAXLevel level
           
protected  java.util.Map<java.lang.String,java.lang.String> namespaces
           
protected static java.lang.String owl
           
protected static java.lang.String rdf
           
protected static java.lang.String rdfs
           
protected static java.lang.String xsd
           
 
Constructor Summary
BioPAXIOHandlerAdapter()
           
BioPAXIOHandlerAdapter(BioPAXFactory factory, BioPAXLevel level)
           
BioPAXIOHandlerAdapter(BioPAXLevel level)
           
 
Method Summary
protected  void bindValue(java.lang.String valueString, PropertyEditor editor, BioPAXElement bpe, Model model)
           
 Model convertFromMultipleOwlFiles(java.lang.String... files)
          This is experimental and is not not complete.
 Model convertFromOWL(java.io.InputStream in)
          Reads a BioPAX model from an OWL file input stream (in) and converts it to a model.
 void convertToOWL(Model model, java.io.OutputStream outputStream, java.lang.String... ids)
          Similar to BioPAXIOHandler#convertToOWL(org.biopax.paxtools .model.Model, Object), but extracts a sub-model, converts it into BioPAX (OWL) format, and writes it into the outputStream.
protected  void createAndAdd(Model model, java.lang.String id, java.lang.String localName)
           
protected abstract  void createAndBind(Model model)
           
 void fixReusedPEPs(boolean fixReusedPEPs)
          Enables (true) or disables (false) the fixing of reused peps.
 EditorMap getEditorMap()
           
 BioPAXFactory getFactory()
           
 BioPAXLevel getLevel()
           
protected  PropertyEditor getRDFCommentEditor(BioPAXElement bpe)
           
 ReusedPEPHelper getReusedPEPHelper()
           
protected abstract  void init(java.io.InputStream in)
           
 boolean isConvertingFromLevel1ToLevel2()
          This flag will allow reader to automatically convert level1 classes to corresponding level 2 classes.
 boolean isFixReusedPEPs()
          This option is only applicable two level 2 models.
 boolean isTreatNilAsNull()
          This flag will fix a common legacy bug from BioCyc where the "NIL" string was used for representing unknown values.
protected  BioPAXElement literalFixes(PropertyEditor editor, BioPAXElement bpe, Model model, java.lang.String value)
           
protected abstract  java.util.Map<java.lang.String,java.lang.String> readNameSpaces()
           
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.
protected  void resetLevel(BioPAXLevel level, BioPAXFactory factory)
           
protected  java.lang.Object resourceFixes(BioPAXElement bpe, java.lang.Object value)
           
 void setConvertingFromLevel1ToLevel2(boolean convertingFromLevel1ToLevel2)
          This flag will allow reader to automatically convert level1 classes to corresponding level 2 classes.
 void setEditorMap(EditorMap editorMap)
           
 void setFactory(BioPAXFactory factory)
           
 void treatNilAsNull(boolean treatNILasNull)
          This flag will fix a common legacy bug from BioCyc where the "NIL" string was used for representing unknown values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biopax.paxtools.io.BioPAXIOHandler
convertToOWL
 

Field Detail

level

protected BioPAXLevel level

factory

protected BioPAXFactory factory

editorMap

protected EditorMap editorMap

namespaces

protected java.util.Map<java.lang.String,java.lang.String> namespaces

rdf

protected static final java.lang.String rdf
See Also:
Constant Field Values

rdfs

protected static final java.lang.String rdfs
See Also:
Constant Field Values

bp

protected static java.lang.String bp

xsd

protected static final java.lang.String xsd
See Also:
Constant Field Values

owl

protected static final java.lang.String owl
See Also:
Constant Field Values
Constructor Detail

BioPAXIOHandlerAdapter

public BioPAXIOHandlerAdapter()

BioPAXIOHandlerAdapter

public BioPAXIOHandlerAdapter(BioPAXLevel level)

BioPAXIOHandlerAdapter

public BioPAXIOHandlerAdapter(BioPAXFactory factory,
                              BioPAXLevel level)
Method Detail

resetLevel

protected void resetLevel(BioPAXLevel level,
                          BioPAXFactory factory)

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

treatNilAsNull

public void treatNilAsNull(boolean treatNILasNull)
Description copied from interface: BioPAXIOHandler
This flag will fix a common legacy bug from BioCyc where the "NIL" string was used for representing unknown values.

Specified by:
treatNilAsNull in interface BioPAXIOHandler

setConvertingFromLevel1ToLevel2

public void setConvertingFromLevel1ToLevel2(boolean convertingFromLevel1ToLevel2)
Description copied from interface: BioPAXIOHandler
This flag will allow reader to automatically convert level1 classes to corresponding level 2 classes.

Specified by:
setConvertingFromLevel1ToLevel2 in interface BioPAXIOHandler

isTreatNilAsNull

public boolean isTreatNilAsNull()
Description copied from interface: BioPAXIOHandler
This flag will fix a common legacy bug from BioCyc where the "NIL" string was used for representing unknown values.

Specified by:
isTreatNilAsNull in interface BioPAXIOHandler
Returns:
true if this option is enabled.

isConvertingFromLevel1ToLevel2

public boolean isConvertingFromLevel1ToLevel2()
Description copied from interface: BioPAXIOHandler
This flag will allow reader to automatically convert level1 classes to corresponding level 2 classes.

Specified by:
isConvertingFromLevel1ToLevel2 in interface BioPAXIOHandler
Returns:
true if this option is enabled.

isFixReusedPEPs

public boolean isFixReusedPEPs()
Description copied from interface: BioPAXIOHandler
This option is only applicable two level 2 models. When enabled it will replicate illegally reused pysicalEntityParticipants in Level2 files.

Specified by:
isFixReusedPEPs in interface BioPAXIOHandler
Returns:
true if this option is enabled.

getReusedPEPHelper

public ReusedPEPHelper getReusedPEPHelper()

getFactory

public BioPAXFactory getFactory()
Specified by:
getFactory in interface BioPAXIOHandler
Returns:
factory used for creating objects

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.

convertFromMultipleOwlFiles

public Model convertFromMultipleOwlFiles(java.lang.String... files)
                                  throws java.io.FileNotFoundException
This is experimental and is not not complete. Files have to be given in dependency order. i.e. a former file should not point to the latter. Use it at your own risk.

Specified by:
convertFromMultipleOwlFiles in interface BioPAXIOHandler
Parameters:
files - Dependency ordered biopax owl file names
Returns:
a merged model.
Throws:
java.io.FileNotFoundException - if any file can not be found

convertFromOWL

public Model convertFromOWL(java.io.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.

createAndAdd

protected void createAndAdd(Model model,
                            java.lang.String id,
                            java.lang.String localName)

init

protected abstract void init(java.io.InputStream in)

readNameSpaces

protected abstract java.util.Map<java.lang.String,java.lang.String> readNameSpaces()

createAndBind

protected abstract void createAndBind(Model model)

literalFixes

protected BioPAXElement literalFixes(PropertyEditor editor,
                                     BioPAXElement bpe,
                                     Model model,
                                     java.lang.String value)

resourceFixes

protected java.lang.Object resourceFixes(BioPAXElement bpe,
                                         java.lang.Object value)

bindValue

protected void bindValue(java.lang.String valueString,
                         PropertyEditor editor,
                         BioPAXElement bpe,
                         Model model)

getRDFCommentEditor

protected PropertyEditor getRDFCommentEditor(BioPAXElement bpe)

convertToOWL

public void convertToOWL(Model model,
                         java.io.OutputStream outputStream,
                         java.lang.String... ids)
Similar to BioPAXIOHandler#convertToOWL(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 - the list of "root" element IDs to export (with all their properties/children altogether)
Throws:
java.io.IOException - in case of I/O problems


Copyright © 2011 BioPAX. All Rights Reserved.