public void testMockReasonersDifferent() { Reasoner R = GenericRuleReasonerFactory.theInstance().create( null ); assertNotSame( mockReasonerFactory( R ), mockReasonerFactory( R ) ); }
/** * 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, "Generic Rule Reasoner") .addProperty(ReasonerVocabulary.descriptionP, "Generic rule reasoner, configurable") .addProperty(ReasonerVocabulary.versionP, "0.1"); } return capabilities; }
protected ReasonerFactory getReasonerFactory( Assembler a, Resource root ) { Resource factory = getUniqueResource( root, JA.reasoner ); return factory == null ? GenericRuleReasonerFactory.theInstance() : (ReasonerFactory) a.open( factory ) ; } }
protected ReasonerFactory getReasonerFactory( Assembler a, Resource root ) { Resource factory = getUniqueResource( root, JA.reasoner ); return factory == null ? GenericRuleReasonerFactory.theInstance() : (ReasonerFactory) a.open( factory ) ; } }
public void testMockReasonersDifferent() { Reasoner R = GenericRuleReasonerFactory.theInstance().create( null ); assertNotSame( mockReasonerFactory( R ), mockReasonerFactory( R ) ); }
protected static ReasonerFactory getReasonerFactory( Resource root ) { Resource reasonerURL = getUniqueResource( root, JA.reasonerURL ); String className = getOptionalClassName( root ); return className != null ? getReasonerFactoryByClassName( root, className ) : reasonerURL == null ? GenericRuleReasonerFactory.theInstance() : getReasonerFactoryByURL( root, reasonerURL ) ; }
/** * 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, "Generic Rule Reasoner") .addProperty(ReasonerVocabulary.descriptionP, "Generic rule reasoner, configurable") .addProperty(ReasonerVocabulary.versionP, "0.1"); } return capabilities; }
public void testGetsReasoner() { Reasoner R = GenericRuleReasonerFactory.theInstance().create( null ); final ReasonerFactory RF = mockReasonerFactory( R ); Assembler mock = new FixedObjectAssembler( RF ); Resource root = resourceInModel( "x rdf:type ja:InfModel; x ja:reasoner R" ); InfModel m = (InfModel) Assembler.infModel.open( mock, root ); assertSame( R, m.getReasoner() ); }
protected static ReasonerFactory getReasonerFactory( Resource root ) { Resource reasonerURL = getUniqueResource( root, JA.reasonerURL ); String className = getOptionalClassName( root ); return className != null ? getReasonerFactoryByClassName( root, className ) : reasonerURL == null ? GenericRuleReasonerFactory.theInstance() : getReasonerFactoryByURL( root, reasonerURL ) ; }
public void testGetsReasoner() { Reasoner R = GenericRuleReasonerFactory.theInstance().create( null ); final ReasonerFactory RF = mockReasonerFactory( R ); Assembler mock = new FixedObjectAssembler( RF ); Resource root = resourceInModel( "x rdf:type ja:InfModel; x ja:reasoner R" ); InfModel m = (InfModel) Assembler.infModel.open( mock, root ); assertSame( R, m.getReasoner() ); }
/** * The test runner */ @Override protected void runTest() throws IOException { OWLWGTester tester = new OWLWGTester(GenericRuleReasonerFactory.theInstance(), this, configuration); // OWLWGTester tester = new OWLWGTester(OWLExptRuleReasonerFactory.theInstance(), this, null); tester.runTests(manifest, enableTracing, printStats); }
configuration.addProperty(ReasonerVocabulary.PROPruleSet, fileloc); Reasoner reasoner = GenericRuleReasonerFactory.theInstance().create(configuration);
/** * The test runner */ @Override protected void runTest() throws IOException { OWLWGTester tester = new OWLWGTester(GenericRuleReasonerFactory.theInstance(), this, configuration); // OWLWGTester tester = new OWLWGTester(OWLExptRuleReasonerFactory.theInstance(), this, null); tester.runTests(manifest, enableTracing, printStats); }
/** * Test early detection of illegal backward rules. */ public void testBRuleErrorHandling() { Graph data = Factory.createGraphMem(); List<Rule> rules = Rule.parseRules( "[a1: -> [(?x eg:p ?y) (?x eg:q ?y) <- (?x eg:r ?y)]]" ); boolean foundException = false; try { GenericRuleReasoner reasoner = (GenericRuleReasoner)GenericRuleReasonerFactory.theInstance().create(null); reasoner.setRules(rules); reasoner.setMode(GenericRuleReasoner.HYBRID); InfGraph infgraph = reasoner.bind(data); infgraph.prepare(); } catch (ReasonerException e) { foundException = true; } assertTrue("Catching use of multi-headed brules", foundException); }
/** * 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()); }
/** * Test early detection of illegal backward rules. */ public void testBRuleErrorHandling() { Graph data = Factory.createGraphMem(); List<Rule> rules = Rule.parseRules( "[a1: -> [(?x eg:p ?y) (?x eg:q ?y) <- (?x eg:r ?y)]]" ); boolean foundException = false; try { GenericRuleReasoner reasoner = (GenericRuleReasoner)GenericRuleReasonerFactory.theInstance().create(null); reasoner.setRules(rules); reasoner.setMode(GenericRuleReasoner.HYBRID); InfGraph infgraph = reasoner.bind(data); infgraph.prepare(); } catch (ReasonerException e) { foundException = true; } assertTrue("Catching use of multi-headed brules", foundException); }
/** * 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()); }
/** * Test recursive rules involving functors. * May lock up in there is a bug. * TODO: arrange test to run in a separate thread with a timeout */ public void doTestFunctorLooping(RuleMode mode) { Graph data = Factory.createGraphMem(); data.add(new Triple(a, r, b)); List<Rule> rules = Rule.parseRules( "(?x r ?y) -> (?x p func(?x)). (?x p ?y) -> (?x p func(?x))." ); GenericRuleReasoner reasoner = (GenericRuleReasoner)GenericRuleReasonerFactory.theInstance().create(null); reasoner.setRules(rules); reasoner.setMode(mode); InfGraph infgraph = reasoner.bind(data); // The p should have been asserted but is invisible assertFalse( infgraph.contains(Node.ANY, p, Node.ANY) ); }
/** * Test recursive rules involving functors. * May lock up in there is a bug. * TODO: arrange test to run in a separate thread with a timeout */ public void doTestFunctorLooping(RuleMode mode) { Graph data = Factory.createGraphMem(); data.add(new Triple(a, r, b)); List<Rule> rules = Rule.parseRules( "(?x r ?y) -> (?x p func(?x)). (?x p ?y) -> (?x p func(?x))." ); GenericRuleReasoner reasoner = (GenericRuleReasoner)GenericRuleReasonerFactory.theInstance().create(null); reasoner.setRules(rules); reasoner.setMode(mode); InfGraph infgraph = reasoner.bind(data); // The p should have been asserted but is invisible assertFalse( infgraph.contains(Node.ANY, p, Node.ANY) ); }
Reasoner reasoner = GenericRuleReasonerFactory.theInstance().create(configuration); InfModel conclusions = ModelFactory.createInfModel(reasoner, premises);