public Version(TransactionData data) { this.addedTriples = data.getAddedTriples(); this.removedTriples = data.getRemovedTriples(); this.commitTime = data.getCommitTime(); }
/** * Incrementally apply the updates that are contained in the transaction * data to the reasoning programs that are in the system. * <p/> * Called after a transaction has committed. The transaction data will contain all changes done in the transaction since * the last commit. This method should be used in case the transaction listener aims to perform additional activities * in a new transaction or outside the transaction management, e.g. notifying a server on the network, adding * data to a cache, or similar. * * @param data */ @Override public void afterCommit(TransactionData data) { if( (data.getAddedTriples().size() > 0 || data.getRemovedTriples().size() > 0) && patternRuleMap.size() > 0) { reasoningQueue.remove(data); if (!reasoningQueue.offer(data)) { log.info("waiting for reasoning queue to become available ..."); try { reasoningQueue.put(data); log.info("reasoning queue available, added data"); } catch (InterruptedException e) { log.error("interrupted while waiting for reasoning queue to become available ..."); } } } }
/** * Incrementally apply the updates that are contained in the transaction * data to the reasoning programs that are in the system. * <p/> * Called after a transaction has committed. The transaction data will contain all changes done in the transaction since * the last commit. This method should be used in case the transaction listener aims to perform additional activities * in a new transaction or outside the transaction management, e.g. notifying a server on the network, adding * data to a cache, or similar. * * @param data */ @Override public void afterCommit(TransactionData data) { if( (data.getAddedTriples().size() > 0 || data.getRemovedTriples().size() > 0) && patternRuleMap.size() > 0) { reasoningQueue.remove(data); if (!reasoningQueue.offer(data)) { log.info("waiting for reasoning queue to become available ..."); try { reasoningQueue.put(data); log.info("reasoning queue available, added data"); } catch (InterruptedException e) { log.error("interrupted while waiting for reasoning queue to become available ..."); } } } }
updateTaskStatus("fetching worklist"); Set<KiWiTriple> newTriples = StatementCommons.newQuadrupleSet(); for(Statement stmt : data.getAddedTriples()) { KiWiTriple t = (KiWiTriple)stmt; if(t.isNewTriple()) {
updateTaskStatus("fetching worklist"); Set<KiWiTriple> newTriples = StatementCommons.newQuadrupleSet(); for(Statement stmt : data.getAddedTriples()) { KiWiTriple t = (KiWiTriple)stmt; if(t.isNewTriple()) {
/** * Notify the listeners of a commit before and after calling the super method * @throws SailException */ @Override public void commit() throws SailException { // notify only if there is actually any data if(data != null && data.getAddedTriples().size() + data.getRemovedTriples().size() > 0) { data.setCommitTime(new Date()); // notify beforeCommit listeners for(TransactionListener l : listeners) { l.beforeCommit(data); } // perform commit super.commit(); // notify afterCommit listeners for(TransactionListener l : listeners) { l.afterCommit(data); } } else { super.commit(); } // empty transaction data data = new TransactionData(); }
/** * Notify the listeners of a commit before and after calling the super method * @throws SailException */ @Override public void commit() throws SailException { // notify only if there is actually any data if(data != null && data.getAddedTriples().size() + data.getRemovedTriples().size() > 0) { data.setCommitTime(new Date()); // notify beforeCommit listeners for(TransactionListener l : listeners) { l.beforeCommit(data); } // perform commit super.commit(); // notify afterCommit listeners for(TransactionListener l : listeners) { l.afterCommit(data); } } else { super.commit(); } // empty transaction data data = new TransactionData(); }
if(data.getAddedTriples().size() > 0 || data.getRemovedTriples().size() > 0) { Version version = new Version(); for(Statement stmt : data.getAddedTriples()) { if(filter.accept(stmt)) { version.getAddedTriples().add(stmt);