/** * Get the single static precomputed rule closure. */ @Override public synchronized InfGraph getPreload() { // Method synchronized - synchronize with other FBRulereasoer sync methods // synchronized block - sync on static synchronized (OWLFBRuleReasoner.class) { if (staticPreload == null) { boolean prior = JenaParameters.enableFilteringOfHiddenInfNodes; try { JenaParameters.enableFilteringOfHiddenInfNodes = true; staticPreload = new FBRuleInfGraph(this, rules, null); staticPreload.prepare(); } finally { JenaParameters.enableFilteringOfHiddenInfNodes = prior; } } return staticPreload; } }
/** * Get the single static precomputed rule closure. */ @Override public synchronized InfGraph getPreload() { // Method synchronized - synchronize with other FBRulereasoer sync methods // synchronized block - sync on static synchronized (OWLFBRuleReasoner.class) { if (staticPreload == null) { boolean prior = JenaParameters.enableFilteringOfHiddenInfNodes; try { JenaParameters.enableFilteringOfHiddenInfNodes = true; staticPreload = new FBRuleInfGraph(this, rules, null); staticPreload.prepare(); } finally { JenaParameters.enableFilteringOfHiddenInfNodes = prior; } } return staticPreload; } }
/** * Check cost of creating an empty OWL closure. */ public void temp() { Graph data = Factory.createGraphMem(); Graph data2 = Factory.createGraphMem(); Reasoner reasoner = new OWLFBRuleReasoner(OWLFBRuleReasonerFactory.theInstance()); FBRuleInfGraph infgraph = (FBRuleInfGraph)reasoner.bind(data); FBRuleInfGraph infgraph2 = (FBRuleInfGraph)reasoner.bind(data2); long t1 = System.currentTimeMillis(); infgraph.prepare(); long t2 = System.currentTimeMillis(); System.out.println("Prepare on empty graph = " + (t2-t1) +"ms"); t1 = System.currentTimeMillis(); infgraph2.prepare(); t2 = System.currentTimeMillis(); System.out.println("Prepare on empty graph = " + (t2-t1) +"ms"); }
/** * Check cost of creating an empty OWL closure. */ public void temp() { Graph data = Factory.createGraphMem(); Graph data2 = Factory.createGraphMem(); Reasoner reasoner = new OWLFBRuleReasoner(OWLFBRuleReasonerFactory.theInstance()); FBRuleInfGraph infgraph = (FBRuleInfGraph)reasoner.bind(data); FBRuleInfGraph infgraph2 = (FBRuleInfGraph)reasoner.bind(data2); long t1 = System.currentTimeMillis(); infgraph.prepare(); long t2 = System.currentTimeMillis(); System.out.println("Prepare on empty graph = " + (t2-t1) +"ms"); t1 = System.currentTimeMillis(); infgraph2.prepare(); t2 = System.currentTimeMillis(); System.out.println("Prepare on empty graph = " + (t2-t1) +"ms"); }
/** * Configure the inference graph ready for testing. */ public void init() { if (schema == null) { infgraph = reasoner.bind(testdata); } else { // infgraph = reasoner.bindSchema(schema).bind(testdata); infgraph = reasoner.bind(new Union(schema, testdata)); } // if (infgraph instanceof FBRuleInfGraph) { // ((FBRuleInfGraph)infgraph).resetLPProfile(true); // } if (infgraph instanceof FBRuleInfGraph) { System.out.println("Starting prepare"); ((FBRuleInfGraph)infgraph).prepare(); System.out.println(".. finished"); } }
/** * Configure the inference graph ready for testing. */ public void init() { if (schema == null) { infgraph = reasoner.bind(testdata); } else { // infgraph = reasoner.bindSchema(schema).bind(testdata); infgraph = reasoner.bind(new Union(schema, testdata)); } // if (infgraph instanceof FBRuleInfGraph) { // ((FBRuleInfGraph)infgraph).resetLPProfile(true); // } if (infgraph instanceof FBRuleInfGraph) { System.out.println("Starting prepare"); ((FBRuleInfGraph)infgraph).prepare(); System.out.println(".. finished"); } }
/** * 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 { if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an OWLRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); graph.prepare(); FBRuleReasoner fbr = new FBRuleReasoner(rules, graph, factory); fbr.setDerivationLogging(recordDerivations); fbr.setTraceOn(traceOn); return fbr; }
/** * 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 { if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an OWLRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); graph.prepare(); FBRuleReasoner fbr = new FBRuleReasoner(rules, graph, factory); fbr.setDerivationLogging(recordDerivations); fbr.setTraceOn(traceOn); return fbr; }
/** * 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 { checkArgGraph(tbox); if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an OWLRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); graph.addPreprocessingHook(new OWLRuleTranslationHook()); graph.prepare(); return new OWLFBRuleReasoner(this, graph); }
/** * 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 { checkArgGraph(tbox); if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an OWLRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); graph.addPreprocessingHook(new OWLRuleTranslationHook()); graph.prepare(); return new OWLFBRuleReasoner(this, graph); }
/** * 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 { if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an RDFSRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); if (enableTGCCaching) (graph).setUseTGCCache(); graph.prepare(); RDFSRuleReasoner grr = new RDFSRuleReasoner(graph, factory); grr.setDerivationLogging(recordDerivations); grr.setTraceOn(traceOn); grr.setTransitiveClosureCaching(enableTGCCaching); grr.setFunctorFiltering(filterFunctors); if (preprocessorHooks != null) { for (RulePreprocessHook rulePreprocessHook : preprocessorHooks) { grr.addPreprocessingHook(rulePreprocessHook); } } return grr; }
/** * 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 { if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an RDFSRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); if (enableTGCCaching) (graph).setUseTGCCache(); graph.prepare(); RDFSRuleReasoner grr = new RDFSRuleReasoner(graph, factory); grr.setDerivationLogging(recordDerivations); grr.setTraceOn(traceOn); grr.setTransitiveClosureCaching(enableTGCCaching); grr.setFunctorFiltering(filterFunctors); if (preprocessorHooks != null) { for (RulePreprocessHook rulePreprocessHook : preprocessorHooks) { grr.addPreprocessingHook(rulePreprocessHook); } } return grr; }
graph = new FBRuleInfGraph(this, ruleSet, getPreload(), tbox); if (enableTGCCaching) ((FBRuleInfGraph)graph).setUseTGCCache(); ((FBRuleInfGraph)graph).prepare();
graph = new FBRuleInfGraph(this, ruleSet, getPreload(), tbox); if (enableTGCCaching) ((FBRuleInfGraph)graph).setUseTGCCache(); ((FBRuleInfGraph)graph).prepare();
FBRuleInfGraph infgraph = (FBRuleInfGraph) createInfGraph(rules, data); infgraph.setDerivationLogging(true); infgraph.prepare(); assertTrue("Forward rule count", infgraph.getNRulesFired() == 3); TestUtil.assertIteratorValues(this,
FBRuleInfGraph infgraph = (FBRuleInfGraph) createInfGraph(rules, data); infgraph.setDerivationLogging(true); infgraph.prepare(); assertTrue("Forward rule count", infgraph.getNRulesFired() == 3); TestUtil.assertIteratorValues(this,