Package org.openrdf.sail.nativerdf.btree

Examples of org.openrdf.sail.nativerdf.btree.BTree$Node


      try {
        for (String fieldSeq : addedIndexSpecs) {
          logger.debug("Initializing new index '" + fieldSeq + "'...");

          TripleIndex addedIndex = new TripleIndex(fieldSeq);
          BTree addedBTree = addedIndex.getBTree();

          RecordIterator sourceIter = sourceIndex.getBTree().iterateAll();
          try {
            byte[] value = null;
            while ((value = sourceIter.next()) != null) {
              addedBTree.insert(value);
            }
          }
          finally {
            sourceIter.close();
          }

          addedBTree.close();
        }

        logger.debug("New index(es) initialized");
      }
      finally {
View Full Code Here


      count = (int)removedTriplesCache.getRecordCount();
      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();
        }
View Full Code Here

        data = iter.next();
      }
      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();
        }
View Full Code Here

    }

    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);
            }
View Full Code Here

    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);
            }
View Full Code Here

    public TripleIndex(String fieldSeq)
      throws IOException
    {
      tripleComparator = new TripleComparator(fieldSeq);
      File btreeFile = getIndexFile(fieldSeq);
      btree = new BTree(btreeFile, 2048, RECORD_LENGTH, tripleComparator, forceSync);
    }
View Full Code Here

  public HashIndex(File file)
    throws IOException
  {
    this.file = file;
    btree = new BTree(file, 4096, RECORD_LENGTH, new DefaultRecordComparator());
  }
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OSMNode> wayNodes = new ArrayList<OSMNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        if (origNode != null) {
          wayNodes.add(nodeMap.get(origNode));
        }
      }
     
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OwnNode> wayNodes = new ArrayList<OwnNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        wayNodes.add(nodeMap.get(origNode));
      }
     
      OwnWay ownWay = new OwnWay(tagGroupForEntity(way), wayNodes);
     
View Full Code Here

        CommonEntityData entityData = new CommonEntityData(id, version, timestamp, osmuser,
                changeset, tags);
        if (type.equals(OSMUtils.nodeType())) {
            Point pt = (Point) feature.getDefaultGeometryProperty().getValue();
            entity = new Node(entityData, pt.getY(), pt.getX());

        } else {
            List<WayNode> nodes = Lists.newArrayList();
            String nodesString = (String) feature.getAttribute("nodes");
            for (String s : nodesString.split(";")) {
View Full Code Here

TOP

Related Classes of org.openrdf.sail.nativerdf.btree.BTree$Node

Copyright © 2018 www.massapicom. 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.