public AnnotationFS handle(CreateRelationAnnotationRequest aRequest) throws AnnotationException { CreateRelationAnnotationRequest request = aRequest; for (RelationLayerBehavior behavior : behaviors) { request = behavior.onCreate(this, request); } return createRelationAnnotation(request.getJcas().getCas(), request.getOriginFs(), request.getTargetFs()); }
public AnnotationFS handle(CreateRelationAnnotationRequest aRequest) throws AnnotationException { CreateRelationAnnotationRequest request = aRequest; for (RelationLayerBehavior behavior : behaviors) { request = behavior.onCreate(this, request); } return createRelationAnnotation(request.getJcas().getCas(), request.getOriginFs(), request.getTargetFs()); }
@Override public CreateRelationAnnotationRequest onCreate(RelationAdapter aAdapter, CreateRelationAnnotationRequest aRequest) throws AnnotationException { if (aAdapter.getLayer().isCrossSentence()) { return aRequest; } if (!isBeginEndInSameSentence(aRequest.getJcas(), aRequest.getOriginFs().getBegin(), aRequest.getTargetFs().getEnd())) { throw new MultipleSentenceCoveredException("Annotation coveres multiple sentences, " + "limit your annotation to single sentence!"); } return aRequest; }
@Override public CreateRelationAnnotationRequest onCreate(RelationAdapter aAdapter, CreateRelationAnnotationRequest aRequest) throws AnnotationException { if (aAdapter.getLayer().isCrossSentence()) { return aRequest; } if (!isBeginEndInSameSentence(aRequest.getJcas(), aRequest.getOriginFs().getBegin(), aRequest.getTargetFs().getEnd())) { throw new MultipleSentenceCoveredException("Annotation coveres multiple sentences, " + "limit your annotation to single sentence!"); } return aRequest; }
@Override public CreateRelationAnnotationRequest onCreate(RelationAdapter aAdapter, CreateRelationAnnotationRequest aRequest) { if (aAdapter.getLayer().getAttachFeature() == null) { return aRequest; } // FIXME The code below appears to be broken - it basically only works because the only // case were we use the attach-feature is with the Dependency/Token layers and it works // because tokens cannot stack. "selectCovered" below would need to be replaced with // an actual lookup of the annotation pointed to by the attach-feature. final CAS cas = aRequest.getJcas().getCas(); final Type attachType = getType(cas, aAdapter.getLayer().getAttachType().getName()); AnnotationFS originFS = aRequest.getOriginFs(); AnnotationFS targetFS = aRequest.getTargetFs(); targetFS = selectCovered(cas, attachType, targetFS.getBegin(), targetFS.getEnd()).get(0); originFS = selectCovered(cas, attachType, originFS.getBegin(), originFS.getEnd()).get(0); return aRequest.changeRelation(originFS, targetFS); }
@Override public CreateRelationAnnotationRequest onCreate(RelationAdapter aAdapter, CreateRelationAnnotationRequest aRequest) { if (aAdapter.getLayer().getAttachFeature() == null) { return aRequest; } // FIXME The code below appears to be broken - it basically only works because the only // case were we use the attach-feature is with the Dependency/Token layers and it works // because tokens cannot stack. "selectCovered" below would need to be replaced with // an actual lookup of the annotation pointed to by the attach-feature. final CAS cas = aRequest.getJcas().getCas(); final Type attachType = getType(cas, aAdapter.getLayer().getAttachType().getName()); AnnotationFS originFS = aRequest.getOriginFs(); AnnotationFS targetFS = aRequest.getTargetFs(); targetFS = selectCovered(cas, attachType, targetFS.getBegin(), targetFS.getEnd()).get(0); originFS = selectCovered(cas, attachType, originFS.getBegin(), originFS.getEnd()).get(0); return aRequest.changeRelation(originFS, targetFS); }
if (isDuplicate(existingOriginFS, aRequest.getOriginFs(), existingTargetFS, aRequest.getTargetFs())) { throw new AnnotationException("Cannot create another annotation of layer ["
if (isDuplicate(existingOriginFS, aRequest.getOriginFs(), existingTargetFS, aRequest.getTargetFs())) { throw new AnnotationException("Cannot create another annotation of layer ["