org.apache.jena.tdb.base.file.Location.getPath()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.apache.jena.tdb.base.file.Location.getPath()方法的一些代码示例,展示了Location.getPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Location.getPath()方法的具体详情如下:
包路径:org.apache.jena.tdb.base.file.Location
类名称:Location
方法名:getPath

Location.getPath介绍

[英]Return the name of the file relative to this location
[中]返回相对于此位置的文件名

代码示例

代码示例来源:origin: apache/jena

public String filename(String ext)
  {
    return location.getPath(basename, ext) ;
  }
}

代码示例来源:origin: apache/jena

PlainFilePersistent(Location loc, String filename)
{
  this(loc.getPath(filename, "dat")) ;
}

代码示例来源:origin: apache/jena

/** Return the name of the file relative to this location */
public String getPath(String filename) {
  return getPath(filename, null) ;
}

代码示例来源:origin: apache/jena

/**
 * Gets the lock file
 * 
 * @return Lock file
 */
private File getLockFile() {
  return new File(location.getPath(LOCK_FILENAME));
}

代码示例来源:origin: apache/jena

public boolean exists(String filename, String ext) {
  String fn = getPath(filename, ext) ;
  File f = new File(fn) ;
  return f.exists() ;
}

代码示例来源:origin: apache/jena

/** Write to a file */ 
public static void write(Location location, StoreParams params) {
  write(location.getPath(TDB_CONFIG_FILE) ,params) ;
}

代码示例来源:origin: apache/jena

private void checkNodesDatJrnl(String label, Transaction txn) {
  if ( txn != null ) {
    String x = txn.getBaseDataset().getLocation().getPath(label + ": nodes.dat-jrnl") ;
    long len = new File(x).length() ;
    if ( len != 0 )
      log("nodes.dat-jrnl: not empty", txn) ;
  }
}

代码示例来源:origin: apache/jena

/**
 * Read from a file if possible.
 * Return null for memory locations, file not found or syntax errors. 
 */
public static StoreParams read(Location location) {
  if ( location.isMem() )
    return null ;
  return read(location.getPath(TDB_CONFIG_FILE)) ;
}

代码示例来源:origin: apache/jena

private int countRDFNodes() {
    ObjectFile objects = FileFactory.createObjectFileDisk( location.getPath(Names.indexId2Node, Names.extNodeData) ) ;
    int count = 0 ;
    Iterator<Pair<Long,ByteBuffer>> iter = objects.all() ; 
    while ( iter.hasNext() ) { 
      iter.next() ;
      count++ ;
    }
    objects.close() ;
    return count ;
  }
}

代码示例来源:origin: org.apache.jena/jena-tdb

static StoreParams read(Location location) {
    String fn = location.getPath(TDB_CONFIG_FILE) ;
    JsonObject obj = JSON.read(fn) ;
    return StoreParamsCodec.decode(obj) ;
  }
}

代码示例来源:origin: org.apache.jena/jena-tdb

private int countRDFNodes() {
    ObjectFile objects = FileFactory.createObjectFileDisk( location.getPath(Names.indexId2Node, Names.extNodeData) ) ;
    int count = 0 ;
    Iterator<Pair<Long,ByteBuffer>> iter = objects.all() ; 
    while ( iter.hasNext() ) { 
      iter.next() ;
      count++ ;
    }
    objects.close() ;
    return count ;
  }
}

代码示例来源:origin: apache/jena

static StoreParams read(Location location) {
    String fn = location.getPath(TDB_CONFIG_FILE) ;
    JsonObject obj = JSON.read(fn) ;
    return StoreParamsCodec.decode(obj) ;
  }
}

代码示例来源:origin: apache/jena

@Override
final public void finishBulk() {
  loaderTriples.loadDataFinish() ;
  loaderTriples.loadIndexStart() ;
  loaderTriples.loadIndexFinish() ;
  loaderTriples.loadFinish() ;
  if ( !dsg.getLocation().isMem() && startedEmpty && stats != null ) {
    String filename = dsg.getLocation().getPath(Names.optStats) ;
    Stats.write(filename, stats.results()) ;
  }
  forceSync(dsg) ;
}

代码示例来源:origin: org.apache.jena/jena-tdb

@Override
protected StringFile createStringFile()
{
  String dir = ConfigTest.getTestingDir() ;
 clearDirectory(dir) ;
 Location loc = Location.create(dir) ;
 fn = loc.getPath("xyz", "node") ;
 FileOps.delete(fn) ;
 return FileFactory.createStringFileDisk(fn) ;
}

代码示例来源:origin: apache/jena

@Override
protected StringFile createStringFile()
{
  String dir = ConfigTest.getTestingDir() ;
 clearDirectory(dir) ;
 Location loc = Location.create(dir) ;
 fn = loc.getPath("xyz", "node") ;
 FileOps.delete(fn) ;
 return FileFactory.createStringFileDisk(fn) ;
}

代码示例来源:origin: apache/jena

@Test public void params_choose_new_persist_3() {
  // new database, location defined, application modified.
  Location loc = Location.create(DIR) ;
  FileOps.clearAll(loc.getDirectoryPath());
  StoreParamsCodec.write(loc, pLoc); 
  
  // Clear.
  StoreParams p = Build.decideStoreParams(loc, true, pApp, pLoc, pDft) ;
  // Check location still has a pLoc.
  String fn = loc.getPath(StoreParamsConst.TDB_CONFIG_FILE) ;
  assertTrue(FileOps.exists(fn)) ;
  StoreParams pLoc2 = StoreParamsCodec.read(loc) ;
  assertFalse(StoreParams.sameValues(pLoc, p)) ;
  assertEquals(0, p.getBlockSize().intValue()) ;  // Location
  assertEquals(12, p.getNodeMissCacheSize().intValue()) ;  // Application
}

代码示例来源:origin: apache/jena

@Test public void params_choose_new_persist_1() {
  // new database, app defined.
  Location loc = Location.create(DIR) ;
  FileOps.clearAll(loc.getDirectoryPath());
  // Clear.
  StoreParams p = Build.decideStoreParams(loc, true, pApp, null, pDft) ;
  // Check location now has a pLoc.
  String fn = loc.getPath(StoreParamsConst.TDB_CONFIG_FILE) ;
  assertTrue(FileOps.exists(fn)) ;
  StoreParams pLoc2 = StoreParamsCodec.read(loc) ;
  assertTrue(StoreParams.sameValues(pLoc2, p)) ;
}

代码示例来源:origin: org.apache.jena/jena-tdb

@Test public void params_choose_new_persist_1() {
  // new database, app defined.
  Location loc = Location.create(DIR) ;
  FileOps.clearAll(loc.getDirectoryPath());
  // Clear.
  StoreParams p = Build.decideStoreParams(loc, true, pApp, null, pDft) ;
  // Check location now has a pLoc.
  String fn = loc.getPath(StoreParamsConst.TDB_CONFIG_FILE) ;
  assertTrue(FileOps.exists(fn)) ;
  StoreParams pLoc2 = StoreParamsCodec.read(loc) ;
  assertTrue(StoreParams.sameValues(pLoc2, p)) ;
}

代码示例来源:origin: apache/jena

@Test public void params_choose_new_persist_2() {
  // new database, location defined.
  Location loc = Location.create(DIR) ;
  FileOps.clearAll(loc.getDirectoryPath());
  StoreParamsCodec.write(loc, pLoc); 
  
  // Clear.
  StoreParams p = Build.decideStoreParams(loc, true, null, pLoc, pDft) ;
  // Check location still has a pLoc.
  String fn = loc.getPath(StoreParamsConst.TDB_CONFIG_FILE) ;
  assertTrue(FileOps.exists(fn)) ;
  StoreParams pLoc2 = StoreParamsCodec.read(loc) ;
  assertTrue(StoreParams.sameValues(pLoc, p)) ;
}

代码示例来源:origin: org.apache.jena/jena-tdb

@Test public void params_choose_new_persist_2() {
  // new database, location defined.
  Location loc = Location.create(DIR) ;
  FileOps.clearAll(loc.getDirectoryPath());
  StoreParamsCodec.write(loc, pLoc); 
  
  // Clear.
  StoreParams p = Build.decideStoreParams(loc, true, null, pLoc, pDft) ;
  // Check location still has a pLoc.
  String fn = loc.getPath(StoreParamsConst.TDB_CONFIG_FILE) ;
  assertTrue(FileOps.exists(fn)) ;
  StoreParams pLoc2 = StoreParamsCodec.read(loc) ;
  assertTrue(StoreParams.sameValues(pLoc, p)) ;
}

相关文章