@Test public void multiple1() { DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.testing() ; PrefixMapping pmap1 = prefixes.getPrefixMapping() ; PrefixMapping pmap2 = prefixes.getPrefixMapping("http://graph/") ; pmap1.setNsPrefix("x", "http://foo/") ; assertNull(pmap2.getNsPrefixURI("x")) ; assertNotNull(pmap1.getNsPrefixURI("x")) ; }
@SuppressWarnings("deprecation") @Test public void persistent2() { String dir = ConfigTest.getTestingDir() ; FileOps.clearDirectory(dir) ; DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new ConcurrencyPolicyMRSW()) ; PrefixMapping pmap1 = prefixes.getPrefixMapping() ; pmap1.setNsPrefix("x", "http://foo/") ; prefixes.close() ; prefixes = DatasetPrefixesTDB.create(new Location(dir), new ConcurrencyPolicyMRSW()) ; assertEquals("http://foo/", pmap1.getNsPrefixURI("x")) ; prefixes.close(); }
static void forceSync(DatasetGraphTDB dsg) { // Force sync - we have been bypassing DSG tables. // THIS DOES NOT WORK IF modules check for SYNC necessity. dsg.getTripleTable().getNodeTupleTable().getNodeTable().sync(); dsg.getQuadTable().getNodeTupleTable().getNodeTable().sync(); dsg.getQuadTable().getNodeTupleTable().getNodeTable().sync(); dsg.getPrefixes().getNodeTupleTable().getNodeTable().sync(); // This is not enough -- modules check whether sync needed. dsg.sync() ; } }
@Override protected PrefixMapping view() { return last.getPrefixMapping() ; }
@Override protected PrefixMapping create() { last = DatasetPrefixesTDB.testing() ; return view() ; }
/** Create or connect a TDB dataset (graph-level) */ private static DatasetGraphTDB _createDatasetGraph(IndexBuilder indexBuilder, Location location, String[] graphIndexDesc, String[] quadIndexDesc) { ConcurrencyPolicy policy = new ConcurrencyPolicyMRSW() ; @SuppressWarnings("deprecation") NodeTable nodeTable = NodeTableFactory.create(indexBuilder, location) ; TripleTable triples = createTripleTable(indexBuilder, nodeTable, location, graphIndexDesc, policy) ; QuadTable quads = createQuadTable(indexBuilder, nodeTable, location, quadIndexDesc, policy) ; @SuppressWarnings("deprecation") DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(indexBuilder, location, policy) ; return new DatasetGraphTDB(triples, quads, prefixes, chooseOptimizer(location), location, null) ; }
@SuppressWarnings("deprecation") @Test public void persistent1() { String dir = ConfigTest.getTestingDir() ; FileOps.clearDirectory(dir) ; DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new ConcurrencyPolicyMRSW()) ; PrefixMapping pmap1 = prefixes.getPrefixMapping() ; String x = pmap1.getNsPrefixURI("x") ; assertNull(x) ; prefixes.close(); }
static void forceSync(DatasetGraphTDB dsg) { // Force sync - we have been bypassing DSG tables. // THIS DOES NOT WORK IF modules check for SYNC necessity. dsg.getTripleTable().getNodeTupleTable().getNodeTable().sync(); dsg.getQuadTable().getNodeTupleTable().getNodeTable().sync(); dsg.getQuadTable().getNodeTupleTable().getNodeTable().sync(); dsg.getPrefixes().getNodeTupleTable().getNodeTable().sync(); // This is not enough -- modules check whether sync needed. dsg.sync() ; } }
@Test public void multiple2() { DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.testing() ; PrefixMapping pmap1 = prefixes.getPrefixMapping("http://graph/") ; // Same PrefixMapping pmap2 = prefixes.getPrefixMapping("http://graph/") ; pmap1.setNsPrefix("x", "http://foo/") ; assertNotNull(pmap2.getNsPrefixURI("x")) ; assertNotNull(pmap1.getNsPrefixURI("x")) ; }