/** * Cause the inference model to reconsult the underlying data to take * into account changes. Normally changes are made through the InfModel's add and * remove calls are will be handled appropriately. However, in some cases changes * are made "behind the InfModels's back" and this forces a full reconsult of * the changed data. */ @Override public void rebind() { getInfGraph().rebind(); }
/** * Cause the inference model to reconsult the underlying data to take * into account changes. Normally changes are made through the InfModel's add and * remove calls are will be handled appropriately. However, in some cases changes * are made "behind the InfModels's back" and this forces a full reconsult of * the changed data. */ @Override public void rebind() { getInfGraph().rebind(); }
/** * Cause the inference model to reconsult the underlying data to take * into account changes. Normally changes are made through the InfModel's add and * remove calls are will be handled appropriately. However, in some cases changes * are made "behind the InfModels's back" and this forces a full reconsult of * the changed data. */ @Override public void rebind() { if (getGraph() instanceof InfGraph) { ((InfGraph) getGraph()).rebind(); } }
/** * Cause the inference model to reconsult the underlying data to take * into account changes. Normally changes are made through the InfModel's add and * remove calls are will be handled appropriately. However, in some cases changes * are made "behind the InfModels's back" and this forces a full reconsult of * the changed data. */ @Override public void rebind() { if (getGraph() instanceof InfGraph) { ((InfGraph) getGraph()).rebind(); } }
graph.rebind(data); return graph;
graph.rebind(data); return graph;
((InfGraph) graph).rebind() ;
((InfGraph) graph).rebind() ;
graph.rebind(data); return graph;
graph.rebind(data); return graph;
/** * Test the rebind operation. */ public void testRebind() { String rules = "[rule1: (?x p ?y) -> (?x q ?y)]"; Graph data = Factory.createGraphMem(); data.add(new Triple(n1, p, n2)); InfGraph infgraph = createInfGraph(rules, data); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n2), new Triple(n1, q, n2) }); Graph ndata = Factory.createGraphMem(); ndata.add(new Triple(n1, p, n3)); infgraph.rebind(ndata); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n3), new Triple(n1, q, n3) }); }
/** * Test the rebind operation. */ public void testRebind() { String rules = "[rule1: (?x p ?y) -> (?x q ?y)]"; Graph data = Factory.createGraphMem(); data.add(new Triple(n1, p, n2)); InfGraph infgraph = createInfGraph(rules, data); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n2), new Triple(n1, q, n2) }); Graph ndata = Factory.createGraphMem(); ndata.add(new Triple(n1, p, n3)); infgraph.rebind(ndata); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n3), new Triple(n1, q, n3) }); }
/** * Test the rebind operation. */ public void testRebind() { String rules = "[rule1: (?x p ?y) -> (?x q ?y)]"; List<Rule> ruleList = Rule.parseRules(rules); Graph data = Factory.createGraphMem(); data.add(new Triple(n1, p, n2)); InfGraph infgraph = new BasicForwardRuleReasoner(ruleList).bind(data); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n2), new Triple(n1, q, n2) }); Graph ndata = Factory.createGraphMem(); ndata.add(new Triple(n1, p, n3)); infgraph.rebind(ndata); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n3), new Triple(n1, q, n3) }); }
/** * Test the rebind operation. */ public void testRebind() { String rules = "[rule1: (?x p ?y) -> (?x q ?y)]"; List<Rule> ruleList = Rule.parseRules(rules); Graph data = Factory.createGraphMem(); data.add(new Triple(n1, p, n2)); InfGraph infgraph = new BasicForwardRuleReasoner(ruleList).bind(data); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n2), new Triple(n1, q, n2) }); Graph ndata = Factory.createGraphMem(); ndata.add(new Triple(n1, p, n3)); infgraph.rebind(ndata); TestUtil.assertIteratorValues(this, infgraph.find(n1, null, null), new Triple[] { new Triple(n1, p, n3), new Triple(n1, q, n3) }); }
/** * Test rebind operation */ public void testRebind() { List<Rule> rules = Rule.parseRules("[r1: (?a r ?c) <- (?a p ?b),(?b p ?c)]"); Graph data = Factory.createGraphMem(); data.add(new Triple(a, p, b)); data.add(new Triple(b, p, c)); data.add(new Triple(b, p, d)); Reasoner reasoner = createReasoner(rules); InfGraph infgraph = reasoner.bind(data); TestUtil.assertIteratorValues(this, infgraph.find(null, r, null), new Object[] { new Triple(a, r, c), new Triple(a, r, d) } ); Graph ndata = Factory.createGraphMem(); ndata.add(new Triple(a, p, d)); ndata.add(new Triple(d, p, b)); infgraph.rebind(ndata); TestUtil.assertIteratorValues(this, infgraph.find(null, r, null), new Object[] { new Triple(a, r, b) } ); }
/** * Test rebind operation */ public void testRebind() { List<Rule> rules = Rule.parseRules("[r1: (?a r ?c) <- (?a p ?b),(?b p ?c)]"); Graph data = Factory.createGraphMem(); data.add(new Triple(a, p, b)); data.add(new Triple(b, p, c)); data.add(new Triple(b, p, d)); Reasoner reasoner = createReasoner(rules); InfGraph infgraph = reasoner.bind(data); TestUtil.assertIteratorValues(this, infgraph.find(null, r, null), new Object[] { new Triple(a, r, c), new Triple(a, r, d) } ); Graph ndata = Factory.createGraphMem(); ndata.add(new Triple(a, p, d)); ndata.add(new Triple(d, p, b)); infgraph.rebind(ndata); TestUtil.assertIteratorValues(this, infgraph.find(null, r, null), new Object[] { new Triple(a, r, b) } ); }
data2.add( new Triple(C1, RDFS.subClassOf.asNode(), C2) ); data2.add( new Triple(C2, RDFS.subClassOf.asNode(), C4) ); infgraph.rebind(data2); TestUtil.assertIteratorValues(this, infgraph.find(C1, RDFS.subClassOf.asNode(), null),
data2.add( new Triple(C1, RDFS.subClassOf.asNode(), C2) ); data2.add( new Triple(C2, RDFS.subClassOf.asNode(), C4) ); infgraph.rebind(data2); TestUtil.assertIteratorValues(this, infgraph.find(C1, RDFS.subClassOf.asNode(), null),
data2.add( new Triple(C1, RDFS.subClassOf.asNode(), C2) ); data2.add( new Triple(C2, RDFS.subClassOf.asNode(), C4) ); infgraph.rebind(data2);
data2.add( new Triple(C1, RDFS.subClassOf.asNode(), C2) ); data2.add( new Triple(C2, RDFS.subClassOf.asNode(), C4) ); infgraph.rebind(data2);