1 10 package com.hp.hpl.jena.reasoner.test; 11 12 import com.hp.hpl.jena.reasoner.rulesys.RDFSRuleReasonerFactory; 13 import com.hp.hpl.jena.reasoner.*; 14 import com.hp.hpl.jena.rdf.model.*; 15 import com.hp.hpl.jena.shared.impl.JenaParameters; 16 import com.hp.hpl.jena.vocabulary.*; 17 18 import java.io.IOException ; 19 import java.util.Iterator ; 20 21 import junit.framework.TestCase; 22 import junit.framework.TestSuite; 23 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 27 33 public class TestCurrentRDFWG extends ReasonerTestBase { 34 35 36 public static final String TEST_DIR = "testing/wg20031010/"; 37 39 40 public static String BASE_RESULTS_URI = "http://jena.sourceforge.net/data/rdf-results.rdf"; 41 42 43 Model testResults; 44 45 46 Resource jena2; 47 48 protected static Log logger = LogFactory.getLog(TestCurrentRDFWG.class); 49 50 53 public TestCurrentRDFWG( String name ) { 54 super( name ); 55 } 56 57 60 public void initResults() { 61 testResults = ModelFactory.createDefaultModel(); 62 jena2 = testResults.createResource(BASE_RESULTS_URI + "#jena2"); 63 jena2.addProperty(RDFS.comment, 64 testResults.createLiteral( 65 "<a xmlns=\"http://www.w3.org/1999/xhtml\" HREF=\"http://jena.sourceforce.net/\">Jena2</a> includes a rule-based inference engine for RDF processing, " + 66 "supporting both forward and backward chaining rules. Its OWL rule set is designed to provide sound " + 67 "but not complete instance resasoning for that fragment of OWL/Full limited to the OWL/lite vocabulary. In" + 68 "particular it does not support unionOf/complementOf.", 69 true) 70 ); 71 jena2.addProperty(RDFS.label, "Jena2"); 72 testResults.setNsPrefix("results", OWLResults.NS); 73 } 74 75 79 public static TestSuite suite() { 80 TestSuite suite = new TestSuite(); 81 try { 82 Resource config = newResource() 83 .addProperty(ReasonerVocabulary.PROPsetRDFSLevel, "full"); 84 constructRDFWGtests(suite, RDFSRuleReasonerFactory.theInstance(), config); 85 86 } catch (IOException e) { 87 logger.error("Failed to construct RDF WG test harness", e); 89 } 90 return suite; 91 } 92 93 96 private static void constructRDFWGtests(TestSuite suite, ReasonerFactory rf, Resource config) throws IOException { 97 JenaParameters.enableWhitespaceCheckingOfTypedLiterals = true; 98 WGReasonerTester tester = new WGReasonerTester("Manifest.rdf", TEST_DIR); 99 for (Iterator i = tester.listTests().iterator(); i.hasNext(); ) { 100 String test = (String )i.next(); 101 suite.addTest(new TestReasonerWG(tester, test, rf, config)); 102 } 103 } 104 105 109 static class TestReasonerWG extends TestCase { 110 111 112 WGReasonerTester tester; 113 114 115 String test; 116 117 118 ReasonerFactory reasonerFactory; 119 120 121 Resource config; 122 123 124 TestReasonerWG(WGReasonerTester tester, String test, 125 ReasonerFactory reasonerFactory, Resource config) { 126 super(test); 127 this.tester = tester; 128 this.test = test; 129 this.reasonerFactory = reasonerFactory; 130 this.config = config; 131 } 132 133 136 public void runTest() throws IOException { 137 boolean success = tester.runTest(test, reasonerFactory, this, config); 138 152 } 153 154 } 155 156 } 157 158 | Popular Tags |