use of org.apache.jena.reasoner.ValidityReport in project jena by apache.
the class OWLConsistencyTest method runTest.
@Override
public void runTest() {
ValidityReport report = testResults();
switch(expected) {
case INCONSISTENT:
assertTrue("expected inconsistent", !report.isValid());
break;
case WARNINGS:
assertTrue("expected just warnings but reports not valid", report.isValid());
assertFalse("expected warnings but reports clean", report.isClean());
break;
case CLEAN:
assertTrue("expected clean", report.isClean());
}
if (culprit != null) {
boolean foundit = false;
for (Iterator<Report> i = report.getReports(); i.hasNext(); ) {
ValidityReport.Report r = i.next();
if (r.getExtension() != null && r.getExtension().equals(culprit)) {
foundit = true;
break;
}
}
if (!foundit) {
assertTrue("Expcted to find a culprint " + culprit, false);
}
}
}
use of org.apache.jena.reasoner.ValidityReport in project jena by apache.
the class TestOWLMisc method doTestDatatypeRangeValidation.
private void doTestDatatypeRangeValidation(RDFDatatype over12Type, OntModelSpec spec) {
String NS = "http://jena.hpl.hp.com/example#";
OntModel ont = ModelFactory.createOntologyModel(spec);
Resource over12 = ont.createResource(over12Type.getURI());
DatatypeProperty hasValue = ont.createDatatypeProperty(NS + "hasValue");
hasValue.addRange(over12);
ont.createResource(NS + "a").addProperty(hasValue, "15", over12Type);
ont.createResource(NS + "b").addProperty(hasValue, "16", XSDDatatype.XSDinteger);
ont.createResource(NS + "c").addProperty(hasValue, "10", XSDDatatype.XSDinteger);
ValidityReport validity = ont.validate();
assertTrue(!validity.isValid());
// Check culprit reporting
ValidityReport.Report report = (validity.getReports().next());
Triple culprit = (Triple) report.getExtension();
assertEquals(culprit.getSubject().getURI(), NS + "c");
assertEquals(culprit.getPredicate(), hasValue.asNode());
}
use of org.apache.jena.reasoner.ValidityReport in project jena by apache.
the class TestOWLMisc method testLiteralBug.
/**
* 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.getInternal().loadModelInternal("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());
}
Aggregations