Package org.biopax.paxtools.io
Class BioPAXIOHandlerAdapter
java.lang.Object
org.biopax.paxtools.io.BioPAXIOHandlerAdapter
- All Implemented Interfaces:
BioPAXIOHandler
- Direct Known Subclasses:
SimpleIOHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected EditorMapprotected BioPAXFactoryprotected BioPAXLevelprotected static final Stringprotected static final Stringprotected static final Stringprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbindValue(String valueString, PropertyEditor editor, BioPAXElement bpe, Model model) This method binds the value to the bpe.Reads a BioPAX model from an OWL file input stream (in) and converts it to a model.voidconvertToOWL(Model model, OutputStream outputStream, String... ids) Similar toBioPAXIOHandler.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.protected voidcreateAndAdd(Model model, String id, String localName) This method is called by the reader for each OWL instance in the OWL model.protected abstract voidcreateAndBind(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.voidfixReusedPEPs(boolean fixReusedPEPs) Enables (true) or disables (false) the fixing of reused peps.getLevel()protected StringPropertyEditorPaxtools maps BioPAX:comment (L3) and BioPAX:COMMENT (L2) to rdf:comment.protected ReusedPEPHelperThis is a helper class initialized only if fixReusedPEPs is true.protected abstract voidinit(InputStream in) This method provides a hook for the implementers of this abstract class to perform the initial reading from the input stream.booleanWorkaround for a very common Level 2 issue.This method provides a hook for the implementers of this abstract class to set the namespaces of the model.protected voidreset(InputStream in) protected abstract voidUpdates the member EditorMap for the new BioPAX level and factory (different implementations of EditorMap can be used in modules, e.g.protected final voidresetLevel(BioPAXLevel level, BioPAXFactory factory) Updates the level and factory for this I/O (final - because used in the constructor)protected ObjectresourceFixes(BioPAXElement bpe, Object value) This method currently only fixes reusedPEPs if the option is set.voidsetEditorMap(EditorMap editorMap) voidsetFactory(BioPAXFactory factory) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.biopax.paxtools.io.BioPAXIOHandler
convertToOWL
-
Field Details
-
level
-
factory
-
editorMap
-
namespaces
-
rdf
- See Also:
-
rdfs
- See Also:
-
bp
-
xsd
- See Also:
-
owl
- See Also:
-
base
-
-
Constructor Details
-
BioPAXIOHandlerAdapter
public BioPAXIOHandlerAdapter() -
BioPAXIOHandlerAdapter
-
BioPAXIOHandlerAdapter
-
-
Method Details
-
resetLevel
Updates the level and factory for this I/O (final - because used in the constructor)- Parameters:
level- BioPAX Levelfactory- 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:
fixReusedPEPsin interfaceBioPAXIOHandler- Parameters:
fixReusedPEPs- true if fixing is desired- See Also:
-
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:
isFixReusedPEPsin interfaceBioPAXIOHandler- Returns:
- true if this Handler automatically splits reused PEPs to interaction specific PEPS.
-
getReusedPEPHelper
This is a helper class initialized only if fixReusedPEPs is true.- Returns:
- helper object
-
getFactory
- Specified by:
getFactoryin interfaceBioPAXIOHandler- Returns:
- the factory that is used to create new BioPAX POJOs during a BioPAXIOHandler operation.
-
setFactory
- Specified by:
setFactoryin interfaceBioPAXIOHandler- Parameters:
factory- used for creating objects
-
getEditorMap
- Specified by:
getEditorMapin interfaceBioPAXIOHandler- Returns:
- EditorMap used for this handler.
-
setEditorMap
- Specified by:
setEditorMapin interfaceBioPAXIOHandler- Parameters:
editorMap- used for this handler.
-
getLevel
- Specified by:
getLevelin interfaceBioPAXIOHandler- Returns:
- The level of the model that is being read.
-
convertFromOWL
Reads a BioPAX model from an OWL file input stream (in) and converts it to a model.- Specified by:
convertFromOWLin interfaceBioPAXIOHandler- Parameters:
in- inputStream from which the model will be read- Returns:
- an empty model in case of invalid input.
-
reset
-
createAndAdd
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 insertedid- of the new object. The model should not contain another object with the same ID.localName- of the class to be instantiated.
-
init
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
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
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
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 boundvalue- to be assigned.- Returns:
- a "fixed" value.
-
bindValue
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 assignededitor- that maps to the propertybpe- to be boundmodel- to be populated.
-
getRDFCommentEditor
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
Similar toBioPAXIOHandler.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 viaBioPAXIOHandlerinterface (e.g.,SimpleIOHandler).- Specified by:
convertToOWLin interfaceBioPAXIOHandler- Parameters:
model- model to be converted into OWL formatoutputStream- output stream into which the output will be writtenids- optional list of "root" element absolute URIs; direct/indirect child objects are auto-exported as well.
-