1 10 package com.hp.hpl.jena.reasoner.rulesys.test; 11 12 import com.hp.hpl.jena.rdf.model.*; 13 import com.hp.hpl.jena.reasoner.*; 14 import com.hp.hpl.jena.util.FileManager; 15 16 18 import junit.framework.TestCase; 19 import junit.framework.TestSuite; 20 21 27 public class TestOWLConsistency extends TestCase { 28 29 30 public static final String testTbox = "file:testing/reasoners/owl/tbox.owl"; 31 32 33 public static Reasoner reasonerCache; 34 35 38 public TestOWLConsistency( String name ) { 39 super( name ); 40 } 41 42 46 public static TestSuite suite() { 47 return new TestSuite( TestOWLConsistency.class ); 48 } 52 53 57 public Reasoner makeReasoner() { 58 if (reasonerCache == null) { 59 Model tbox = FileManager.get().loadModel(testTbox); 60 reasonerCache = ReasonerRegistry.getOWLReasoner().bindSchema(tbox.getGraph()); 61 } 62 return reasonerCache; 63 } 64 65 68 public void testConsistent() { 69 assertTrue(doTestOn("file:testing/reasoners/owl/consistentData.rdf")); 70 } 71 72 75 public void testInconsistent1() { 76 assertTrue( ! doTestOn("file:testing/reasoners/owl/inconsistent1.rdf")); 77 } 78 79 82 public void testInconsistent2() { 83 assertTrue( ! doTestOn("file:testing/reasoners/owl/inconsistent2.rdf")); 84 } 85 86 89 public void testInconsistent3() { 90 assertTrue( ! doTestOn("file:testing/reasoners/owl/inconsistent3.rdf")); 91 } 92 93 96 public void testInconsistent4() { 97 assertTrue( ! doTestOn("file:testing/reasoners/owl/inconsistent4.rdf")); 98 } 99 100 103 public void testInconsistent5() { 104 assertTrue( ! doTestOn("file:testing/reasoners/owl/inconsistent5.rdf")); 105 } 106 107 110 private boolean doTestOn(String dataFile) { 111 Model data = FileManager.get().loadModel(dataFile); 113 InfModel infmodel = ModelFactory.createInfModel(makeReasoner(), data); 114 ValidityReport reportList = infmodel.validate(); 115 125 return reportList.isValid(); 126 } 127 } 128 129 130 131 | Popular Tags |