Package com.hp.hpl.jena.tdb.base.objectfile

Examples of com.hp.hpl.jena.tdb.base.objectfile.ObjectFile


 
  @SuppressWarnings("unused")
  private static void dumpObject (Location location) {
    log.debug("{}", location);
    String path = location.getDirectoryPath() ;
    ObjectFile objects = FileFactory.createObjectFileDisk(path + File.separator + "nodes.dat");
    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) ;
      log.debug("{} : {}", id, node);
View Full Code Here


    MergeSortIterator<Record> merger = new MergeSortIterator<Record>(indexes, new RecordComparator()) ;
    while ( merger.hasNext() ) {
      System.out.println(merger.next());
    }

    ObjectFile of1 = FileFactory.createObjectFileDisk("target/out-01/nodes.dat") ;   
    ObjectFile of2 = FileFactory.createObjectFileDisk("target/out-02/nodes.dat") ;

    System.out.println("Node table 01: nodes.dat (i.e. object file)") ;
    Iterator<Pair<Long, ByteBuffer>> it1 = of1.all() ;
    while ( it1.hasNext() ) {
      Pair<Long, ByteBuffer> pair = it1.next() ;
      System.out.println(pair.getLeft() + ":" + NodeLib.decode(pair.getRight()));
    }
   
    System.out.println("Node table 02: nodes.dat (i.e. object file)") ;
    Iterator<Pair<Long, ByteBuffer>> it2 = of2.all() ;
    while ( it2.hasNext() ) {
      Pair<Long, ByteBuffer> pair = it2.next() ;
      System.out.println(pair.getLeft() + ":" + NodeLib.decode(pair.getRight()));
    }
   
View Full Code Here

public class DumpNodeTable {

  public static void main(String[] args) {
//    ObjectFile objects = FileFactory.createObjectFileDisk("/tmp/b-snsthurs-0av5u129/live/nodes.dat") ;
    ObjectFile objects = FileFactory.createObjectFileDisk("/home/castagna/Desktop/tdb/nodes.dat") ;
    Iterator<Pair<Long, ByteBuffer>> iter = objects.all() ;
    while ( iter.hasNext() ) {
      Pair<Long, ByteBuffer> pair = iter.next();
      System.out.println( pair ) ;
    }
  }
View Full Code Here

public class nodesdump {
  public static void main(String[] args) {
    if ( args.length != 1 ) { print_usage(); }
   
    ObjectFile objects = FileFactory.createObjectFileDisk(args[0]);
    Iterator<Pair<Long, ByteBuffer>> iter = objects.all();
    while ( iter.hasNext() ) {
      Pair<Long, ByteBuffer> pair = iter.next();
      System.out.println(pair.getLeft() + " : " + pair.getRight());
    }
  }
View Full Code Here

 
  private static Set<Long> verifyNodeTable(final Location location) {
    System.out.println ("---- Scanning node table ... ----");
    Set<Long> nodeIds = new HashSet<Long>();
    String filename = location.absolute(Names.indexId2Node, Names.extNodeData);
    ObjectFile objects = FileFactory.createObjectFileDisk(filename);
    Iterator<Pair<Long, ByteBuffer>> iter = objects.all();
    int countRdfNodes = 0;
    Long nodeId = 0L;
    ByteBuffer nodeValue = null;
    while (iter.hasNext()) {
      Pair<Long, ByteBuffer> entry = iter.next();
View Full Code Here

  public static void fixNodeTable(Location location, ProgressLogger monitor) {
    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

    String path = location.getDirectoryPath() ;
    new File(path, "node2id.dat").delete() ;
    new File(path, "node2id.idn").delete() ;
   
    // input
    ObjectFile objects = FileFactory.createObjectFileDisk(path + File.separator + "nodes.dat");
    // sorted bag
      ThresholdPolicyCount<Pair<byte[],Long>> policy = new ThresholdPolicyCount<Pair<byte[],Long>>(10000000);
      Comparator<Pair<byte[],Long>> comparator = new PairComparator();
    SortedDataBag<Pair<byte[],Long>> sortedDataBag = new SortedDataBag<Pair<byte[],Long>>(policy, new PairSerializationFactory(), comparator);
   
    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(SystemTDB.LenNodeHash);
          setHash(hash, node);
          byte k[] = hash.getBytes();
          sortedDataBag.send(new Pair<byte[],Long>(k, id));
      if ( monitor != null ) monitor.tick();
    }
    objects.sync();
    objects.close();   
   
        // output
    final ProgressLogger monitor2 = new ProgressLogger(log, "Data (2/2)", BulkLoader.DataTickPoint,BulkLoader.superTick);
    log.info("Data (2/2)...");
    monitor2.start();
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.base.objectfile.ObjectFile

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.