Package com.hp.hpl.jena.tdb.index

Examples of com.hp.hpl.jena.tdb.index.Index


  private static void verifyIndex(final Location location, final String indexName, final Set<Long> nodeIds) {
    System.out.println ("---- Scanning " + indexName + " ... ----");
   
    try {
      RecordFactory quadRecordFactory = new RecordFactory(SystemTDB.LenIndexQuadRecord, 0);
      Index index = IndexBuilder.createIndex(new FileSet(location, indexName), quadRecordFactory);
      Iterator<Record> iter = index.iterator();
      int countRecords = 0;

      int tupleLength = indexName.length();
          String primaryOrder = null;
          if ( tupleLength == 3 ) {
View Full Code Here


    String path = location.getDirectoryPath() ;
    new File(path, "node2id.dat").delete() ;
    new File(path, "node2id.idn").delete() ;
   
    ObjectFile objects = FileFactory.createObjectFileDisk(path + File.separator + "nodes.dat");
    Index nodeToId = SetupTDB.makeIndex(location, Names.indexNode2Id, LenNodeHash, SizeOfNodeId, -1 ,-1) ;
    RecordFactory recordFactory = nodeToId.getRecordFactory();


    Iterator<Pair<Long,ByteBuffer>> iter = objects.all();
    while ( iter.hasNext() ) {
      Pair<Long, ByteBuffer> pair = iter.next();
      long id = pair.getLeft() ;
      Node node = NodeLib.fetchDecode(id, objects) ;
          Hash hash = new Hash(recordFactory.keyLength()) ;
          setHash(hash, node) ;
          byte k[] = hash.getBytes() ;       
          Record record = recordFactory.create(k) ;
          Bytes.setLong(id, record.getValue(), 0) ;
      nodeToId.add(record);
      if ( monitor != null ) monitor.tick();
    }

    nodeToId.sync();
    nodeToId.close();
    objects.sync();
    objects.close();   
  }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.index.Index

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.