Skip to content

Commit

Permalink
Check that argument to constructor of OWLObjectInverseOfImpl is a pro…
Browse files Browse the repository at this point in the history
…perty, not an inverse.

Change field type of inverseProperty to be OWLObjectProperty.
Change return type of getInverse  to OWLObjectProperty.
 Implement getNamedProperty and getInverseProperty (returns the wrapped property).
  • Loading branch information
sesuncedu committed Aug 16, 2015
1 parent c74d563 commit 92043ef
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ protected int index() {
}

@Nonnull
private final OWLObjectPropertyExpression inverseProperty;
private final OWLObjectProperty inverseProperty;

/**
* @param inverseProperty
* property to invert
*/
public OWLObjectInverseOfImpl(
@Nonnull OWLObjectPropertyExpression inverseProperty) {
this.inverseProperty = inverseProperty;
if(!(inverseProperty instanceof OWLObjectProperty)) {
throw new IllegalArgumentException("ObjectInverseOf can only be applied to Object Properties");
}

this.inverseProperty = inverseProperty.asOWLObjectProperty();
}

@Override
Expand All @@ -66,8 +70,20 @@ public void addAnonymousIndividualsToSet(Set<OWLAnonymousIndividual> anons) {
addAnonymousIndividualsToSetForValue(anons, inverseProperty);
}

@Nonnull
@Override
public OWLObjectPropertyExpression getInverseProperty() {
return getInverse();
}

@Override
public OWLObjectProperty getInverse() {
return inverseProperty;
}

@Nonnull
@Override
public OWLObjectPropertyExpression getInverse() {
public OWLObjectProperty getNamedProperty() {
return inverseProperty;
}

Expand Down

0 comments on commit 92043ef

Please sign in to comment.