Search in sources :

Example 1 with StoragePrefixes

use of org.apache.jena.dboe.storage.StoragePrefixes in project jena by apache.

the class GraphViewSwitchable_Prefixes method createPrefixMappingX.

// Create prefix map view.
private PrefixMap createPrefixMappingX() {
    DatasetGraphTDB dsg = ((DatasetGraphTDB) (getx().get()));
    StoragePrefixes storagePrefixes = dsg.getStoragePrefixes();
    StoragePrefixMap spm = isDefaultGraph() ? StoragePrefixesView.internal_viewDefaultGraph(storagePrefixes) : StoragePrefixesView.internal_viewGraph(storagePrefixes, getGraphName());
    return PrefixesDboeFactory.newPrefixMap(spm);
}
Also used : StoragePrefixes(org.apache.jena.dboe.storage.StoragePrefixes) StoragePrefixMap(org.apache.jena.dboe.storage.prefixes.StoragePrefixMap)

Example 2 with StoragePrefixes

use of org.apache.jena.dboe.storage.StoragePrefixes in project jena by apache.

the class AbstractTestDatasetPrefixesStorage method dsg_prefixes_02.

@Test
public void dsg_prefixes_02() {
    StoragePrefixes prefixes = create();
    prefixes.add(g1, pref1, "http://example.net/ns#");
    String x1 = prefixes.get(g1, pref1);
    assertEquals("http://example.net/ns#", x1);
    String x2 = prefixes.get(g1, pref1a);
    assertEquals("http://example.net/ns#", x2);
}
Also used : StoragePrefixes(org.apache.jena.dboe.storage.StoragePrefixes) Test(org.junit.Test)

Example 3 with StoragePrefixes

use of org.apache.jena.dboe.storage.StoragePrefixes in project jena by apache.

the class TDB2StorageBuilder method build.

// public static DatasetGraphTxn build(Location location, StoreParams appParams) {
// StoreParams locParams = StoreParamsCodec.read(location);
// StoreParams dftParams = StoreParams.getDftStoreParams();
// boolean newArea = isNewDatabaseArea(location);
// if ( newArea ) {
// }
// // This can write the chosen parameters if necessary (new database, appParams != null, locParams == null)
// StoreParams params = StoreParamsFactory.decideStoreParams(location, newArea, appParams, locParams, dftParams);
// return create(location, params).build$();
// }
public static DatasetGraphTDB build(Location location, StoreParams appParams) {
    StoreParams locParams = StoreParamsCodec.read(location);
    StoreParams dftParams = StoreParams.getDftStoreParams();
    boolean newArea = isNewDatabaseArea(location);
    if (newArea) {
    }
    // This can write the chosen parameters if necessary (new database, appParams != null, locParams == null)
    StoreParams params = StoreParamsFactory.decideStoreParams(location, newArea, appParams, locParams, dftParams);
    // Builder pattern for adding components.
    TransactionCoordinator txnCoord = buildTransactionCoordinator(location);
    TransactionalSystem txnSystem = new TransactionalBase(txnCoord);
    TDB2StorageBuilder builder = new TDB2StorageBuilder(txnSystem, location, params, new ComponentIdMgr(UUID.randomUUID()));
    StorageTDB storage = builder.buildStorage();
    StoragePrefixes prefixes = builder.buildPrefixes();
    // Finalize.
    builder.components.forEach(txnCoord::add);
    builder.listeners.forEach(txnCoord::addListener);
    // Freezes the TransactionCoordinator components
    txnCoord.start();
    ReorderTransformation reorderTranform = chooseReorderTransformation(location);
    DatasetGraphTDB dsg = new DatasetGraphTDB(location, params, reorderTranform, storage, prefixes, txnSystem);
    // Enable query processing.
    QC.setFactory(dsg.getContext(), OpExecutorTDB2.OpExecFactoryTDB);
    return dsg;
}
Also used : StoreParams(org.apache.jena.tdb2.params.StoreParams) ReorderTransformation(org.apache.jena.sparql.engine.optimizer.reorder.ReorderTransformation) StoragePrefixes(org.apache.jena.dboe.storage.StoragePrefixes) ComponentIdMgr(org.apache.jena.tdb2.sys.ComponentIdMgr)

Example 4 with StoragePrefixes

use of org.apache.jena.dboe.storage.StoragePrefixes in project jena by apache.

the class AbstractTestDatasetPrefixesStorage method dsg_prefixes_01.

@Test
public void dsg_prefixes_01() {
    StoragePrefixes prefixes = create();
    prefixes.add(g1, pref1, "http://example.net/ns#");
}
Also used : StoragePrefixes(org.apache.jena.dboe.storage.StoragePrefixes) Test(org.junit.Test)

Example 5 with StoragePrefixes

use of org.apache.jena.dboe.storage.StoragePrefixes in project jena by apache.

the class AbstractTestDatasetPrefixesStorage method dsg_prefixes_11.

// Accessors
@Test
public void dsg_prefixes_11() {
    StoragePrefixes prefixes = create();
    prefixes.add(g1, pref1, "http://example.net/ns#");
    List<Node> x = Iter.toList(prefixes.listGraphNodes());
    assertEquals(1, x.size());
    List<PrefixEntry> y = Iter.toList(prefixes.get(g1));
    assertEquals(1, y.size());
}
Also used : StoragePrefixes(org.apache.jena.dboe.storage.StoragePrefixes) Node(org.apache.jena.graph.Node) PrefixEntry(org.apache.jena.riot.system.PrefixEntry) Test(org.junit.Test)

Aggregations

StoragePrefixes (org.apache.jena.dboe.storage.StoragePrefixes)7 Test (org.junit.Test)5 StoragePrefixMap (org.apache.jena.dboe.storage.prefixes.StoragePrefixMap)1 Node (org.apache.jena.graph.Node)1 PrefixEntry (org.apache.jena.riot.system.PrefixEntry)1 ReorderTransformation (org.apache.jena.sparql.engine.optimizer.reorder.ReorderTransformation)1 StoreParams (org.apache.jena.tdb2.params.StoreParams)1 ComponentIdMgr (org.apache.jena.tdb2.sys.ComponentIdMgr)1