*/
private static void updateWorkingGraph(Store store, Source identity, Date now, final Source aggregatedSource, final Graph logEntryGraph) {
store.perform(identity, new StoreTransaction() {
public void execute(SourceStoreView storeView) {
SimpleGraph newWorkingGraph = new SimpleGraph();
FCAGraph oldWorkingGraph = storeView.getGraph();
Node downloadAttemptNode = null;
for (Triple triple : oldWorkingGraph) {
if (triple.getObject().equals(aggregatedSource) &&
triple.getPredicate().getURIRef().equals(AGGREGATOR.aggregatedSource.getURI())) {
downloadAttemptNode = triple.getSubject();
break;
}
}
for (Iterator<Triple> iter = oldWorkingGraph.iterator(); iter.hasNext();) {
Triple triple = iter.next();
//x.equals(null) should return false, making the first condition obsolete
if ((downloadAttemptNode == null) || !triple.getSubject().equals(downloadAttemptNode)) {
newWorkingGraph.add(triple);
}
}
newWorkingGraph.addAll(logEntryGraph);
newWorkingGraph.markFinalized();
storeView.revokeAll();
storeView.assertGraph(new FCAGraphImpl(newWorkingGraph));
}
});