* the quals
* @return the oWL class expression
*/
public OWLClassExpression trRel(@Nonnull String relId,
@Nonnull String classId, @Nonnull Collection<QualifierValue> quals) {
Frame relFrame = obodoc.getTypedefFrame(relId);
OWLObjectPropertyExpression pe = trObjectProp(relId);
OWLClassExpression ce = trClass(classId);
assert pe != null;
assert ce != null;
Integer exact = getQVInt("cardinality", quals);
Integer min = getQVInt("minCardinality", quals);
Integer max = getQVInt("maxCardinality", quals);
boolean allSome = getQVBoolean("all_some", quals);
boolean allOnly = getQVBoolean("all_only", quals);
// obo-format allows dangling references to classes in class
// expressions;
// create an explicit class declaration to be sure
if (ce instanceof OWLClass) {
add(fac.getOWLDeclarationAxiom((OWLClass) ce));
}
OWLClassExpression ex;
if (exact != null && exact > 0) {
ex = fac.getOWLObjectExactCardinality(exact, pe, ce);
} else if (exact != null && exact == 0 || max != null && max == 0) {
OWLObjectComplementOf ceCompl = fac.getOWLObjectComplementOf(ce);
ex = fac.getOWLObjectAllValuesFrom(pe, ceCompl);
} else if (max != null && min != null) {
ex = fac.getOWLObjectIntersectionOf(
fac.getOWLObjectMinCardinality(min, pe, ce),
fac.getOWLObjectMaxCardinality(max, pe, ce));
} else if (min != null) {
ex = fac.getOWLObjectMinCardinality(min, pe, ce);
} else if (max != null) {
ex = fac.getOWLObjectMaxCardinality(max, pe, ce);
} else if (allSome && allOnly) {
ex = fac.getOWLObjectIntersectionOf(
fac.getOWLObjectSomeValuesFrom(pe, ce),
fac.getOWLObjectAllValuesFrom(pe, ce));
} else if (allOnly) {
ex = fac.getOWLObjectAllValuesFrom(pe, ce);
} else if (relFrame != null
&& Boolean.TRUE.equals(relFrame
.getTagValue(OboFormatTag.TAG_IS_CLASS_LEVEL_TAG))) {
// pun
ex = fac.getOWLObjectHasValue(pe, trIndividual(classId));
} else {
// default