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); }
details = chainDetails; layer.setName(removeEnd(aTD.getName(), "Chain")); layer.setUiName(removeEnd(type.getShortName(), "Chain")); layer.setType(CHAIN_TYPE); chainDetailMap.put(layer.getName(), chainDetails.get()); details = relationDetails; layer.setName(aTD.getName()); layer.setUiName(type.getShortName()); layer.setType(RELATION_TYPE); relationDetailMap.put(layer.getName(), relationDetails.get()); details = Optional.empty(); layer.setName(aTD.getName()); layer.setUiName(type.getShortName()); layer.setType(SPAN_TYPE);
details = chainDetails; layer.setName(removeEnd(aTD.getName(), "Chain")); layer.setUiName(removeEnd(type.getShortName(), "Chain")); layer.setType(CHAIN_TYPE); chainDetailMap.put(layer.getName(), chainDetails.get()); details = relationDetails; layer.setName(aTD.getName()); layer.setUiName(type.getShortName()); layer.setType(RELATION_TYPE); relationDetailMap.put(layer.getName(), relationDetails.get()); details = Optional.empty(); layer.setName(aTD.getName()); layer.setUiName(type.getShortName()); layer.setType(SPAN_TYPE);
@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); }
public static void setLayer(AnnotationService aAnnotationService, AnnotationLayer aLayer, de.tudarmstadt.ukp.clarin.webanno.model.export.AnnotationLayer aExLayer, Project aProject, User aUser) throws IOException { aLayer.setAllowStacking(aExLayer.isAllowStacking()); aLayer.setBuiltIn(aExLayer.isBuiltIn()); aLayer.setCrossSentence(aExLayer.isCrossSentence()); aLayer.setDescription(aExLayer.getDescription()); aLayer.setEnabled(aExLayer.isEnabled()); aLayer.setLockToTokenOffset(aExLayer.isLockToTokenOffset()); aLayer.setMultipleTokens(aExLayer.isMultipleTokens()); aLayer.setLinkedListBehavior(aExLayer.isLinkedListBehavior()); aLayer.setUiName(aExLayer.getUiName()); aLayer.setName(aExLayer.getName()); aLayer.setProject(aProject); aLayer.setType(aExLayer.getType()); aAnnotationService.createLayer(aLayer, aUser); }
@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); }
relationLayer.setUiName("Relation"); relationLayer.setType(WebAnnoConst.RELATION_TYPE); relationLayer.setAnchoringMode(AnchoringMode.CHARACTERS); relationTargetLayer.setUiName("RelationTarget"); relationTargetLayer.setType(WebAnnoConst.SPAN_TYPE); relationTargetLayer.setAnchoringMode(AnchoringMode.CHARACTERS);
@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);