this.sourceFile));
}
}
// add the relation to the CAS
BinaryTextRelation relation = null;
if ("affects".equals(this.annotation.type)) {
this.assertTypes(sourceMention, EventMention.class, targetMention, IdentifiedAnnotation.class);
relation = new AffectsTextRelation(jCas);
} else if ("complicates/disrupts".equals(this.annotation.type)) {
this.assertTypes(sourceMention, EventMention.class, targetMention, EventMention.class);
relation = new ComplicatesDisruptsTextRelation(jCas);
} else if ("degree_of".equals(this.annotation.type)) {
this.assertTypes(sourceMention, EventMention.class, targetMention, Modifier.class);
relation = new DegreeOfTextRelation(jCas);
} else if ("location_of".equals(this.annotation.type)) {
if (!(targetMention instanceof AnatomicalSiteMention) && (sourceMention instanceof AnatomicalSiteMention)) {
// fix reversed arguments in manual annotations
Annotation temp = sourceMention;
sourceMention = targetMention;
targetMention = temp;
// LOGGER.warn(String.format(
// "relation arguments in reverse order for \"%s\" annotation with id \"%s\"",
// annotation.type,
// annotation.id));
}
this.assertTypes(sourceMention, IdentifiedAnnotation.class, targetMention, AnatomicalSiteMention.class);
relation = new LocationOfTextRelation(jCas);
} else if ("manages/treats".equals(this.annotation.type)) {
this.assertTypes(sourceMention, EventMention.class, targetMention, EventMention.class);
relation = new ManagesTreatsTextRelation(jCas);
} else if ("manifestation_of".equals(this.annotation.type)) {
this.assertTypes(sourceMention, EventMention.class, targetMention, EventMention.class);
relation = new ManifestationOfTextRelation(jCas);
relation.setCategory("manifestation_of"); // fix typo in Knowtator type system
} else if ("result_of".equals(this.annotation.type)) {
this.assertTypes(sourceMention, EventMention.class, targetMention, IdentifiedAnnotation.class);
relation = new ResultOfTextRelation(jCas);
} else if ("TLINK".equals(this.annotation.type)) {
relation = new TemporalTextRelation(jCas);
relation.setCategory(this.type);
} else if ("ALINK".equals(this.annotation.type)) {
relation = new AspectualTextRelation(jCas);
relation.setCategory(this.type);
} else {
relation = new BinaryTextRelation(jCas);
}
// set the relation cateory (if not already set)
if (relation.getCategory() == null) {
relation.setCategory(this.annotation.type);
}
// link the relation to its arguments and add it to the CAS
RelationArgument sourceRA = new RelationArgument(jCas);
sourceRA.setArgument(sourceMention);
sourceRA.addToIndexes();
RelationArgument targetRA = new RelationArgument(jCas);
targetRA.setArgument(targetMention);
targetRA.addToIndexes();
relation.setArg1(sourceRA);
relation.setArg2(targetRA);
relation.addToIndexes();
// add the relation to the map so it can be used in features of other annotations
idAnnotationMap.put(this.annotation.id, relation);
}