@Test
public void testRelations() throws Exception {
BaleenCollectionReader bcr =
getCollectionReader(
Re3dReader.PARAM_FOLDER,
tmpDir.toAbsolutePath().toString(),
Re3dReader.PARAM_ENTITIES,
true,
Re3dReader.PARAM_RELATIONSHIPS,
true,
Re3dReader.PARAM_RANDOM_DATES,
true);
assertTrue(bcr.doHasNext());
bcr.getNext(jCas.getCas());
AnnotationIndex<Entity> entityIndex = jCas.getAnnotationIndex(Entity.class);
Entity source = Streams.stream(entityIndex).filter(e -> e.getBegin() == 12).findAny().get();
Entity target = Streams.stream(entityIndex).filter(e -> e.getBegin() == 9).findAny().get();
AnnotationIndex<Relation> relationIndex = jCas.getAnnotationIndex(Relation.class);
contains(relationIndex, r -> r.getBegin() == 11);
contains(relationIndex, r -> r.getEnd() == 12);
contains(relationIndex, r -> r.getValue().equals(""));
contains(relationIndex, r -> r.getRelationshipType().equals("HasAttrOf"));
contains(relationIndex, r -> r.getSource().equals(source));
contains(relationIndex, r -> r.getTarget().equals(target));
bcr.close();
}