Examples of RecordIterator


Examples of org.openrdf.sail.nativerdf.btree.RecordIterator

  }

  public int removeTriples(int subj, int pred, int obj, int context)
    throws IOException
  {
    RecordIterator iter = getTriples(subj, pred, obj, context, 0, 0);
    return removeTriples(iter);
  }
View Full Code Here

Examples of org.openrdf.sail.nativerdf.btree.RecordIterator

   */
  public int removeTriples(int subj, int pred, int obj, int context, boolean explicit)
    throws IOException
  {
    byte flags = explicit ? EXPLICIT_FLAG : 0;
    RecordIterator iter = getTriples(subj, pred, obj, context, flags, EXPLICIT_FLAG);
    return removeTriples(iter);
  }
View Full Code Here

Examples of org.openrdf.sail.nativerdf.btree.RecordIterator

      updatedTriplesCache.storeRecords(removedTriplesCache);

      for (TripleIndex index : indexes) {
        BTree btree = index.getBTree();

        RecordIterator recIter = removedTriplesCache.getRecords();
        try {
          while ((data = recIter.next()) != null) {
            btree.insert(data);
          }
        }
        finally {
          recIter.close();
        }
      }
    }
    finally {
      removedTriplesCache.discard();
View Full Code Here

Examples of org.openrdf.sail.nativerdf.btree.RecordIterator

      iter.close();

      for (TripleIndex index : indexes) {
        BTree btree = index.getBTree();

        RecordIterator recIter = recordCache.getRecords();
        try {
          while ((data = recIter.next()) != null) {
            btree.remove(data);
          }
        }
        finally {
          recIter.close();
        }
      }
    }
    finally {
      recordCache.discard();
View Full Code Here

Examples of org.openrdf.sail.nativerdf.btree.RecordIterator

  public void commit()
    throws IOException
  {
    if (txnRemovedTriples) {
      RecordIterator iter = getTriples(-1, -1, -1, -1, REMOVED_FLAG, REMOVED_FLAG);
      try {
        discardTriples(iter);
      }
      finally {
        txnRemovedTriples = false;
        iter.close();
      }
    }

    boolean validCache = updatedTriplesCache.isValid();

    for (TripleIndex index : indexes) {
      BTree btree = index.getBTree();

      RecordIterator iter;
      if (validCache) {
        // Use the cached set of updated triples
        iter = updatedTriplesCache.getRecords();
      }
      else {
        // Cache is invalid; too much updates(?). Iterate over all triples
        iter = btree.iterateAll();
      }

      try {
        byte[] data = null;
        while ((data = iter.next()) != null) {
          byte flags = data[FLAG_IDX];
          boolean added = (flags & ADDED_FLAG) != 0;
          boolean removed = (flags & REMOVED_FLAG) != 0;
          boolean toggled = (flags & TOGGLE_EXPLICIT_FLAG) != 0;

          if (removed) {
            // Record has been discarded earlier, do not put it back in!
            continue;
          }

          if (added || toggled) {
            if (toggled) {
              data[FLAG_IDX] ^= EXPLICIT_FLAG;
            }
            if (added) {
              data[FLAG_IDX] ^= ADDED_FLAG;
            }

            if (validCache) {
              // We're iterating the cache
              btree.insert(data);
            }
            else {
              // We're iterating the BTree itself
              iter.set(data);
            }
          }
        }
      }
      finally {
        iter.close();
      }
    }

    updatedTriplesCache.discard();
    updatedTriplesCache = null;
View Full Code Here

Examples of org.openrdf.sail.nativerdf.btree.RecordIterator

  public void rollback()
    throws IOException
  {
    if (txnAddedTriples) {
      RecordIterator iter = getTriples(-1, -1, -1, -1, ADDED_FLAG, ADDED_FLAG);
      try {
        discardTriples(iter);
      }
      finally {
        txnAddedTriples = false;
        iter.close();
      }
    }

    boolean validCache = updatedTriplesCache.isValid();

    byte txnFlagsMask = ~(ADDED_FLAG | REMOVED_FLAG | TOGGLE_EXPLICIT_FLAG);

    for (TripleIndex index : indexes) {
      BTree btree = index.getBTree();

      RecordIterator iter;
      if (validCache) {
        // Use the cached set of updated triples
        iter = updatedTriplesCache.getRecords();
      }
      else {
        // Cache is invalid; too much updates(?). Iterate over all triples
        iter = btree.iterateAll();
      }

      try {
        byte[] data = null;
        while ((data = iter.next()) != null) {
          byte flags = data[FLAG_IDX];
          boolean removed = (flags & REMOVED_FLAG) != 0;
          boolean toggled = (flags & TOGGLE_EXPLICIT_FLAG) != 0;

          if (removed || toggled) {
            data[FLAG_IDX] &= txnFlagsMask;

            if (validCache) {
              // We're iterating the cache
              btree.insert(data);
            }
            else {
              // We're iterating the BTree itself
              iter.set(data);
            }
          }
        }
      }
      finally {
        iter.close();
      }
    }

    updatedTriplesCache.discard();
    updatedTriplesCache = null;
View Full Code Here

Examples of org.openrdf.sail.nativerdf.btree.RecordIterator

  public final void storeRecords(RecordCache other)
    throws IOException
  {
    if (isValid()) {
      RecordIterator recIter = other.getRecords();
      try {
        byte[] record;

        while ((record = recIter.next()) != null) {
          storeRecordInternal(record);
        }
      }
      finally {
        recIter.close();
      }
    }
  }
View Full Code Here

Examples of org.prevayler.demos.scalability.RecordIterator

  AllRecordsReplacement(int records) {
    _records = records;
  }

  public void executeOn(ScalabilitySystem system, Date ignored) {
    system.replaceAllRecords(new RecordIterator(_records));
  }
View Full Code Here

Examples of org.prevayler.demos.scalability.RecordIterator

    }
  }


  void replaceAllRecords(int records) {
    RecordIterator newRecords = new RecordIterator(records);

    try {
      connection.createStatement().execute("delete from " + table());
    } catch (SQLException sqlx) {
      dealWithSQLException(sqlx, "deleting all records from " + table());
    }

    while (newRecords.hasNext()) {
      insert(newRecords.next());
    }

    try {
      connection.commit();
    } catch (SQLException sqlx) {
View Full Code Here

Examples of uk.ac.open.kmi.smartproducts.sesame.sail.btree.RecordIterator

  protected CloseableIteration<Resource, IOException> getContextIDs(boolean readTransaction)
    throws IOException
  {
    CloseableIteration<? extends Statement, IOException> stIter;
    CloseableIteration<Resource, IOException> ctxIter;
    RecordIterator btreeIter;
    btreeIter = tripleStore.getAllTriplesSortedByContext(readTransaction);
    if (btreeIter == null) {
      // Iterator over all statements
      stIter = createStatementIterator(null, null, null, true, readTransaction);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.