public AnnotationLayer(String aName, String aUiName, String aType, Project aProject, boolean aBuiltIn, AnchoringMode aAnchoringMode) { setName(aName); setUiName(aUiName); setProject(aProject); setBuiltIn(aBuiltIn); setType(aType); setAnchoringMode(aAnchoringMode); }
public AnnotationLayer(String aName, String aUiName, String aType, Project aProject, boolean aBuiltIn, AnchoringMode aAnchoringMode) { setName(aName); setUiName(aUiName); setProject(aProject); setBuiltIn(aBuiltIn); setType(aType); setAnchoringMode(aAnchoringMode); }
layer.setAnchoringMode(AnchoringMode.CHARACTERS); layer.setLinkedListBehavior(false);
layer.setAnchoringMode(AnchoringMode.CHARACTERS); layer.setLinkedListBehavior(false);
@Deprecated public static void setLayer(AnnotationSchemaService aAnnotationService, AnnotationLayer aLayer, ExportedAnnotationLayer aExLayer, Project aProject, User aUser) throws IOException { aLayer.setAllowStacking(aExLayer.isAllowStacking()); aLayer.setBuiltIn(aExLayer.isBuiltIn()); aLayer.setReadonly(aExLayer.isReadonly()); aLayer.setCrossSentence(aExLayer.isCrossSentence()); aLayer.setDescription(aExLayer.getDescription()); aLayer.setEnabled(aExLayer.isEnabled()); if (aExLayer.getAnchoringMode() == null) { // This allows importing old projects which did not have the anchoring mode yet aLayer.setAnchoringMode(aExLayer.isLockToTokenOffset(), aExLayer.isMultipleTokens()); } else { aLayer.setAnchoringMode(aExLayer.getAnchoringMode()); } aLayer.setLinkedListBehavior(aExLayer.isLinkedListBehavior()); aLayer.setUiName(aExLayer.getUiName()); aLayer.setName(aExLayer.getName()); aLayer.setProject(aProject); aLayer.setType(aExLayer.getType()); aAnnotationService.createLayer(aLayer); }
@Deprecated public static void setLayer(AnnotationSchemaService aAnnotationService, AnnotationLayer aLayer, ExportedAnnotationLayer aExLayer, Project aProject, User aUser) throws IOException { aLayer.setAllowStacking(aExLayer.isAllowStacking()); aLayer.setBuiltIn(aExLayer.isBuiltIn()); aLayer.setReadonly(aExLayer.isReadonly()); aLayer.setCrossSentence(aExLayer.isCrossSentence()); aLayer.setDescription(aExLayer.getDescription()); aLayer.setEnabled(aExLayer.isEnabled()); if (aExLayer.getAnchoringMode() == null) { // This allows importing old projects which did not have the anchoring mode yet aLayer.setAnchoringMode(aExLayer.isLockToTokenOffset(), aExLayer.isMultipleTokens()); } else { aLayer.setAnchoringMode(aExLayer.getAnchoringMode()); } aLayer.setValidationMode(aExLayer.getValidationMode() != null ? aExLayer.getValidationMode() : ValidationMode.NEVER); aLayer.setLinkedListBehavior(aExLayer.isLinkedListBehavior()); aLayer.setUiName(aExLayer.getUiName()); aLayer.setName(aExLayer.getName()); aLayer.setProject(aProject); aLayer.setType(aExLayer.getType()); aAnnotationService.createLayer(aLayer); }
public void importLayer(AnnotationLayer aLayer, ExportedAnnotationLayer aExLayer, Project aProject) throws IOException { aLayer.setAllowStacking(aExLayer.isAllowStacking()); aLayer.setBuiltIn(aExLayer.isBuiltIn()); aLayer.setReadonly(aExLayer.isReadonly()); aLayer.setCrossSentence(aExLayer.isCrossSentence()); aLayer.setDescription(aExLayer.getDescription()); aLayer.setEnabled(aExLayer.isEnabled()); if (aExLayer.getAnchoringMode() == null) { // This allows importing old projects which did not have the anchoring mode yet aLayer.setAnchoringMode(aExLayer.isLockToTokenOffset(), aExLayer.isMultipleTokens()); } else { aLayer.setAnchoringMode(aExLayer.getAnchoringMode()); } aLayer.setLinkedListBehavior(aExLayer.isLinkedListBehavior()); aLayer.setUiName(aExLayer.getUiName()); aLayer.setName(aExLayer.getName()); aLayer.setProject(aProject); aLayer.setType(aExLayer.getType()); annotationService.createLayer(aLayer); }
public void importLayer(AnnotationLayer aLayer, ExportedAnnotationLayer aExLayer, Project aProject) throws IOException { aLayer.setAllowStacking(aExLayer.isAllowStacking()); aLayer.setBuiltIn(aExLayer.isBuiltIn()); aLayer.setReadonly(aExLayer.isReadonly()); aLayer.setCrossSentence(aExLayer.isCrossSentence()); aLayer.setDescription(aExLayer.getDescription()); aLayer.setEnabled(aExLayer.isEnabled()); if (aExLayer.getAnchoringMode() == null) { // This allows importing old projects which did not have the anchoring mode yet aLayer.setAnchoringMode(aExLayer.isLockToTokenOffset(), aExLayer.isMultipleTokens()); } else { aLayer.setAnchoringMode(aExLayer.getAnchoringMode()); } aLayer.setValidationMode(aExLayer.getValidationMode() != null ? aExLayer.getValidationMode() : ValidationMode.NEVER); aLayer.setLinkedListBehavior(aExLayer.isLinkedListBehavior()); aLayer.setUiName(aExLayer.getUiName()); aLayer.setName(aExLayer.getName()); aLayer.setProject(aProject); aLayer.setType(aExLayer.getType()); annotationService.createLayer(aLayer); }
@Test public void copySpanWithSlotWithStackingTest() throws Exception { AnnotatorState state = new AnnotatorStateImpl(CURATION); state.setUser(new User()); slotLayer.setAnchoringMode(TOKENS); slotLayer.setAllowStacking(true); JCas jcasA = createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem("f1")); Type type = jcasA.getTypeSystem().getType(DiffUtils.HOST_TYPE); Feature feature = type.getFeatureByBaseName("f1"); AnnotationFS clickedFs = DiffUtils.makeLinkHostMultiSPanFeatureFS(jcasA, 0, 0, feature, "A", DiffUtils.makeLinkFS(jcasA, "slot1", 0, 0)); JCas mergeCAs = JCasFactory .createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem("f1")); DiffUtils.makeLinkHostMultiSPanFeatureFS(mergeCAs, 0, 0, feature, "C", DiffUtils.makeLinkFS(mergeCAs, "slot1", 0, 0)); MergeCas.addSpanAnnotation(state, annotationSchemaService, slotLayer, mergeCAs, clickedFs, true); assertEquals(2, selectCovered(mergeCAs.getCas(), type, 0, 0).size()); }
relationLayer.setUiName("Relation"); relationLayer.setType(WebAnnoConst.RELATION_TYPE); relationLayer.setAnchoringMode(AnchoringMode.CHARACTERS); relationLayer.setAllowStacking(true); relationLayer.setCrossSentence(true); relationTargetLayer.setUiName("RelationTarget"); relationTargetLayer.setType(WebAnnoConst.SPAN_TYPE); relationTargetLayer.setAnchoringMode(AnchoringMode.CHARACTERS); relationTargetLayer.setAllowStacking(true); relationTargetLayer.setCrossSentence(true);
@Test public void testSpanWithSlotFeatures() throws Exception { TypeSystemDescription tsd = createTypeSystemDescription("tsd/spanWithSlotFeatures"); TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd); AnnotationLayer slotSpanLayer = new AnnotationLayer(); slotSpanLayer.setName("webanno.custom.SlotSpan"); slotSpanLayer.setUiName("SlotSpan"); slotSpanLayer.setType(WebAnnoConst.SPAN_TYPE); slotSpanLayer.setAnchoringMode(AnchoringMode.CHARACTERS); slotSpanLayer.setAllowStacking(true); slotSpanLayer.setCrossSentence(true); AnnotationFeature freeSlot = new AnnotationFeature( "freeSlot", CAS.TYPE_NAME_ANNOTATION); AnnotationFeature boundSlot = new AnnotationFeature( "boundSlot", "webanno.custom.SlotSpan"); SoftAssertions softly = new SoftAssertions(); softly.assertThat(analysis.getLayers()) .containsExactly(slotSpanLayer) .usingFieldByFieldElementComparator(); softly.assertThat(analysis.getFeatures(slotSpanLayer.getName())) .containsExactlyInAnyOrder(freeSlot, boundSlot) .usingFieldByFieldElementComparator(); softly.assertAll(); }
@Test public void testChain() throws Exception { TypeSystemDescription tsd = createTypeSystemDescription( "tsd/chain"); TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd); AnnotationLayer chainLayer = new AnnotationLayer(); chainLayer.setName("webanno.custom.Chain"); chainLayer.setUiName("Chain"); chainLayer.setType(WebAnnoConst.CHAIN_TYPE); chainLayer.setAnchoringMode(AnchoringMode.CHARACTERS); chainLayer.setAllowStacking(true); chainLayer.setCrossSentence(true); AnnotationFeature referenceRelationFeature = new AnnotationFeature( "referenceRelation", CAS.TYPE_NAME_STRING); AnnotationFeature referenceTypeFeature = new AnnotationFeature( "referenceType", CAS.TYPE_NAME_STRING); SoftAssertions softly = new SoftAssertions(); softly.assertThat(analysis.getLayers()) .containsExactlyInAnyOrder(chainLayer) .usingFieldByFieldElementComparator(); softly.assertThat(analysis.getFeatures(chainLayer.getName())) .containsExactlyInAnyOrder(referenceRelationFeature, referenceTypeFeature) .usingFieldByFieldElementComparator(); softly.assertAll(); }
spanLayer.setUiName("Span"); spanLayer.setType(WebAnnoConst.SPAN_TYPE); spanLayer.setAnchoringMode(AnchoringMode.CHARACTERS); spanLayer.setAllowStacking(true); spanLayer.setCrossSentence(true);