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

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

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

Location.create介绍

[英]Return a location for a directory on disk
[中]返回磁盘上目录的位置

代码示例

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

/** Create a FileSet given Location (directory) and name within the directory */  
public FileSet(String directory, String basename)
{
  initFileSet(Location.create(directory), basename) ;
}

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

public Location getSubLocation(String dirname) {
  String newName = pathname + dirname ;
  ensure(newName) ;
  return Location.create(newName) ;
}

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

public Location getLocation()
{
  List<String> x = locations() ;
  if ( x.size() == 0 )
    return null ;
  return Location.create(x.get(0)) ;
}

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

/** Test whether a location already has a TDB database or whether a call to TDBFactory 
 * will cause a new, fresh TDB database to be created (pragmatic tests).
 * The directory may be empty, or not exist.
 * Existing databases return "true".  
 */
public static boolean inUseLocation(String directory) {
  return inUseLocation(Location.create(directory)) ;
}

代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-base

/** Convert a {@link Path}  to a {@link Location}. */
public static Location asLocation(Path path) {
  if ( ! Files.isDirectory(path) )
    throw new RuntimeIOException("Path is not naming a directory: "+path);
  return Location.create(path.toString());
}

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

/** Create a FileSet given Location (directory) and name within the directory */  
public FileSet(String filename)
{
  Tuple<String> t = FileOps.splitDirFile(filename) ;
  String dir = t.get(0) ;
  String fn = t.get(1) ;
  if ( dir == null )
    dir = "." ;
  initFileSet(Location.create(dir), fn) ;
}

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

/**
 * Cleans up resources used to avoid process memory leaks
 */
@After
public void cleanupTest() {
  StoreConnection.expel(Location.create(tempDir.getRoot().getAbsolutePath()), true);
}

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

@Test
public void testTDBMakerTxn1() {
  DatasetGraph dg1 = TDBMaker.createDatasetGraphTransaction(Location.create(DIR));
  DatasetGraph dg2 = TDBMaker.createDatasetGraphTransaction(Location.create(DIR));
  DatasetGraph dgBase1 = ((DatasetGraphTransaction)dg1).getBaseDatasetGraph();
  DatasetGraph dgBase2 = ((DatasetGraphTransaction)dg2).getBaseDatasetGraph();
  assertSame(dgBase1, dgBase2);
}

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

@Before
public void before() {
  DIR = ConfigTest.getCleanDir();
  StoreConnection.release(Location.create(DIR));
}

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

@Before
public void before() {
  DIR = ConfigTest.getCleanDir();
  StoreConnection.release(Location.create(DIR));
}

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

@Before public void setup() {
  path = ConfigTest.getCleanDir() ; 
  location = Location.create (path) ;
  if ( useTransactionsSetup )
    setupTxn() ;
  else
    setupPlain() ;
}

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

@Before public void before()
{   
  String dirname = ConfigTest.getCleanDir() ;
  StoreConnection.reset() ;
  graphLocation = new GraphLocation(Location.create(dirname)) ;
  graphLocation.createDataset() ;
}

代码示例来源: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

@Test public void testTDBFresh02() {
  boolean b = TDBFactory.inUseLocation(DIR) ;
  assertFalse("Expect false before any creation attempted", b) ;
  TDBFactory.createDataset(DIR) ;
  b = TDBFactory.inUseLocation(DIR) ;
  assertTrue("Expected true after creation attempted", b) ;
  StoreConnection.expel(Location.create(DIR), true); 
}

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

@Test public void testTDBFresh02() {
  boolean b = TDBFactory.inUseLocation(DIR) ;
  assertFalse("Expect false before any creation attempted", b) ;
  TDBFactory.createDataset(DIR) ;
  b = TDBFactory.inUseLocation(DIR) ;
  assertTrue("Expected true after creation attempted", b) ;
  StoreConnection.expel(Location.create(DIR), true); 
}

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

@BeforeClass public static void beforeClass()
{
  StoreConnection.reset() ;
  graphLocation = new GraphLocation(Location.create(ConfigTest.getCleanDir())) ;
  graphLocation.release() ;
  graphLocation.clearDirectory() ;
  graphLocation.createGraph() ;
  graph = graphLocation.getGraph() ;
}
// ----------

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

@Test
public void persistent1() {
  String dir = ConfigTest.getTestingDir() ;
  FileOps.clearDirectory(dir) ;
  DatasetPrefixesTDB prefixes = createTesting(Location.create(dir), new DatasetControlMRSW()) ;
  PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
  String x = pmap1.getNsPrefixURI("x") ;
  assertNull(x) ;
  prefixes.close() ;
}

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

@Test public void testTDBFresh03() {
  boolean b = TDBFactory.inUseLocation(DIR) ;
  assertFalse("Expect true before any creation attempted", b) ;
  TDBFactory.createDataset(DIR) ;
  b = TDBFactory.inUseLocation(DIR) ;
  assertTrue("Expected true after creation attempted", b) ;
  StoreConnection.expel(Location.create(DIR), true);
  b = TDBFactory.inUseLocation(DIR) ;
  assertTrue("Expected true even after StoreConenction reset", b) ;
}

代码示例来源: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)) ;
}

相关文章