}
boolean isUntranslateable = false;
List<Clause> equivalenceAxiomClauses = new ArrayList<>();
String cls2 = getIdentifier(ce2);
if (cls2 != null) {
Clause c = new Clause(OboFormatTag.TAG_EQUIVALENT_TO.getTag());
c.setValue(cls2);
f.addClause(c);
addQualifiers(c, ax.getAnnotations());
} else if (ce2 instanceof OWLObjectUnionOf) {
List<OWLClassExpression> list2 = ((OWLObjectUnionOf) ce2)
.getOperandsAsList();
for (OWLClassExpression oce : list2) {
String id = getIdentifier(oce);
if (id == null) {
isUntranslateable = true;
error(ax, true);
return;
}
Clause c = new Clause(OboFormatTag.TAG_UNION_OF.getTag());
c.setValue(id);
equivalenceAxiomClauses.add(c);
addQualifiers(c, ax.getAnnotations());
}
} else if (ce2 instanceof OWLObjectIntersectionOf) {
List<OWLClassExpression> list2 = ((OWLObjectIntersectionOf) ce2)
.getOperandsAsList();
for (OWLClassExpression ce : list2) {
String r = null;
cls2 = getIdentifier(ce);
Integer exact = null; // cardinality
Integer min = null; // minCardinality
Integer max = null; // maxCardinality
Boolean allSome = null; // all_some
Boolean allOnly = null; // all_only
if (ce instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom ristriction = (OWLObjectSomeValuesFrom) ce;
r = getIdentifier(ristriction.getProperty());
cls2 = getIdentifier(ristriction.getFiller());
} else if (ce instanceof OWLObjectExactCardinality) {
OWLObjectExactCardinality card = (OWLObjectExactCardinality) ce;
r = getIdentifier(card.getProperty());
cls2 = getIdentifier(card.getFiller());
exact = card.getCardinality();
} else if (ce instanceof OWLObjectMinCardinality) {
OWLObjectMinCardinality card = (OWLObjectMinCardinality) ce;
r = getIdentifier(card.getProperty());
cls2 = getIdentifier(card.getFiller());
min = card.getCardinality();
} else if (ce instanceof OWLObjectMaxCardinality) {
OWLObjectMaxCardinality card = (OWLObjectMaxCardinality) ce;
r = getIdentifier(card.getProperty());
cls2 = getIdentifier(card.getFiller());
max = card.getCardinality();
} else if (ce instanceof OWLObjectAllValuesFrom) {
OWLObjectAllValuesFrom all = (OWLObjectAllValuesFrom) ce;
OWLClassExpression filler = all.getFiller();
if (filler instanceof OWLClass) {
r = getIdentifier(all.getProperty());
cls2 = getIdentifier(filler);
allOnly = Boolean.TRUE;
} else if (filler instanceof OWLObjectComplementOf) {
OWLObjectComplementOf restriction = (OWLObjectComplementOf) filler;
r = getIdentifier(all.getProperty());
cls2 = getIdentifier(restriction.getOperand());
exact = 0;
}
} else if (ce instanceof OWLObjectIntersectionOf) {
// either a min-max or a some-all combination
Set<OWLClassExpression> operands = ((OWLObjectIntersectionOf) ce)
.getOperands();
if (operands.size() == 2) {
for (OWLClassExpression operand : operands) {
if (operand instanceof OWLObjectMinCardinality) {
OWLObjectMinCardinality card = (OWLObjectMinCardinality) operand;
r = getIdentifier(card.getProperty());
cls2 = getIdentifier(card.getFiller());
min = card.getCardinality();
} else if (operand instanceof OWLObjectMaxCardinality) {
OWLObjectMaxCardinality card = (OWLObjectMaxCardinality) operand;
r = getIdentifier(card.getProperty());
cls2 = getIdentifier(card.getFiller());
max = card.getCardinality();
} else if (operand instanceof OWLObjectAllValuesFrom) {
OWLObjectAllValuesFrom all = (OWLObjectAllValuesFrom) operand;
r = getIdentifier(all.getProperty());
cls2 = getIdentifier(all.getFiller());
allOnly = Boolean.TRUE;
} else if (operand instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom all = (OWLObjectSomeValuesFrom) operand;
r = getIdentifier(all.getProperty());
cls2 = getIdentifier(all.getFiller());
allSome = Boolean.TRUE;
}
}
}
}
if (cls2 != null) {
Clause c = new Clause(
OboFormatTag.TAG_INTERSECTION_OF.getTag());
if (r != null) {
c.addValue(r);
}
c.addValue(cls2);
equivalenceAxiomClauses.add(c);
if (exact != null) {
String string = exact.toString();
assert string != null;
c.addQualifierValue(new QualifierValue("cardinality",
string));
}
if (min != null) {
String string = min.toString();
assert string != null;
c.addQualifierValue(new QualifierValue(
"minCardinality", string));
}
if (max != null) {
String string = max.toString();
assert string != null;
c.addQualifierValue(new QualifierValue(
"maxCardinality", string));
}
if (allSome != null) {
String string = allSome.toString();
assert string != null;
c.addQualifierValue(new QualifierValue("all_some",
string));
}
if (allOnly != null) {
String string = allOnly.toString();
assert string != null;
c.addQualifierValue(new QualifierValue("all_only",
string));
}
addQualifiers(c, ax.getAnnotations());
} else if (!f.getClauses(OboFormatTag.TAG_INTERSECTION_OF)
.isEmpty()) {