org.biopax.paxtools.controller
Class SimpleMerger

java.lang.Object
  extended by org.biopax.paxtools.controller.SimpleMerger

public class SimpleMerger
extends java.lang.Object

This is a "simple" BioPAX merger, a utility class to merge 'source' BioPAX models or a set of elements into the target model, using the RDFId (URI) identity only. Merging of normalized, self-consistent models normally gives "better" results (though it depends on the application).

One can also "merge" a model to itself, i.e.: merge(target,target), which adds those missing child elements that were not added (explicitly) to the model (via model.add*) and makes it more integral.

Note, "RDFId (URI) identity" means that it skips, i.e., does not copy a source's element to the target (model) nor it updates sources' object properties, if the target already contains the element with the same RDFId. However, after all, it does update (re-wire) all the object properties of just added source elements to make sure they do not refer to the skipped objects (from the "source") anymore (if something is missing, it will be added at this second pass).

Note also that this merger does not guarantee the integrity of the passed models: 'target' will be the merged model (often, "more integral"), and the 'source' may be trashed (in fact, - still somewhat usable, but modified for sure, with some of its object properties now refer to target's 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
SimpleMerger(EditorMap map)
           
 
Method Summary
 void merge(Model target, BioPAXElement source)
          Merges the source element (and its "downstream" dependents) into target model if its RDFId is not yet there.
 void merge(Model target, java.util.Collection<? extends BioPAXElement> elements)
          Merges the elements into target model.
 void merge(Model target, Model... sources)
          Merges the source models into target model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMerger

public SimpleMerger(EditorMap map)
Parameters:
map - a class to editor map for the elements to be modified.
Method Detail

merge

public void merge(Model target,
                  Model... sources)
Merges the source models into target model.

Note: both target and source models are not necessarily self-consistent, i.e., they may already contain external and dangling elements...

Parameters:
target - model into which merging process will be done
sources - models, if any, that are going to be merged/updated to target

merge

public void merge(Model target,
                  java.util.Collection<? extends BioPAXElement> elements)
Merges the elements into target model.

Parameters:
target - model into which merging process will be done
elements - elements, if any, that are going to be merged/updated to target

merge

public void merge(Model target,
                  BioPAXElement source)
Merges the source element (and its "downstream" dependents) into target model if its RDFId is not yet there.

Dependents, though, are not explicitly added to the target model, but the corresponding object properties of the element either become magically 'fixed' (point to target's elements if found) or "dangling" (not null though, but still refer to external objects, which simply will be skipped if one exports to OWL using e.g. SimpleIO). The same apply to other merge methods in this class.

Parameters:
target -
source -


Copyright © 2011 BioPAX. All Rights Reserved.