public Argument(String aLabel, int aTarget) { // REC: It is fully ok that we only have "int" as the type for target, since right now only // spans can be the target of an argument. However, we internally wrap this as a VID // in order to always use the same identifier type when talking with brat (VID renders as // as String value, while "int" would render as a numeric value). this(aLabel, new VID(aTarget)); }
public Argument(String aLabel, int aTarget) { // REC: It is fully ok that we only have "int" as the type for target, since right now only // spans can be the target of an argument. However, we internally wrap this as a VID // in order to always use the same identifier type when talking with brat (VID renders as // as String value, while "int" would render as a numeric value). this(aLabel, new VID(aTarget)); }
public Relation(int aId, String aType, List<Argument> aArguments, String aLabelText, String aColor) { this(new VID(aId), aType, aArguments, aLabelText, aColor); }
@Deprecated public void setId(int aId) { vid = new VID(aId); }
public VSpan(AnnotationLayer aLayer, AnnotationFS aFS, String aType, List<VRange> aOffsets, int aEquivalenceClass, Map<String, String> aFeatures, Map<String, String> aHoverFeatures) { this(aLayer, new VID(getAddr(aFS)), aType, aOffsets, aFeatures, aHoverFeatures, null); }
public static VID parseOptional(String aVid) { if (StringUtils.isNotBlank(aVid)) { return parse(aVid); } else { return new VID(NONE); } }
public VArc(AnnotationLayer aLayer, VID aVid, String aType, FeatureStructure aSourceFS, FeatureStructure aTargetFS, int aEquivalenceSet, Map<String, String> aFeatures) { super(aLayer, aVid, aType, aEquivalenceSet, aFeatures, Collections.emptyMap()); source = new VID(getAddr(aSourceFS)); target = new VID(getAddr(aTargetFS)); }
public VSpan(AnnotationLayer aLayer, AnnotationFS aFS, String aType, VRange aOffsets, int aEquivalenceClass, Map<String, String> aFeatures, Map<String, String> aHoverFeatures) { super(aLayer, new VID(getAddr(aFS)), aType, aEquivalenceClass, aFeatures, aHoverFeatures); ranges = asList(aOffsets); }
public VArc(AnnotationLayer aLayer, VID aVid, String aType, FeatureStructure aSourceFS, FeatureStructure aTargetFS, int aEquivalenceSet, Map<String, String> aFeatures) { super(aLayer, aVid, aType, aEquivalenceSet, aFeatures, Collections.emptyMap()); source = new VID(getAddr(aSourceFS)); target = new VID(getAddr(aTargetFS)); }
public VSpan(AnnotationLayer aLayer, AnnotationFS aFS, String aType, VRange aOffsets, Map<String, String> aFeatures, Map<String, String> aHoverFeatures) { this(aLayer, new VID(getAddr(aFS)), aType, asList(aOffsets), aFeatures, aHoverFeatures, null); }
default void renderRequiredFeatureErrors(List<AnnotationFeature> aFeatures, FeatureStructure aFS, VDocument aResponse) { for (AnnotationFeature f : aFeatures) { if (isRequiredFeatureMissing(f, aFS)) { aResponse.add(new VComment(new VID(getAddr(aFS)), VCommentType.ERROR, "Required feature [" + f.getName() + "] not set.")); } } } }
default void renderRequiredFeatureErrors(List<AnnotationFeature> aFeatures, FeatureStructure aFS, VDocument aResponse) { for (AnnotationFeature f : aFeatures) { if (isRequiredFeatureMissing(f, aFS)) { aResponse.add(new VComment(new VID(getAddr(aFS)), VCommentType.ERROR, "Required feature [" + f.getName() + "] not set.")); } } } }
private void setHighlight(SourceDocument aDocument, AnnotationFS aAnnotation) { LOG.trace("Active learning sidebar set highlight annotation: {}", aAnnotation); highlightVID = new VID(WebAnnoCasUtil.getAddr(aAnnotation)); highlightSpan = new Offset(aAnnotation.getBegin(), aAnnotation.getEnd()); highlightDocumentName = aDocument.getName(); protectHighlight = false; }
@Test public void toJsonTest() throws IOException { String json = JSONUtil.toPrettyJsonString(new Entity(new VID(1, 2), "type", new Offsets(1, 2), "label", "color", "somehoverspantext")); assertEquals( "[ \"1.2\", \"type\", [ [ 1, 2 ] ], \"label\", \"color\", \"somehoverspantext\" ]", json); } }
@Test public void toJsonTest() throws IOException { String json = JSONUtil.toPrettyJsonString(new Relation(new VID(1, 2), "type", asList(new Argument("arg1", 1), new Argument("arg2", 2)), "label", "color")); assertEquals( "[ \"1.2\", \"type\", [ [ \"arg1\", \"1\" ], [ \"arg2\", \"2\" ] ], \"label\", \"color\" ]", json); } }
private void createNewChainElement(AjaxRequestTarget aTarget, ChainAdapter aAdapter, JCas aJCas) throws AnnotationException { AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); AnnotationFS annoFs = aAdapter.addSpan(state.getDocument(), state.getUser().getUsername(), aJCas, selection.getBegin(), selection.getEnd()); selection.selectSpan(new VID(annoFs), aJCas, annoFs.getBegin(), annoFs.getEnd()); }
private void createNewSpanAnnotation(AjaxRequestTarget aTarget, SpanAdapter aAdapter, JCas aJCas) throws IOException, AnnotationException { handleForwardAnnotation(aTarget, aAdapter, aJCas); AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); AnnotationFS annoFs = aAdapter.add(state.getDocument(), state.getUser().getUsername(), aJCas, selection.getBegin(), selection.getEnd()); selection.selectSpan(new VID(annoFs), aJCas, annoFs.getBegin(), annoFs.getEnd()); }