public WebOntTestHarness() { testDefinitions = loadAllTestDefinitions(); reasoner = ReasonerRegistry.getOWLReasoner(); initResults(); }
public WebOntTestHarness() { testDefinitions = loadAllTestDefinitions(); reasoner = ReasonerRegistry.getOWLReasoner(); initResults(); }
/** * Bug that exposed prototypes of owl:Thing despite hiding being switched on. */ public void testHideOnOWLThing() { Reasoner r = ReasonerRegistry.getOWLReasoner(); Model data = ModelFactory.createDefaultModel(); InfModel inf = ModelFactory.createInfModel(r, data); StmtIterator things = inf.listStatements(null, RDF.type, OWL.Thing); TestUtil.assertIteratorLength(things, 0); }
/** * Create, or retrieve from cache, an OWL reasoner already bound * to the test tbox. */ public Reasoner makeReasoner() { if (reasonerCache == null) { Model tbox = FileManager.get().loadModel(testTbox); reasonerCache = ReasonerRegistry.getOWLReasoner().bindSchema(tbox.getGraph()); } return reasonerCache; }
/** * Bug that exposed prototypes of owl:Thing despite hiding being switched on. */ public void testHideOnOWLThing() { Reasoner r = ReasonerRegistry.getOWLReasoner(); Model data = ModelFactory.createDefaultModel(); InfModel inf = ModelFactory.createInfModel(r, data); StmtIterator things = inf.listStatements(null, RDF.type, OWL.Thing); TestUtil.assertIteratorLength(things, 0); }
/** * Create, or retrieve from cache, an OWL reasoner already bound * to the test tbox. */ public Reasoner makeReasoner() { if (reasonerCache == null) { Model tbox = FileManager.get().loadModel(testTbox); reasonerCache = ReasonerRegistry.getOWLReasoner().bindSchema(tbox.getGraph()); } return reasonerCache; }
/** * Test change of RDF specs to allow plain literals w/o lang and XSD string to be the same. */ public void testLiteralBug() { Model model = FileManager.get().loadModel("file:testing/reasoners/bugs/dtValidation.owl"); // Model m = ModelFactory.createDefaultModel(); Reasoner r = ReasonerRegistry.getOWLReasoner(); InfModel infmodel = ModelFactory.createInfModel(r, model); ValidityReport validity = infmodel.validate(); assertTrue (validity.isValid()); }
/** * Test change of RDF specs to allow plain literals w/o lang and XSD string to be the same. */ public void testLiteralBug() { Model model = FileManager.get().loadModel("file:testing/reasoners/bugs/dtValidation.owl"); // Model m = ModelFactory.createDefaultModel(); Reasoner r = ReasonerRegistry.getOWLReasoner(); InfModel infmodel = ModelFactory.createInfModel(r, model); ValidityReport validity = infmodel.validate(); assertTrue (validity.isValid()); }
/** * Layering one reasoner on another leads to exposed functors which * used to trip up validation */ public void testLayeredValidation() { Model ont = FileManager.get().loadModel("testing/reasoners/bugs/layeredValidation.owl"); InfModel infModel = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), ont); OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RULE_INF, infModel); ValidityReport validity = model.validate(); assertTrue(validity.isClean()); }
/** * Test problems with inferring equivalence of some simple class definitions, * reported by Jeffrey Hau. */ public void testEquivalentClass1() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/equivalentClassTest.owl"); InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base); String NAMESPACE = "urn:foo#"; Resource A = test.getResource(NAMESPACE + "A"); Resource B = test.getResource(NAMESPACE + "B"); assertTrue("hasValue equiv deduction", test.contains(A, OWL.equivalentClass, B)); }
/** * Report of problems with cardinality v. maxCardinality usage in classification, * from Hugh Winkler. */ public void testCardinality1() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/cardFPTest.owl"); InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base); String NAMESPACE = "urn:foo#"; Resource aDocument = test.getResource(NAMESPACE + "aDocument"); Resource documentType = test.getResource(NAMESPACE + "Document"); assertTrue("Cardinality-based classification", test.contains(aDocument, RDF.type, documentType)); }
/** * Layering one reasoner on another leads to exposed functors which * used to trip up validation */ public void testLayeredValidation() { Model ont = FileManager.get().loadModel("testing/reasoners/bugs/layeredValidation.owl"); InfModel infModel = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), ont); OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RULE_INF, infModel); ValidityReport validity = model.validate(); assertTrue(validity.isClean()); }
/** * Test problems with inferring equivalence of some simple class definitions, * reported by Jeffrey Hau. */ public void testEquivalentClass1() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/equivalentClassTest.owl"); InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base); String NAMESPACE = "urn:foo#"; Resource A = test.getResource(NAMESPACE + "A"); Resource B = test.getResource(NAMESPACE + "B"); assertTrue("hasValue equiv deduction", test.contains(A, OWL.equivalentClass, B)); }
/** * Report of problems with cardinality v. maxCardinality usage in classification, * from Hugh Winkler. */ public void testCardinality1() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/cardFPTest.owl"); InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base); String NAMESPACE = "urn:foo#"; Resource aDocument = test.getResource(NAMESPACE + "aDocument"); Resource documentType = test.getResource(NAMESPACE + "Document"); assertTrue("Cardinality-based classification", test.contains(aDocument, RDF.type, documentType)); }
/** * Test bug with leaking variables which results in an incorrect "range = Nothing" deduction. */ public void testRangeBug() { Model model = FileManager.get().loadModel("file:testing/reasoners/bugs/rangeBug.owl"); // Model m = ModelFactory.createDefaultModel(); Reasoner r = ReasonerRegistry.getOWLReasoner(); InfModel omodel = ModelFactory.createInfModel(r, model); String baseuri = "http://decsai.ugr.es/~ontoserver/bacarex2.owl#"; // Resource js = omodel.getResource(baseuri + "JS"); Resource surname = omodel.getResource(baseuri + "surname"); Statement s = omodel.createStatement(surname, RDFS.range, OWL.Nothing); assertTrue(! omodel.contains(s)); }
/** * Test bug with leaking variables which results in an incorrect "range = Nothing" deduction. */ public void testRangeBug() { Model model = FileManager.get().loadModel("file:testing/reasoners/bugs/rangeBug.owl"); // Model m = ModelFactory.createDefaultModel(); Reasoner r = ReasonerRegistry.getOWLReasoner(); InfModel omodel = ModelFactory.createInfModel(r, model); String baseuri = "http://decsai.ugr.es/~ontoserver/bacarex2.owl#"; // Resource js = omodel.getResource(baseuri + "JS"); Resource surname = omodel.getResource(baseuri + "surname"); Statement s = omodel.createStatement(surname, RDFS.range, OWL.Nothing); assertTrue(! omodel.contains(s)); }
/** * Report of functor literals leaking out of inference graphs and raising CCE * in iterators. */ public void testFunctorCCE() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/cceTest.owl"); InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base); // boolean b = anyInstancesOfNothing(test); ResIterator rIter = test.listSubjects(); while (rIter.hasNext()) { // Resource res = rIter.nextResource(); } }
/** * Report of functor literals leaking out of inference graphs and raising CCE * in iterators. */ public void testFunctorCCE() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/cceTest.owl"); InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base); // boolean b = anyInstancesOfNothing(test); ResIterator rIter = test.listSubjects(); while (rIter.hasNext()) { // Resource res = rIter.nextResource(); } }
/** * Report of NPE during processing on an ontology with a faulty intersection list, * from Hugh Winkler. */ public void testIntersectionNPE() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/bad-intersection.owl"); boolean foundBadList = false; try { InfGraph infgraph = ReasonerRegistry.getOWLReasoner().bind(base.getGraph()); ExtendedIterator<Triple> ci = infgraph.find(null, RDF.Nodes.type, OWL.Class.asNode()); ci.close(); } catch (ReasonerException e) { foundBadList = true; } assertTrue("Correctly detected the illegal list", foundBadList); }
/** * Report of NPE during processing on an ontology with a faulty intersection list, * from Hugh Winkler. */ public void testIntersectionNPE() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/bad-intersection.owl"); boolean foundBadList = false; try { InfGraph infgraph = ReasonerRegistry.getOWLReasoner().bind(base.getGraph()); ExtendedIterator<Triple> ci = infgraph.find(null, RDF.Nodes.type, OWL.Class.asNode()); ci.close(); } catch (ReasonerException e) { foundBadList = true; } assertTrue("Correctly detected the illegal list", foundBadList); }