@Test public final void testMergeToInconsistentModel() { BioPAXFactory factory = BioPAXLevel.L3.getDefaultFactory(); Model model = factory.createModel(); Xref mref =factory.create(UnificationXref.class, "10090"); mref.setDb("Taxonomy"); mref.setId("10090"); BioSource mouse = model.addNew(BioSource.class, "mouse"); mouse.addXref(mref); assertEquals(1, model.getObjects().size()); Xref href = factory.create(UnificationXref.class, "9606"); href.setDb("Taxonomy"); href.setId("9606"); BioSource human = factory.create(BioSource.class, "human"); human.addXref(href); SimpleMerger merger = new SimpleMerger(SimpleEditorMap.L3); merger.merge(model, human); assertEquals(3, model.getObjects().size()); assertNull(model.getByID("10090")); model = factory.createModel(); mref = factory.create(UnificationXref.class, "ref"); mref.setDb("Taxonomy"); mref.setId("10090"); mouse = model.addNew(BioSource.class, "mouse"); mouse.addXref(mref); href = factory.create(UnificationXref.class, "ref"); href.setDb("Taxonomy"); href.setId("9606"); human = factory.create(BioSource.class, "human"); human.addXref(href); merger.merge(model, human); assertEquals(3, model.getObjects().size()); Xref x = (UnificationXref)model.getByID("ref"); assertNotNull(x); assertEquals("9606", x.getId()); BioSource bs = (BioSource) model.getByID("mouse"); assertNotNull(bs); assertEquals("10090", bs.getXref().iterator().next().getId()); assertEquals("9606", human.getXref().iterator().next().getId()); model = factory.createModel(); mref = model.addNew(UnificationXref.class, "ref"); mref.setDb("Taxonomy"); mref.setId("10090"); mouse = model.addNew(BioSource.class, "mouse"); mouse.addXref(mref); merger.merge(model, human); assertEquals(3, model.getObjects().size()); x = (UnificationXref)model.getByID("ref"); assertNotNull(x); assertEquals("10090", x.getId()); bs = (BioSource) model.getByID("mouse"); assertNotNull(bs); assertEquals("10090", bs.getXref().iterator().next().getId()); assertNotNull(model.getByID("human")); assertEquals("10090", human.getXref().iterator().next().getId()); }
public void merge(Model target, Model... sources) { for (Model source : sources) if (source != null) merge(target, source.getObjects()); }
SimpleMerger { public void merge(Model target, Model... sources) { for (Model source : sources) if (source != null) merge(target, source.getObjects()); } }
SimpleMerger { public void merge(Model target, Model... sources) { for (Model source : sources) if (source != null) merge(target, source.getObjects()); } SimpleMerger(EditorMap map);  SimpleMerger(EditorMap map, Filter<BioPAXElement> mergePropOf); }
SimpleMerger { public void merge(Model target, Model... sources) { for (Model source : sources) if (source != null) merge(target, source.getObjects()); } SimpleMerger(EditorMap map);  SimpleMerger(EditorMap map, Filter<BioPAXElement> mergePropOf); void merge(Model target, Model... sources); void merge(Model target, Collection<? extends BioPAXElement> elements); void merge(Model target, BioPAXElement source); }
SimpleMerger { public void merge(Model target, Model... sources) { for (Model source : sources) if (source != null) merge(target, source.getObjects()); } SimpleMerger(EditorMap map);  SimpleMerger(EditorMap map, Filter<BioPAXElement> mergePropOf); void merge(Model target, Model... sources); void merge(Model target, Collection<? extends BioPAXElement> elements); void merge(Model target, BioPAXElement source);  }