| 1 |
package conformancetests; |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
import static org.junit.Assert.*; |
| 9 |
|
| 10 |
import org.junit.Test; |
| 11 |
import org.semanticweb.owlapi.apibinding.OWLManager; |
| 12 |
import org.semanticweb.owlapi.model.IRI; |
| 13 |
import org.semanticweb.owlapi.model.OWLClass; |
| 14 |
import org.semanticweb.owlapi.model.OWLDataFactory; |
| 15 |
import org.semanticweb.owlapi.model.OWLObjectAllValuesFrom; |
| 16 |
import org.semanticweb.owlapi.model.OWLObjectProperty; |
| 17 |
import org.semanticweb.owlapi.model.OWLOntology; |
| 18 |
import org.semanticweb.owlapi.model.OWLOntologyCreationException; |
| 19 |
import org.semanticweb.owlapi.model.OWLOntologyManager; |
| 20 |
import org.semanticweb.owlapi.reasoner.OWLReasoner; |
| 21 |
|
| 22 |
import testbase.TestBase; |
| 23 |
|
| 24 |
@SuppressWarnings("javadoc") |
| 25 |
public class WebOnt_description_logic_602_TestCase extends TestBase { |
| 26 |
|
| 27 |
@Test |
| 28 |
public void testWebOnt_description_logic_602() |
| 29 |
throws OWLOntologyCreationException { |
| 30 |
OWLOntologyManager m = OWLManager.createOWLOntologyManager(); |
| 31 |
OWLDataFactory f = m.getOWLDataFactory(); |
| 32 |
OWLOntology o = m.createOntology(); |
| 33 |
OWLClass A = f.getOWLClass(IRI.create("urn:A")); |
| 34 |
OWLClass C = f.getOWLClass(IRI.create("urn:C")); |
| 35 |
OWLClass D = f.getOWLClass(IRI.create("urn:D")); |
| 36 |
OWLClass B = f.getOWLClass(IRI.create("urn:B")); |
| 37 |
OWLClass U = f.getOWLClass(IRI.create("urn:U")); |
| 38 |
OWLObjectProperty p = f.getOWLObjectProperty(IRI.create("urn:p")); |
| 39 |
OWLObjectProperty r = f.getOWLObjectProperty(IRI.create("urn:r")); |
| 40 |
OWLObjectAllValuesFrom rAllC = f.getOWLObjectAllValuesFrom(r, C); |
| 41 |
m.addAxiom(o, f.getOWLEquivalentClassesAxiom(A, rAllC)); |
| 42 |
m.addAxiom(o, f.getOWLSubClassOfAxiom(A, D)); |
| 43 |
m.addAxiom(o, f.getOWLSubClassOfAxiom(U, C)); |
| 44 |
m.addAxiom(o, f.getOWLSubClassOfAxiom(U, B)); |
| 45 |
m.addAxiom(o, f.getOWLEquivalentClassesAxiom(C, rAllC)); |
| 46 |
m.addAxiom( |
| 47 |
o, |
| 48 |
f.getOWLEquivalentClassesAxiom(D, |
| 49 |
f.getOWLObjectMaxCardinality(0, p))); |
| 50 |
m.addAxiom( |
| 51 |
o, |
| 52 |
f.getOWLEquivalentClassesAxiom(B, |
| 53 |
f.getOWLObjectMinCardinality(1, p))); |
| 54 |
OWLReasoner reasoner = factory().createReasoner(o); |
| 55 |
assertTrue("cannot infer disjoint", |
| 56 |
reasoner.isEntailed(f.getOWLDisjointClassesAxiom(D, B))); |
| 57 |
assertTrue("cannot infer U [= B", |
| 58 |
reasoner.isEntailed(f.getOWLSubClassOfAxiom(U, B))); |
| 59 |
assertTrue("cannot infer U [= C", |
| 60 |
reasoner.isEntailed(f.getOWLSubClassOfAxiom(U, C))); |
| 61 |
assertTrue("cannot infer C [= r some C", |
| 62 |
reasoner.isEntailed(f.getOWLSubClassOfAxiom(C, rAllC))); |
| 63 |
assertTrue("cannot infer r some C = A", |
| 64 |
reasoner.isEntailed(f.getOWLEquivalentClassesAxiom(rAllC, A))); |
| 65 |
assertTrue("cannot infer A [= D", |
| 66 |
reasoner.isEntailed(f.getOWLSubClassOfAxiom(A, D))); |
| 67 |
assertTrue("cannot infer U [= D", |
| 68 |
reasoner.isEntailed(f.getOWLSubClassOfAxiom(U, D))); |
| 69 |
assertFalse("cannot find unsatisfiable class", |
| 70 |
reasoner.isSatisfiable(U)); |
| 71 |
} |
| 72 |
} |