Skip to content

Commit

Permalink
Reverting the Collections.emptySet() trick
Browse files Browse the repository at this point in the history
Code too complex to surrender to easy wins.
  • Loading branch information
ignazio1977 committed Aug 8, 2015
1 parent 546dfd3 commit 3dfb210
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1239,20 +1239,14 @@ protected OWLAxiom trGenericClause(@Nonnull OWLAnnotationSubject sub, @Nonnull S
// TODO
}
} else if (tagConstant == OboFormatTag.TAG_SYNONYM) {
Set<OWLAnnotation> annotationsToUse = annotations;
Object[] values = clause.getValues().toArray();
String synType;
if (values.length > 1) {
synType = values[1].toString();
if (values.length > 2) {
OWLAnnotation ann = fac.getOWLAnnotation(trTagToAnnotationProp(OboFormatTag.TAG_HAS_SYNONYM_TYPE
.getTag()), trAnnotationProp(values[2].toString()).getIRI());
// The annotations to use might be an immutable empty set at this point.
// We can't check that, but we can make sure we have an editable set
if (annotationsToUse.isEmpty()) {
annotationsToUse = new HashSet<>();
}
annotationsToUse.add(ann);
annotations.add(ann);
}
} else {
LOG.warn("Assume 'RELATED'for missing scope in synonym clause: {}", clause);
Expand All @@ -1261,7 +1255,7 @@ protected OWLAxiom trGenericClause(@Nonnull OWLAnnotationSubject sub, @Nonnull S
synType = OboFormatTag.TAG_RELATED.getTag();
}
ax = fac.getOWLAnnotationAssertionAxiom(trSynonymType(synType), sub, trLiteral(clause.getValue()),
annotationsToUse);
annotations);
} else if (tagConstant == OboFormatTag.TAG_XREF) {
Xref xref = (Xref) clause.getValue();
String xrefAnnotation = xref.getAnnotation();
Expand Down Expand Up @@ -1306,7 +1300,7 @@ protected OWLAnnotationProperty trSynonymType(@Nonnull String type) {
@Nonnull
protected Set<OWLAnnotation> trAnnotations(@Nonnull Clause clause) {
if (clause.hasNoAnnotations()) {
return Collections.emptySet();
return CollectionFactory.createSet();
}
Set<OWLAnnotation> anns = new HashSet<>();
trAnnotations(clause, anns);
Expand Down

0 comments on commit 3dfb210

Please sign in to comment.