@Override public void endRDF() throws RDFHandlerException { for (final HandlerScript script : this.allScripts) { script.doEnd(this.pass); } ++this.pass; super.endRDF(); }
@Override public synchronized void startRDF() throws RDFHandlerException { super.startRDF(); this.script.doStart(this.pass); }
@Override public void close() { try { if (this.session != null) { this.session.dispose(); this.session = null; } } finally { super.close(); } }
@Override public void handleStatement(final Statement stmt) throws RDFHandlerException { if (!RDF.TYPE.equals(stmt.getPredicate()) || !(stmt.getObject() instanceof BNode)) { super.handleStatement(stmt); } }
@Override public void handleStatement(final Statement stmt) throws RDFHandlerException { super.handleStatement(Statements.VALUE_FACTORY.createStatement( stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), uri)); }
@Override public synchronized void endRDF() throws RDFHandlerException { this.script.doEnd(this.pass++); super.endRDF(); }
@Override public void startRDF() throws RDFHandlerException { super.startRDF(); for (final HandlerScript script : this.allScripts) { script.doStart(this.pass); } }
@Override public void endRDF() throws RDFHandlerException { this.session.fireAllRules(); if (LOGGER.isDebugEnabled()) { final StringBuilder builder = new StringBuilder(); builder.append("Inference completed in ") .append(System.currentTimeMillis() - this.timestamp).append(" ms, ") .append(this.session.getFactCount() - this.initialSize) .append(" quads total"); // for (int i = 0; i < Engine.this.ruleIDs.size(); ++i) { // if (this.activations[i] > 0) { // builder.append("\n- ").append(Engine.this.ruleIDs.get(i)).append(": ") // .append(this.activations[i]); // } // } LOGGER.debug(builder.toString()); } super.endRDF(); this.session.dispose(); this.session = null; }
@Override public void startRDF() throws RDFHandlerException { super.startRDF(); this.timestamp = System.currentTimeMillis(); this.activations = new long[Engine.this.ruleIDs.size()]; this.session = Engine.this.container.newKieSession(); this.session.setGlobal("handler", this); this.session.setGlobal("callback", this.callback); for (final Quad axiom : Engine.this.axioms) { this.session.insert(axiom); } this.initialSize = this.session.getFactCount(); }