Package org.biopax.paxtools.impl
Class ModelImpl
java.lang.Object
org.biopax.paxtools.impl.ModelImpl
- All Implemented Interfaces:
Serializable,Model
This is the default implementation of the
Model. Use a factory to create a model.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedModelImpl(BioPAXFactory factory) protectedModelImpl(BioPAXLevel level) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(BioPAXElement aBioPAXElement) This method adds the given object to this model.<T extends BioPAXElement>
TThis method creates a new object using the model's factory, adds it to the model and returns it.booleancontains(BioPAXElement aBioPAXElement) This method returns true if given element is the same object ("==") as the object stored in the model usually (for self-consistent models) but not necessarily under the element's ID.booleancontainsID(String id) This method checks for the biopax element with the given id, returns true if the object with the given id exists.This method returns the biopax element with the given id, returns null if the object with the given id does not exist in this model.getLevel()This method returns the level of the objects that are contained within this model.getName()URI of this BioPAX Model.This method returns a map of name space prefixes.This method returns a set of objects in the model.<T extends BioPAXElement>
Set<T> getObjects(Class<T> filterBy) This method returns a set of objects in the model of the given class.getUri()URI of this BioPAX Model.Gets the model's xml:base (URI prefix/namespace), which normally the majority of the BioPAX object's absolute URIs in the model begin with.booleanWhen addDependencies is false, the model will not check for the dependent objects of a newly added object.voidThis is default implementation that uses the id-based merging (SimpleMerger.merge(Model, Model...)) NOTE: some applications, such as those dealing with persistence/transactions or advanced BioPAX alignment/comparison algorithms (like the Patch), may have to implement and use a more specific method instead.voidremove(BioPAXElement aBioPAXElement) This method removes the given BioPAX Element from the model.voidrepair()This implementation "repairs" the model without unnecessarily copying objects: - recursively adds lost "children" (not null object property values for whichModel.contains(BioPAXElement)returns False) - updates object properties (should refer to model's elements)voidreplace(BioPAXElement existing, BioPAXElement replacement) It does not automatically replace or clean up the old element's object properties, therefore, some child elements may become "dangling" if they were used by the replaced element only.voidsetAddDependencies(boolean value) When set to false, the model will not check for the dependent objects of a newly added object.voidsetFactory(BioPAXFactory factory) This method sets the factory this model will use for creating BioPAX objects.voidvoidvoidsetXmlBase(String base) Sets the xml:base to use when exporting a BioPAX model.
-
Field Details
-
idMap
-
-
Constructor Details
-
ModelImpl
protected ModelImpl() -
ModelImpl
-
ModelImpl
-
-
Method Details
-
containsID
Description copied from interface:ModelThis method checks for the biopax element with the given id, returns true if the object with the given id exists. in this model.- Specified by:
containsIDin interfaceModel- Parameters:
id- of the object to be retrieved.- Returns:
- biopax element with the given id.
-
getByID
Description copied from interface:ModelThis method returns the biopax element with the given id, returns null if the object with the given id does not exist in this model. -
getNameSpacePrefixMap
Description copied from interface:ModelThis method returns a map of name space prefixes. This map can be modified.- Specified by:
getNameSpacePrefixMapin interfaceModel- Returns:
- a map, mapping prefixes to full namespaces.
-
setFactory
Description copied from interface:ModelThis method sets the factory this model will use for creating BioPAX objects. For exampleModel.addNew(Class, String)method uses this factory.- Specified by:
setFactoryin interfaceModel- Parameters:
factory- this model will use for creating BioPAX objects.
-
getObjects
Description copied from interface:ModelThis method returns a set of objects in the model. Contents of this set can not be modified.- Specified by:
getObjectsin interfaceModel- Returns:
- an unmodifiable set of objects.
-
getObjects
Description copied from interface:ModelThis method returns a set of objects in the model of the given class. Contents of this set should not be modified.- Specified by:
getObjectsin interfaceModel- Type Parameters:
T- a BioPAX type- Parameters:
filterBy- class to be used as a filter.- Returns:
- an unmodifiable set of objects of the given class.
-
remove
Description copied from interface:ModelThis method removes the given BioPAX Element from the model. Other objects in the model can still point to this object. It is user's responsibility to properly excise these properties. -
addNew
Description copied from interface:ModelThis method creates a new object using the model's factory, adds it to the model and returns it. -
contains
This method returns true if given element is the same object ("==") as the object stored in the model usually (for self-consistent models) but not necessarily under the element's ID. -
getUri
Description copied from interface:ModelURI of this BioPAX Model. This can be used in many ways to refer to this model when: - logging; - merging several models; - converting to or from another data format, such as GMT (GSEA); - saving to or reading from RDF/XML file (e.g., save/read a special Provenance object) -
setUri
-
getName
Description copied from interface:ModelURI of this BioPAX Model. This can be used in many ways; seeModel.getUri(). -
setName
-
add
Description copied from interface:ModelThis method adds the given object to this model. If the object points to other objects that are not in the model, it is user's responsibility to add them into the model as well. If an object with the same id already exists, it will throw anIllegalBioPAXArgumentException -
getLevel
Description copied from interface:ModelThis method returns the level of the objects that are contained within this model. -
setAddDependencies
public void setAddDependencies(boolean value) Description copied from interface:ModelWhen set to false, the model will not check for the dependent objects of a newly added object. When true it will traverse and add all dependent objects that are not already in the model. This feature is currently experimental.- Specified by:
setAddDependenciesin interfaceModel- Parameters:
value- defining the dependency adding behaviour
-
isAddDependencies
public boolean isAddDependencies()Description copied from interface:ModelWhen addDependencies is false, the model will not check for the dependent objects of a newly added object. When true it will traverse and add all dependent objects that are not already in the model. This feature is currently experimental.- Specified by:
isAddDependenciesin interfaceModel- Returns:
- whether adding dependencies.
-
replace
It does not automatically replace or clean up the old element's object properties, therefore, some child elements may become "dangling" if they were used by the replaced element only. Can also clear object properties (- replace with null). -
merge
This is default implementation that uses the id-based merging (SimpleMerger.merge(Model, Model...)) NOTE: some applications, such as those dealing with persistence/transactions or advanced BioPAX alignment/comparison algorithms (like the Patch), may have to implement and use a more specific method instead. -
repair
public void repair()This implementation "repairs" the model without unnecessarily copying objects: - recursively adds lost "children" (not null object property values for whichModel.contains(BioPAXElement)returns False) - updates object properties (should refer to model's elements) -
setXmlBase
Description copied from interface:ModelSets the xml:base to use when exporting a BioPAX model. Usually, is is a data-provider's URI prefix, e.g., xml:base="http://www.pantherdb.org/pathways/biopax#" Setting this to null makes the exporter print using absolute URIs (and rdf:about) instead of relative ones (and rdf:ID).- Specified by:
setXmlBasein interfaceModel- Parameters:
base- a URI prefix or null.
-
getXmlBase
Description copied from interface:ModelGets the model's xml:base (URI prefix/namespace), which normally the majority of the BioPAX object's absolute URIs in the model begin with. Note: it's not required that all the BioPAX objects in the model have the same URI prefix/namespace; e.g., there are can be (and perfectly legal) objects that use other URI bases, such as http://identifiers.org/, http://purl.org/, etc. (- usually these are well-known standard xml bases, or these result from merging several BioPAX models of different data providers into one model.)- Specified by:
getXmlBasein interfaceModel- Returns:
- xml:base value
-