/** * Remove an annotation to the JCas index, notifying UimaMonitor of the fact we have done so. * * <p>Relations that refer to the given annotation will also be removed. * * @param annot Annotation(s) to remove */ public void remove(Annotation... annotations) { remove(Arrays.asList(annotations)); }
/** * Remove an annotation to the JCas index, notifying UimaMonitor of the fact we have done so. * * <p>Relations that refer to the given annotation will also be removed. * * @param annot Annotation(s) to remove */ public void remove(Annotation... annotations) { remove(Arrays.asList(annotations)); }
/** * Remove an annotation to the JCas index, notifying UimaMonitor of the fact we have done so * * @param annot Annotation(s) to remove */ protected void removeFromJCasIndex(Annotation... annotations) { getSupport().remove(annotations); }
/** * Remove an annotation to the JCas index, notifying UimaMonitor of the fact we have done so * * @param annot Annotation(s) to remove */ protected void removeFromJCasIndex(Collection<? extends Annotation> annotations) { getSupport().remove(annotations); }
/** * Remove an annotation to the JCas index, notifying UimaMonitor of the fact we have done so * * @param annot Annotation(s) to remove */ protected void removeFromJCasIndex(Collection<? extends Annotation> annotations) { getSupport().remove(annotations); }
/** * Remove an annotation to the JCas index, notifying UimaMonitor of the fact we have done so * * @param annot Annotation(s) to remove */ protected void removeFromJCasIndex(Annotation... annotations) { getSupport().remove(annotations); }
/** * Merge annotations whilst ignoring coreferences. It is recommended that mergeWithExisting(...) * is used instead as that will pass off to this method when appropriate * * @param existingAnnotation The annotation which is to be left in the document (merged) * @param annotations Annotation(s) which will be merged with existingAnnotation and then removed */ public void mergeWithExistingNoCoref( Annotation existingAnnotation, Collection<? extends Annotation> annotations) { for (Annotation a : annotations) { addMergeToHistory(existingAnnotation, a); } remove(annotations); }
/** * Merge annotations whilst ignoring coreferences. It is recommended that mergeWithExisting(...) * is used instead as that will pass off to this method when appropriate * * @param existingAnnotation The annotation which is to be left in the document (merged) * @param annotations Annotation(s) which will be merged with existingAnnotation and then removed */ public void mergeWithExistingNoCoref( Annotation existingAnnotation, Collection<? extends Annotation> annotations) { for (Annotation a : annotations) { addMergeToHistory(existingAnnotation, a); } remove(annotations); }
@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()); }
/** * Merge entity onto targetEntity (assuming they have the same ReferentTarget), updating * relationships as required. * * @return True if merge was successful, false otherwise */ private boolean mergeEntities(Entity entity, Entity targetEntity) { ReferenceTarget targetRef = targetEntity.getReferent(); ReferenceTarget entityRef = entity.getReferent(); if (mergeDistinctEntities || isSameTarget(targetRef, entityRef)) { addMergeToHistory(targetEntity, entity); // Update relationship pointers for (Relation r : getRelations(entity)) { if (r.getSource() == entity) { r.setSource(targetEntity); } if (r.getTarget() == entity) { r.setTarget(targetEntity); } } remove(entity); return true; } else { monitor.debug( "Not merging objects {} and {} as they have different referents", targetEntity.getInternalId(), entity.getInternalId()); return false; } }
/** * Merge entity onto targetEntity (assuming they have the same ReferentTarget), updating * relationships as required. * * @return True if merge was successful, false otherwise */ private boolean mergeEntities(Entity entity, Entity targetEntity) { ReferenceTarget targetRef = targetEntity.getReferent(); ReferenceTarget entityRef = entity.getReferent(); if (mergeDistinctEntities || isSameTarget(targetRef, entityRef)) { addMergeToHistory(targetEntity, entity); // Update relationship pointers for (Relation r : getRelations(entity)) { if (r.getSource() == entity) { r.setSource(targetEntity); } if (r.getTarget() == entity) { r.setTarget(targetEntity); } } remove(entity); return true; } else { monitor.debug( "Not merging objects {} and {} as they have different referents", targetEntity.getInternalId(), entity.getInternalId()); return false; } }