Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-59

Couple bugs in Delta

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Done
    • None
    • Jena 2.11.0
    • Jena
    • None

    Description

      Transferred from http://sourceforge.net/tracker/?func=detail&aid=3284907&group_id=40417&atid=537167

      re: com.hp.hpl.jena.graph.compose.Delta

      • Delta remove() should not modify base graph.
      • Delta.performAdd(t) and performDelete(t) should not fill up L and R with redundant statements because graphBaseSize() will return the wrong answer.

      Here are fixed versions of these methods (sorry I don't have a patch file; I don't know which directory to checkout and checking out everything takes too long and I'm still waiting for Ctrl-C to finish)

      @Override public void performAdd(Triple t) {
      if (!base.contains(t))
      L.add(t);
      R.delete(t);
      }
      @Override public void performDelete(Triple t) {
      L.delete(t);
      if (base.contains(t))
      R.add(t);
      }

      public class RemoveAppendsToDeletionsIterator extends TrackingTripleIterator {
      public RemoveAppendsToDeletionsIterator(Iterator<Triple> it)

      { super(it); }

      @Override
      public void remove() {
      if (null == current)
      throw new IllegalStateException();
      getDeletions().add(current);
      current = null;
      }
      }
      @Override
      public ExtendedIterator<Triple> graphBaseFind(TripleMatch tm) {
      return new RemoveAppendsToDeletionsIterator(base.find(tm)).filterDrop(ifIn(GraphUtil.findAll(R))).andThen(L.find(tm));
      }

      Attachments

        Activity

          People

            andy Andy Seaborne
            andy Andy Seaborne
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: