@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(); }
.containsExactlyInAnyOrder(relationLayer, relationTargetLayer) .usingFieldByFieldElementComparator(); softly.assertThat(analysis.getFeatures(relationLayer.getName())) .containsExactlyInAnyOrder(stringFeature, intFeature, booleanFeature, floatFeature) .usingFieldByFieldElementComparator(); softly.assertAll();
@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(); }
.usingFieldByFieldElementComparator(); softly.assertThat(analysis.getFeatures(spanLayer.getName())) .containsExactlyInAnyOrder(stringFeature, intFeature, booleanFeature, floatFeature) .usingFieldByFieldElementComparator(); softly.assertAll();