protected UimaSupport createSupport(String pipelineName, UimaContext context) { return new UimaSupport( pipelineName, this.getClass(), history, monitor, UimaUtils.isMergeDistinctEntities(context)); }
protected UimaSupport createSupport(String pipelineName, UimaContext context) { return new UimaSupport( pipelineName, this.getClass(), history, monitor, UimaUtils.isMergeDistinctEntities(context)); }
protected UimaSupport createSupport(String pipelineName, UimaContext context) { return new UimaSupport( pipelineName, this.getClass(), history, monitor, UimaUtils.isMergeDistinctEntities(context)); }
protected UimaSupport createSupport(String pipelineName, UimaContext context) { return new UimaSupport( pipelineName, this.getClass(), history, monitor, UimaUtils.isMergeDistinctEntities(context)); }
@Override public final void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); // This will do initialization of resources, // but won't be included in the metrics String pipelineName = UimaUtils.getPipelineName(context); monitor = new UimaMonitor(pipelineName, this.getClass()); support = new UimaSupport( pipelineName, this.getClass(), history, monitor, UimaUtils.isMergeDistinctEntities(context)); monitor.startFunction("initialize"); doInitialize(context); monitor.finishFunction("initialize"); }
@Override public final void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); // This will do initialization of resources, // but won't be included in the metrics String pipelineName = UimaUtils.getPipelineName(context); monitor = new UimaMonitor(pipelineName, this.getClass()); support = new UimaSupport( pipelineName, this.getClass(), history, monitor, UimaUtils.isMergeDistinctEntities(context)); monitor.startFunction("initialize"); doInitialize(context); monitor.finishFunction("initialize"); }
@Test public void testRemoveAnnotationArray() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false); support.remove(location, md); assertEquals(0, JCasUtil.select(jCas, Location.class).size()); assertEquals(0, JCasUtil.select(jCas, Metadata.class).size()); // Location should not have history and id assertNotNull(location.getInternalId()); assertFalse(support.getDocumentHistory(jCas).getHistory(location.getInternalId()).isEmpty()); }
@Test public void testMergeWithNewAnnotationAnnotationArray() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false); Location l = new Location(jCas); l.setBegin(0); l.setEnd(0); Metadata md2 = new Metadata(jCas); md2.setBegin(0); md2.setEnd(0); support.mergeWithNew(l, location); support.mergeWithNew(md2, md); List<Location> locations = new ArrayList<>(JCasUtil.select(jCas, Location.class)); List<Metadata> mds = new ArrayList<>(JCasUtil.select(jCas, Metadata.class)); assertEquals(1, locations.size()); assertEquals(l, locations.get(0)); assertEquals(1, mds.size()); assertEquals(md2, mds.get(0)); assertFalse(support.getDocumentHistory(jCas).getHistory(l.getInternalId()).isEmpty()); }
@Test public void testMergeWithExistingAnnotationAnnotationArray() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false); Location l = new Location(jCas); l.setBegin(0); l.setEnd(0); l.addToIndexes(); Metadata md2 = new Metadata(jCas); md2.setBegin(0); md2.setEnd(0); md2.addToIndexes(); support.mergeWithExisting(l, location); support.mergeWithExisting(md2, md); List<Location> locations = new ArrayList<>(JCasUtil.select(jCas, Location.class)); List<Metadata> mds = new ArrayList<>(JCasUtil.select(jCas, Metadata.class)); assertEquals(1, locations.size()); assertEquals(l, locations.get(0)); assertEquals(1, mds.size()); assertEquals(md2, mds.get(0)); assertFalse(support.getDocumentHistory(jCas).getHistory(l.getInternalId()).isEmpty()); }
@Test public void testAddAnnotationArray() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false); Person withValue = new Person(jCas); withValue.setBegin(0); withValue.setEnd(4); withValue.setValue("David"); Person withoutValue = new Person(jCas); withoutValue.setBegin(0); withoutValue.setEnd(4); support.add(new ProtectiveMarking(jCas), withValue, withoutValue); assertEquals(1, JCasUtil.select(jCas, ProtectiveMarking.class).size()); List<Person> persons = new ArrayList<Person>(JCasUtil.select(jCas, Person.class)); assertEquals(2, persons.size()); // Check value is set / not overridden assertNotEquals(persons.get(0).getCoveredText(), persons.get(0).getValue()); assertEquals(persons.get(1).getCoveredText(), persons.get(1).getValue()); // Check Id set assertNotEquals(persons.get(0).getInternalId(), persons.get(1).getInternalId()); // Check had history of addition assertFalse( support.getDocumentHistory(jCas).getHistory(persons.get(1).getInternalId()).isEmpty()); }
@Test public void testMergeWithRelation() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false);
@Test public void testMergeWithDontMergeDifferentReferent() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false);
@Test public void testGetRelations() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false);
@Test public void testMergeWithMergeDifferentReferent() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, true);