// copy gold Mentions and Modifiers to the system view
List<IdentifiedAnnotation> goldMentions = new ArrayList<IdentifiedAnnotation>();
goldMentions.addAll(JCasUtil.select(goldView, EventMention.class));
goldMentions.addAll(JCasUtil.select(goldView, EntityMention.class));
goldMentions.addAll(JCasUtil.select(goldView, Modifier.class));
CasCopier copier = new CasCopier(goldView.getCas(), systemView.getCas());
Feature sofaFeature = jCas.getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFA);
for (IdentifiedAnnotation goldMention : goldMentions) {
Annotation copy = (Annotation) copier.copyFs(goldMention);
copy.setFeatureValue(sofaFeature, systemView.getSofa());
copy.addToIndexes();
}
// copy gold relations to the system view
for (BinaryTextRelation goldRelation : JCasUtil.select(goldView, BinaryTextRelation.class)) {
BinaryTextRelation relation = (BinaryTextRelation) copier.copyFs(goldRelation);
relation.addToIndexes(systemView);
for (RelationArgument relArg : Lists.newArrayList(relation.getArg1(), relation.getArg2())) {
relArg.addToIndexes(systemView);
// relArg.getArgument() should have been added to indexes with
// mentions above