| 1 | package bugs; |
| 2 | |
| 3 | import static org.junit.Assert.assertEquals; |
| 4 | |
| 5 | import javax.annotation.Nonnull; |
| 6 | |
| 7 | import org.junit.Before; |
| 8 | import org.junit.Test; |
| 9 | import org.semanticweb.owlapi.apibinding.OWLManager; |
| 10 | import org.semanticweb.owlapi.formats.FunctionalSyntaxDocumentFormat; |
| 11 | import org.semanticweb.owlapi.io.StringDocumentSource; |
| 12 | import org.semanticweb.owlapi.io.SystemOutDocumentTarget; |
| 13 | import org.semanticweb.owlapi.model.IRI; |
| 14 | import org.semanticweb.owlapi.model.OWLClass; |
| 15 | import org.semanticweb.owlapi.model.OWLDataFactory; |
| 16 | import org.semanticweb.owlapi.model.OWLOntology; |
| 17 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; |
| 18 | import org.semanticweb.owlapi.model.OWLOntologyStorageException; |
| 19 | import org.semanticweb.owlapi.reasoner.OWLReasoner; |
| 20 | |
| 21 | import testbase.TestBase; |
| 22 | |
| 23 | @SuppressWarnings("javadoc") |
| 24 | public class DebugVerifyComplianceUniversityTestCase extends TestBase { |
| 25 | |
| 26 | private OWLReasoner reasoner; |
| 27 | private OWLDataFactory df = OWLManager.getOWLDataFactory(); |
| 28 | |
| 29 | @Nonnull |
| 30 | private static OWLOntology load() throws OWLOntologyCreationException { |
| 31 | String input = "Prefix(owl:=<http://www.w3.org/2002/07/owl#>)\n" |
| 32 | + "Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)\n" |
| 33 | + "Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)\n" |
| 34 | + "Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)\n" |
| 35 | + "Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)\n" |
| 36 | + "Ontology(<urn:uni>\n" |
| 37 | + "Declaration(Class(<urn:uni#Professor>))\n" |
| 38 | + "Declaration(Class(<urn:uni#TeachingFaculty>))\n" |
| 39 | + "Declaration(DataProperty(<urn:uni#hasTenure>))\n" |
| 40 | + "EquivalentClasses(<urn:uni#Lecturer> DataHasValue(<urn:uni#hasTenure> \"false\"^^xsd:boolean))\n" |
| 41 | + "DisjointClasses(<urn:uni#Lecturer> <urn:uni#Professor>)\n" |
| 42 | + "EquivalentClasses(<urn:uni#Professor> DataHasValue(<urn:uni#hasTenure> \"true\"^^xsd:boolean))\n" |
| 43 | + "DataPropertyDomain(<urn:uni#hasTenure> <urn:uni#TeachingFaculty>)\n" |
| 44 | + "DataPropertyRange(<urn:uni#hasTenure> xsd:boolean)\n" + ')'; |
| 45 | return OWLManager.createOWLOntologyManager() |
| 46 | .loadOntologyFromOntologyDocument( |
| 47 | new StringDocumentSource(input)); |
| 48 | } |
| 49 | |
| 50 | private static void equal(Object o, boolean object) { |
| 51 | assertEquals(object, o); |
| 52 | } |
| 53 | |
| 54 | @Nonnull |
| 55 | private OWLClass C(@Nonnull String i) { |
| 56 | return df.getOWLClass(IRI.create(i)); |
| 57 | } |
| 58 | |
| 59 | @Nonnull |
| 60 | private OWLClass Professor = C("urn:uni#Professor"); |
| 61 | |
| 62 | @Before |
| 63 | public void setUp() throws OWLOntologyCreationException { |
| 64 | reasoner = factory().createReasoner(load()); |
| 65 | } |
| 66 | |
| 67 | protected void print(OWLOntology o) throws OWLOntologyStorageException { |
| 68 | o.getOWLOntologyManager().saveOntology(o, |
| 69 | new FunctionalSyntaxDocumentFormat(), |
| 70 | new SystemOutDocumentTarget()); |
| 71 | } |
| 72 | |
| 73 | @Test |
| 74 | public void shouldPassisSatisfiableProfessor() { |
| 75 | equal(reasoner.isSatisfiable(Professor), true); |
| 76 | } |
| 77 | } |