I have gotten my first chance to look at building a rule base reasoner and
was wondering why updates to the data graph are not processed by the
reasoner.  My code:

@Test
public void testSubClassOf()
{
Model model = ModelFactory.createDefaultModel();

// create a resource (empty resource)
Resource config = model.createResource();

// set engine mode
config.addProperty(ReasonerVocabulary.PROPruleMode, "hybrid");

config.addProperty(ReasonerVocabulary.PROPruleSet, "etc/rdfs-fb.rules");
 Reasoner reasoner = GenericRuleReasonerFactory
.theInstance().create(config);

Graph graph = GraphFactory.createGraphMem();
InfGraph infGraph = reasoner.bind( graph );
 Node n1 = Node.createURI( "http://example.com/p1";);
Node n2 = Node.createURI( "http://example.com/p2";);
Node n3 = Node.createURI( "http://example.com/p3";);
graph.add( new Triple( n1, RDFS.subClassOf.asNode(), n2 ));
 Assert.assertTrue( infGraph.contains( n1, RDFS.subClassOf.asNode(), n2 ));
 System.out.println( "Adding triple ");
graph.add( new Triple( n2, RDFS.subClassOf.asNode(), n3));
 Assert.assertTrue( infGraph.contains( n1, RDFS.subClassOf.asNode(), n2 ));
Assert.assertTrue( infGraph.contains( n2, RDFS.subClassOf.asNode(), n3 ));
Assert.assertTrue( infGraph.contains( n1, RDFS.subClassOf.asNode(), n3 ));

}

fails on the last Assert.  However if I change "graph.add( new Triple( n2,
RDFS.subClassOf.asNode(), n3));"
to "infGraph.add( new Triple( n2, RDFS.subClassOf.asNode(), n3));" it works
as expected.

Shouldn't the infGraph listen to the changes in the underlying graph and
update the reasoned triples accordingly or am I missing something ?

Thx,
Claude
-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
Identity: https://www.identify.nu/user.php?cla...@xenei.com
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to