Skip to content

Commit

Permalink
Improve compatibility with OWL API 5.x
Browse files Browse the repository at this point in the history
address #45
  • Loading branch information
ykazakov committed Jul 27, 2017
1 parent b28fdcb commit a4c0e84
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
package org.semanticweb.elk.owlapi.wrapper;

/*-
* #%L
* ELK OWL API Binding
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2011 - 2017 Department of Computer Science, University of Oxford
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/

import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.owl.interfaces.ElkClassExpression;
import org.semanticweb.elk.owl.interfaces.ElkDataAllValuesFrom;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
package org.semanticweb.elk.owlapi.wrapper;

/*-
* #%L
* ELK OWL API Binding
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2011 - 2017 Department of Computer Science, University of Oxford
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/

import org.semanticweb.elk.owl.interfaces.ElkDataComplementOf;
import org.semanticweb.elk.owl.interfaces.ElkDataIntersectionOf;
import org.semanticweb.elk.owl.interfaces.ElkDataOneOf;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
package org.semanticweb.elk.owlapi.wrapper;

/*-
* #%L
* ELK OWL API Binding
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2011 - 2017 Department of Computer Science, University of Oxford
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/

import org.semanticweb.elk.owl.interfaces.ElkAnonymousIndividual;
import org.semanticweb.elk.owl.interfaces.ElkIndividual;
import org.semanticweb.elk.owl.interfaces.ElkNamedIndividual;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,46 +58,20 @@ public void testNestedInverses() {
OWLDataFactory factory = new OWLDataFactoryImpl();
OWLObjectProperty r = factory.getOWLObjectProperty(IRI.create("R"));
OWLObjectPropertyExpression ri = factory.getOWLObjectInverseOf(r);
OWLObjectPropertyExpression rii = null;
OWLObjectPropertyExpression riii = null;

try {
rii = factory.getOWLObjectInverseOf(ri);
riii = factory.getOWLObjectInverseOf(rii);
} catch(IllegalArgumentException e) {
// owlapi 4.* throws IllegalArgumentException when nested ObjectInverseOf is created.
}

OWLPropertyExpressionVisitorEx<ElkObjectPropertyExpression> converter = OwlObjectPropertyExpressionConverterVisitor
.getInstance();

ElkObjectPropertyExpression s = r.accept(converter);
ElkObjectPropertyExpression si = ri.accept(converter);
ElkObjectPropertyExpression sii = null;
ElkObjectPropertyExpression siii = null;
if (rii != null) {
sii = rii.accept(converter);
siii = riii.accept(converter);
}

assertTrue(s instanceof ElkObjectProperty);
assertTrue(si instanceof ElkObjectInverseOf);
if (rii != null) {
assertTrue(sii instanceof ElkObjectProperty);
assertTrue(siii instanceof ElkObjectInverseOf);
}

ElkIri expectedIri = ((ElkObjectProperty) s).getIri();

assertEquals(expectedIri, ((ElkObjectInverseOf) si).getObjectProperty()
.getIri());

if (rii != null) {
assertEquals(expectedIri, ((ElkObjectProperty) sii).getIri());

assertEquals(expectedIri, ((ElkObjectInverseOf) siii)
.getObjectProperty().getIri());
}


}
}
Loading

0 comments on commit a4c0e84

Please sign in to comment.