/** * Return a prebuilt standard configuration for the default RDFS reasoner */ public static Reasoner getRDFSReasoner() { if (theRDFSReasoner == null) theRDFSReasoner = RDFSRuleReasonerFactory.theInstance().create(null); return theRDFSReasoner; }
/** * Return a description of the capabilities of this reasoner encoded in * RDF. This method is normally called by the ReasonerRegistry which caches * the resulting information so dynamically creating here is not really an overhead. */ @Override public Model getCapabilities() { if (capabilities == null) { capabilities = ModelFactory.createDefaultModel(); Resource base = capabilities.createResource(getURI()); base.addProperty(ReasonerVocabulary.nameP, "RDFS FB-TGC Rule Reasoner") .addProperty(ReasonerVocabulary.descriptionP, "Complete RDFS implementation supporting metalevel statements.\n" + "Can separate tbox and abox data if desired to reuse tbox caching or mix them.") .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf) .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf) .addProperty(ReasonerVocabulary.supportsP, RDFS.member) .addProperty(ReasonerVocabulary.supportsP, RDFS.range) .addProperty(ReasonerVocabulary.supportsP, RDFS.domain) .addProperty(ReasonerVocabulary.versionP, "0.1"); } return capabilities; }
/** * Return a description of the capabilities of this reasoner encoded in * RDF. This method is normally called by the ReasonerRegistry which caches * the resulting information so dynamically creating here is not really an overhead. */ @Override public Model getCapabilities() { if (capabilities == null) { capabilities = ModelFactory.createDefaultModel(); Resource base = capabilities.createResource(getURI()); base.addProperty(ReasonerVocabulary.nameP, "RDFS FB-TGC Rule Reasoner") .addProperty(ReasonerVocabulary.descriptionP, "Complete RDFS implementation supporting metalevel statements.\n" + "Can separate tbox and abox data if desired to reuse tbox caching or mix them.") .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf) .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf) .addProperty(ReasonerVocabulary.supportsP, RDFS.member) .addProperty(ReasonerVocabulary.supportsP, RDFS.range) .addProperty(ReasonerVocabulary.supportsP, RDFS.domain) .addProperty(ReasonerVocabulary.versionP, "0.1"); } return capabilities; }
/** * Return a prebuilt standard configuration for the default RDFS reasoner */ public static Reasoner getRDFSReasoner() { if (theRDFSReasoner == null) theRDFSReasoner = RDFSRuleReasonerFactory.theInstance().create(null); return theRDFSReasoner; }
/** * Return a prebuilt simplified configuration for the default RDFS reasoner */ public static Reasoner getRDFSSimpleReasoner() { if (theRDFSSimpleReasoner == null) { theRDFSSimpleReasoner = RDFSRuleReasonerFactory.theInstance().create(null); theRDFSSimpleReasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, ReasonerVocabulary.RDFS_SIMPLE); } return theRDFSSimpleReasoner; }
/** * Return a prebuilt simplified configuration for the default RDFS reasoner */ public static Reasoner getRDFSSimpleReasoner() { if (theRDFSSimpleReasoner == null) { theRDFSSimpleReasoner = RDFSRuleReasonerFactory.theInstance().create(null); theRDFSSimpleReasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, ReasonerVocabulary.RDFS_SIMPLE); } return theRDFSSimpleReasoner; }
/** * Run test on findWithPremies for RDFS reasoner. */ public void testRDFSFindWithPremises() { doTestFindWithPremises(RDFSRuleReasonerFactory.theInstance()); }
/** * Test metalevel add/remove subproperty operations for rdsf reasoner. */ public void testRDFSMetaLevel() { doTestMetaLevel(RDFSRuleReasonerFactory.theInstance()); }
/** * Run test on findWithPremies for RDFS reasoner. */ public void testRDFSFindWithPremises() { doTestFindWithPremises(RDFSRuleReasonerFactory.theInstance()); }
/** * Test metalevel add/remove subproperty operations for rdsf reasoner. */ public void testRDFSMetaLevel() { doTestMetaLevel(RDFSRuleReasonerFactory.theInstance()); }
/** * Boilerplate for junit. * This is its own test suite */ public static TestSuite suite() { TestSuite suite = new TestSuite(); try { Resource config = newResource() .addProperty(ReasonerVocabulary.PROPsetRDFSLevel, "full"); constructRDFWGtests(suite, RDFSRuleReasonerFactory.theInstance(), config); } catch (IOException e) { // failed to even built the test harness logger.error("Failed to construct RDF WG test harness", e); } return suite; }
/** * Boilerplate for junit. * This is its own test suite */ public static TestSuite suite() { TestSuite suite = new TestSuite(); try { Resource config = newResource() .addProperty(ReasonerVocabulary.PROPsetRDFSLevel, "full"); constructRDFWGtests(suite, RDFSRuleReasonerFactory.theInstance(), config); } catch (IOException e) { // failed to even built the test harness logger.error("Failed to construct RDF WG test harness", e); } return suite; }
/** * Test a single RDFS case. */ public void hiddenTestRDFSReasonerDebug() throws IOException { ReasonerTester tester = new ReasonerTester("rdfs/manifest-nodirect-noresource.rdf"); ReasonerFactory rf = RDFSRuleReasonerFactory.theInstance(); assertTrue("RDFS hybrid-tgc reasoner test", tester.runTest("http://www.hpl.hp.com/semweb/2003/query_tester/rdfs/test11", rf, this, null)); }
/** * Test the basic functioning of the hybrid RDFS rule reasoner with TGC cache */ public void testRDFSExptReasoner() throws IOException { ReasonerTester tester = new ReasonerTester("rdfs/manifest-nodirect-noresource.rdf"); ReasonerFactory rf = RDFSRuleReasonerFactory.theInstance(); assertTrue("RDFS experimental (hybrid+tgc) reasoner tests", tester.runTests(rf, this, null)); }
/** * Test a single RDFS case. */ public void hiddenTestRDFSReasonerDebug() throws IOException { ReasonerTester tester = new ReasonerTester("rdfs/manifest-nodirect-noresource.rdf"); ReasonerFactory rf = RDFSRuleReasonerFactory.theInstance(); assertTrue("RDFS hybrid-tgc reasoner test", tester.runTest("http://www.hpl.hp.com/semweb/2003/query_tester/rdfs/test11", rf, this, null)); }
/** * Test the basic functioning of the hybrid RDFS rule reasoner with TGC cache */ public void testRDFSExptReasoner() throws IOException { ReasonerTester tester = new ReasonerTester("rdfs/manifest-nodirect-noresource.rdf"); ReasonerFactory rf = RDFSRuleReasonerFactory.theInstance(); assertTrue("RDFS experimental (hybrid+tgc) reasoner tests", tester.runTests(rf, this, null)); }
constructRDFWGtests(suite, RDFSRuleReasonerFactory.theInstance(), null); constructQuerytests(suite, "rdfs/manifest-standard.rdf", RDFSRuleReasonerFactory.theInstance(), config); suite.addTest(new TestRDFSMisc(RDFSRuleReasonerFactory.theInstance(), null)); constructQuerytests(suite, "rdfs/manifest.rdf", RDFSRuleReasonerFactory.theInstance(), configFull); constructQuerytests(suite, "rdfs/manifest-simple.rdf", RDFSRuleReasonerFactory.theInstance(), configSimple);
constructRDFWGtests(suite, RDFSRuleReasonerFactory.theInstance(), null); constructQuerytests(suite, "rdfs/manifest-standard.rdf", RDFSRuleReasonerFactory.theInstance(), config); suite.addTest(new TestRDFSMisc(RDFSRuleReasonerFactory.theInstance(), null)); constructQuerytests(suite, "rdfs/manifest.rdf", RDFSRuleReasonerFactory.theInstance(), configFull); constructQuerytests(suite, "rdfs/manifest-simple.rdf", RDFSRuleReasonerFactory.theInstance(), configSimple);
private Model createForwardChainingModel() { Model baseModel = ModelFactory.createDefaultModel(); Model schemaModel = ModelFactory.createDefaultModel(); Model configurationRuleReasoner = ModelFactory.createDefaultModel(); org.apache.jena.rdf.model.Resource configuration = configurationRuleReasoner.createResource(); configuration.addProperty(ReasonerVocabulary.PROPruleMode, "forward"); configuration.addProperty(ReasonerVocabulary.PROPsetRDFSLevel, ReasonerVocabulary.RDFS_SIMPLE); Reasoner ruleReasoner = RDFSRuleReasonerFactory.theInstance().create(configuration); InfModel inf = ModelFactory.createInfModel(ruleReasoner, schemaModel, baseModel); inf.read(new ByteArrayInputStream(TURTLE_RDF.getBytes()), "", "TURTLE"); return inf; }
/** * Constructor is hidden - go via theRegistry */ private ReasonerRegistry() { allDescriptions = ModelFactory.createDefaultModel(); // Preload the known Jena reasoners register(TransitiveReasonerFactory.theInstance()); register(RDFSRuleReasonerFactory.theInstance()); register(OWLFBRuleReasonerFactory.theInstance()); register(GenericRuleReasonerFactory.theInstance()); register(OWLMicroReasonerFactory.theInstance()); register(OWLMiniReasonerFactory.theInstance()); }