Package org.biopax.paxtools.controller
Class SimpleMerger
java.lang.Object
org.biopax.paxtools.controller.SimpleMerger
A "simple" BioPAX merger, a utility class to merge
'source' BioPAX models or a set of elements into the target model,
using (URI) identity only. Merging into a normalized,
self-integral model normally makes sense and gives better results
(but it depends on the application though).
One can also "merge" a model to itself, i.e.: merge(target,target),
or to an empty one, which adds all implicit child elements
to the model and makes it self-integral.
Note, "URI identity" means that it does not copy
a source element to the target model if the target already has an element
with the same URI. However, it will update (re-wire) all the object
properties of new elements to make sure they do not refer to any objects
outside the updated target model.
We do not guarantee the integrity of the source models after the merge is done
(some object properties will refer to target elements).
Finally, although called Simple Merger, it is in fact an advanced BioPAX utility,
which should be used wisely. Otherwise, it can actually waste resources.
So, consider using model.add(..), model.addNew(..) approach first (or instead),
especially, when you're adding "new" things (ID not present in the target model),
or/and target model does not contain any references to the source or another one, etc.
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleMerger(EditorMap map) SimpleMerger(EditorMap map, Filter<BioPAXElement> mergePropOf) -
Method Summary
Modifier and TypeMethodDescriptionvoidmerge(Model target, Collection<? extends BioPAXElement> elements) Merges the elements and all their child biopax objects into the target model.voidmerge(Model target, BioPAXElement source) Merges the source element (and its "downstream" dependents) into target model.voidMerges the source models into target model, one after another (in the order they are listed).
-
Constructor Details
-
SimpleMerger
- Parameters:
map- a class to editor map for the elements to be modified.
-
SimpleMerger
- Parameters:
map- a class to editor map for the elements to be modified.mergePropOf- when not null, all multiple-cardinality properties of a source biopax object that passes this filter are updated and also copied to the corresponding (same URI) target object, unless the source and target are the same thing (in which case, we simply migrate object properties to target model objects).
-
-
Method Details
-
merge
Merges the source models into target model, one after another (in the order they are listed). If the target model is self-integral (complete) or empty, then the result of the merge will be also a complete model (contain unique objects with unique URIs, all objects referenced from any other object in the model). Source models do not necessarily have to be complete and may even indirectly contain different objects of the same type with the same URI. Though, in most cases, one probably wants target model be complete or empty for the best possible results. So, if your target is incomplete, or you are not quite sure, then do simply merge it as the first source to a new empty model or itself (or callModel.repair()first).- Parameters:
target- model into which merging process will be donesources- models to be merged/updated to target; order can be important
-
merge
Merges the elements and all their child biopax objects into the target model.- Parameters:
target- model into which merging will be doneelements- elements that are going to be merged/updated to target- See Also:
-
merge
Merges the source element (and its "downstream" dependents) into target model.- Parameters:
target- the BioPAX model to merge intosource- object to add or merge- See Also:
-