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

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

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

Location.mem介绍

[英]Return a fresh memory location : always unique, never .equals to another location.
[中]返回一个新的内存位置:总是唯一的,从不。等于另一个位置。

代码示例

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

/**
   * Return a StoreConnection backed by in-memory
   * datastructures (for testing).
   */
  public static StoreConnection createMemUncached() {
    DatasetGraphTDB dsg = DatasetBuilderStd.create(Location.mem(), null);
    return new StoreConnection(dsg);
  }
}

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

@Override
  protected NodeTable createEmptyNodeTable()
  {
    return Build.makeNodeTable(Location.mem()) ;
  }
}

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

private TripleTable createTripleTableMem()
  {
    DatasetGraphTDB ds = DatasetBuilderStd.create(Location.mem()) ; 
    return ds.getTripleTable() ;
  }
}

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

/**
 * Clean up test resources
 */
@After
public void cleanupTest() {
  StoreConnection.expel(Location.mem(), true);
}

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

@Test
public void testTDBFactory1() {
  DatasetGraph dg1 = TDBFactory.createDatasetGraph(Location.mem("FOO"));
  DatasetGraph dg2 = TDBFactory.createDatasetGraph(Location.mem("FOO"));
  dg1.add(quad1);
  assertTrue(dg2.contains(quad1));
}

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

@Test
public void testTDBMakerTxn2() {
  // Named memory locations
  DatasetGraph dg1 = TDBMaker.createDatasetGraphTransaction(Location.mem("FOO"));
  DatasetGraph dg2 = TDBMaker.createDatasetGraphTransaction(Location.mem("FOO"));
  DatasetGraph dgBase1 = ((DatasetGraphTransaction)dg1).getBaseDatasetGraph();
  DatasetGraph dgBase2 = ((DatasetGraphTransaction)dg2).getBaseDatasetGraph();
  assertSame(dgBase1, dgBase2);
}

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

@Test public void testTDBFresh11() {
  Location loc = Location.mem() ;
  boolean b = TDBFactory.inUseLocation(loc) ;
  assertFalse("Expect false before any creation attempted", b) ;
}

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

@Test
public void testTDBFactory2() {
  // The unnamed location is unique each time.
  DatasetGraph dg1 = TDBFactory.createDatasetGraph(Location.mem());
  DatasetGraph dg2 = TDBFactory.createDatasetGraph(Location.mem());
  dg1.add(quad1);
  assertFalse(dg2.contains(quad1));
}

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

@Test
public void testTDBMakerTxn3() {
  // Un-named memory locations
  DatasetGraph dg1 = TDBMaker.createDatasetGraphTransaction(Location.mem());
  DatasetGraph dg2 = TDBMaker.createDatasetGraphTransaction(Location.mem());
  DatasetGraph dgBase1 = ((DatasetGraphTransaction)dg1).getBaseDatasetGraph();
  DatasetGraph dgBase2 = ((DatasetGraphTransaction)dg2).getBaseDatasetGraph();
  assertNotSame(dgBase1, dgBase2);
}

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

/**
 * Cleans up after the tests by ensuring that the TDB dataset is closed
 */
@After
public void cleanupTest() {
  if (currDataset != null) {
    currDataset.close();
  }
  StoreConnection.expel(Location.mem(), true);
}

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

@Test public void params_choose_existing_1() {
  StoreParams p = Build.decideStoreParams(Location.mem(), false, null, null, pDft) ;
  // p is pDft.
  assertTrue(StoreParams.sameValues(p, pDft)) ;
}

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

@Test public void params_choose_existing_3() {
  StoreParams p = Build.decideStoreParams(Location.mem(), false, null, pLoc, pDft) ;
  // p is pLoc
  assertTrue(StoreParams.sameValues(p, pLoc)) ;
  
}

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

@Test public void params_choose_existing_3() {
  StoreParams p = Build.decideStoreParams(Location.mem(), false, null, pLoc, pDft) ;
  // p is pLoc
  assertTrue(StoreParams.sameValues(p, pLoc)) ;
  
}

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

@Test public void params_choose_new_3() {
  StoreParams p = Build.decideStoreParams(Location.mem(), true, null, pLoc, pDft) ;
  // New store, pLoc, no pApp, so pLoc is the entire settings.
  assertEquals(0, p.getBlockSize().intValue()) ;
  assertTrue(StoreParams.sameValues(p, pLoc)) ;
}

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

@Test public void testTDBFresh23() {
    Location loc = Location.mem("FOO") ;
    boolean b = TDBFactory.inUseLocation(loc) ;
    TDBFactory.createDataset(loc) ;
    b = TDBFactory.inUseLocation(loc) ;
    assertTrue("Expected true for a named memory location", b) ;
  }
}

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

@Test public void testTDBFresh22() {
  Location loc = Location.mem() ;
  boolean b = TDBFactory.inUseLocation(loc) ;
  TDBFactory.createDataset(loc) ;
  b = TDBFactory.inUseLocation(loc) ;
  assertFalse("Expected false for a unique memory location", b) ;
}

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

@Test public void params_choose_new_4() {
  StoreParams p = Build.decideStoreParams(Location.mem(), true, pApp, pLoc, pDft) ;
  // New store, pLoc, no pApp, so pLoc is the entire settings.
  
  assertFalse(StoreParams.sameValues(p, pApp)) ;
  assertFalse(StoreParams.sameValues(p, pLoc)) ;
  assertFalse(StoreParams.sameValues(p, pDft)) ;
  
  assertEquals(0, p.getBlockSize().intValue()) ;
  assertEquals(12,  p.getNodeMissCacheSize().intValue()) ;
}

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

@Test public void params_choose_existing_4() {
  StoreParams p = Build.decideStoreParams(Location.mem(), false, pApp, pLoc, pDft) ;
  // p is pLoc modifed by pApp.
  assertFalse(StoreParams.sameValues(p, pApp)) ;
  assertFalse(StoreParams.sameValues(p, pLoc)) ;
  assertFalse(StoreParams.sameValues(p, pDft)) ;
  
  assertEquals(0, p.getBlockSize().intValue()) ;
  assertEquals(12,  p.getNodeMissCacheSize().intValue()) ;
}

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

@Test public void params_choose_existing_2() {
  StoreParams p = Build.decideStoreParams(Location.mem(), false, pApp, null, pDft) ;
  // p is pLoc modified by pApp
  assertFalse(StoreParams.sameValues(p, pApp)) ;
  assertFalse(StoreParams.sameValues(p, pDft)) ;
  // Existing store, no pLoc, so pDft is implicit pLoc and fixed the block size.  
  assertEquals(pDft.getBlockSize(), p.getBlockSize()) ;
  assertEquals(12, p.getNodeMissCacheSize().intValue()) ;
}

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

@Test
public void location_lock_mem() {
  Location mem = Location.mem();
  LocationLock lock = mem.getLock();
  Assert.assertFalse(lock.canLock());
  Assert.assertFalse(lock.isLocked());
  Assert.assertFalse(lock.isOwned());
  Assert.assertFalse(lock.canObtain());
}

相关文章