/** * Precompute the implications of a schema graph. The statements in the graph * will be combined with the data when the final InfGraph is created. */ @Override public Reasoner bindSchema(Graph tbox) throws ReasonerException { InfGraph graph = new BasicForwardRuleInfGraph(this, rules, null, tbox); return new BasicForwardRuleReasoner(rules, graph, factory); }
/** * Precompute the implications of a schema graph. The statements in the graph * will be combined with the data when the final InfGraph is created. */ @Override public Reasoner bindSchema(Graph tbox) throws ReasonerException { InfGraph graph = new BasicForwardRuleInfGraph(this, rules, null, tbox); return new BasicForwardRuleReasoner(rules, graph, factory); }
/** * Precompute the implications of a schema Model. The statements in the graph * will be combined with the data when the final InfGraph is created. */ @Override public Reasoner bindSchema(Model tbox) throws ReasonerException { InfGraph graph = new BasicForwardRuleInfGraph(this, rules, null, tbox.getGraph()); return new BasicForwardRuleReasoner(rules, graph, factory); }
/** * Precompute the implications of a schema Model. The statements in the graph * will be combined with the data when the final InfGraph is created. */ @Override public Reasoner bindSchema(Model tbox) throws ReasonerException { InfGraph graph = new BasicForwardRuleInfGraph(this, rules, null, tbox.getGraph()); return new BasicForwardRuleReasoner(rules, graph, factory); }
/** * Attach the reasoner to a set of RDF data to process. * The reasoner may already have been bound to specific rules or ontology * axioms (encoded in RDF) through earlier bindRuleset calls. * * @param data the RDF data to be processed, some reasoners may restrict * the range of RDF which is legal here (e.g. syntactic restrictions in OWL). * @return an inference graph through which the data+reasoner can be queried. * @throws ReasonerException if the data is ill-formed according to the * constraints imposed by this reasoner. */ @Override public InfGraph bind(Graph data) throws ReasonerException { BasicForwardRuleInfGraph graph = new BasicForwardRuleInfGraph(this, rules, schemaGraph); graph.setDerivationLogging(recordDerivations); graph.setTraceOn(traceOn); graph.rebind(data); return graph; }
/** * Attach the reasoner to a set of RDF data to process. * The reasoner may already have been bound to specific rules or ontology * axioms (encoded in RDF) through earlier bindRuleset calls. * * @param data the RDF data to be processed, some reasoners may restrict * the range of RDF which is legal here (e.g. syntactic restrictions in OWL). * @return an inference graph through which the data+reasoner can be queried. * @throws ReasonerException if the data is ill-formed according to the * constraints imposed by this reasoner. */ @Override public InfGraph bind(Graph data) throws ReasonerException { BasicForwardRuleInfGraph graph = new BasicForwardRuleInfGraph(this, rules, schemaGraph); graph.setDerivationLogging(recordDerivations); graph.setTraceOn(traceOn); graph.rebind(data); return graph; }
/** * Perform a rule test on the raw RETE engine. This requires some fiddling * with dummy parent graphs. */ private void doRuleTest(String rules, Triple[] adds, Triple[] expected) { List<Rule> ruleList = Rule.parseRules(rules); BasicForwardRuleInfGraph infgraph = new BasicForwardRuleInfGraph(null, new ArrayList<Rule>(), null, Factory.createGraphMem()); // infgraph.setTraceOn(true); RETEEngine engine = new RETEEngine(infgraph, ruleList); infgraph.prepare(); engine.init(true, new FGraph(Factory.createGraphMem())); for ( Triple add : adds ) { engine.addTriple( add, true ); } engine.runAll(); TestUtil.assertIteratorValues(this, infgraph.find(null, null, null), expected); }
/** * Perform a rule test on the raw RETE engine. This requires some fiddling * with dummy parent graphs. */ private void doRuleTest(String rules, Triple[] adds, Triple[] expected) { List<Rule> ruleList = Rule.parseRules(rules); BasicForwardRuleInfGraph infgraph = new BasicForwardRuleInfGraph(null, new ArrayList<Rule>(), null, Factory.createGraphMem()); // infgraph.setTraceOn(true); RETEEngine engine = new RETEEngine(infgraph, ruleList); infgraph.prepare(); engine.init(true, new FGraph(Factory.createGraphMem())); for ( Triple add : adds ) { engine.addTriple( add, true ); } engine.runAll(); TestUtil.assertIteratorValues(this, infgraph.find(null, null, null), expected); }
graph = new BasicForwardRuleInfGraph(this, rules, null, tbox); ((InfGraph)graph).prepare(); } else if (mode == FORWARD_RETE) {
graph = new BasicForwardRuleInfGraph(this, rules, null, tbox); ((InfGraph)graph).prepare(); } else if (mode == FORWARD_RETE) {
InfGraph graph = null; if (mode == FORWARD) { graph = new BasicForwardRuleInfGraph(this, rules, schemaArg); ((BasicForwardRuleInfGraph)graph).setTraceOn(traceOn); } else if (mode == FORWARD_RETE) {
InfGraph graph = null; if (mode == FORWARD) { graph = new BasicForwardRuleInfGraph(this, rules, schemaArg); ((BasicForwardRuleInfGraph)graph).setTraceOn(traceOn); } else if (mode == FORWARD_RETE) {
env.reset(MAX_VARS); List<Rule> rules = new ArrayList<>(); BasicForwardRuleInfGraph inf = new BasicForwardRuleInfGraph( new BasicForwardRuleReasoner(rules), rules, null); TriplePattern p1 = new TriplePattern(
env.reset(MAX_VARS); List<Rule> rules = new ArrayList<>(); BasicForwardRuleInfGraph inf = new BasicForwardRuleInfGraph( new BasicForwardRuleReasoner(rules), rules, null); TriplePattern p1 = new TriplePattern(