Search in sources :

Example 81 with AccumuloRdfConfiguration

use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.

the class GeoIndexerSfTest method before.

/**
 * Run before each test method.
 * @throws Exception
 */
@Before
public void before() throws Exception {
    conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("triplestore_");
    final String tableName = GeoMesaGeoIndexer.getTableName(conf);
    conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, true);
    conf.set(ConfigUtils.CLOUDBASE_USER, "USERNAME");
    conf.set(ConfigUtils.CLOUDBASE_PASSWORD, "PASS");
    conf.set(ConfigUtils.CLOUDBASE_INSTANCE, "INSTANCE");
    conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, "localhost");
    conf.set(ConfigUtils.CLOUDBASE_AUTHS, "U");
    conf.set(OptionalConfigUtils.USE_GEO, "true");
    conf.set(OptionalConfigUtils.GEO_INDEXER_TYPE, GeoIndexerType.GEO_MESA.toString());
    final TableOperations tops = ConfigUtils.getConnector(conf).tableOperations();
    // get all of the table names with the prefix
    final Set<String> toDel = Sets.newHashSet();
    for (final String t : tops.list()) {
        if (t.startsWith(tableName)) {
            toDel.add(t);
        }
    }
    for (final String t : toDel) {
        tops.delete(t);
    }
    g = new GeoMesaGeoIndexer();
    g.setConf(conf);
    // Convert the statements as schema WKT or GML, then GML has two methods to encode.
    g.storeStatement(createRyaStatement(A, schemaToTest, encodeMethod));
    g.storeStatement(createRyaStatement(B, schemaToTest, encodeMethod));
    g.storeStatement(createRyaStatement(C, schemaToTest, encodeMethod));
    g.storeStatement(createRyaStatement(D, schemaToTest, encodeMethod));
    g.storeStatement(createRyaStatement(F, schemaToTest, encodeMethod));
    g.storeStatement(createRyaStatement(E, schemaToTest, encodeMethod));
    g.storeStatement(createRyaStatement(G, schemaToTest, encodeMethod));
}
Also used : TableOperations(org.apache.accumulo.core.client.admin.TableOperations) LineString(com.vividsolutions.jts.geom.LineString) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) Before(org.junit.Before)

Example 82 with AccumuloRdfConfiguration

use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.

the class GeoWaveIndexerTest method before.

@Before
public void before() throws Exception {
    conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("triplestore_");
    final String tableName = GeoWaveGeoIndexer.getTableName(conf);
    conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, IS_MOCK);
    conf.set(ConfigUtils.CLOUDBASE_USER, ACCUMULO_USER);
    conf.set(ConfigUtils.CLOUDBASE_PASSWORD, ACCUMULO_PASSWORD);
    conf.set(ConfigUtils.CLOUDBASE_INSTANCE, IS_MOCK ? "INSTANCE" : accumulo.getInstanceName());
    conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, IS_MOCK ? "localhost" : accumulo.getZooKeepers());
    conf.set(ConfigUtils.CLOUDBASE_AUTHS, "U");
    conf.set(OptionalConfigUtils.USE_GEO, "true");
    conf.set(OptionalConfigUtils.GEO_INDEXER_TYPE, GeoIndexerType.GEO_WAVE.toString());
    final TableOperations tops = ConfigUtils.getConnector(conf).tableOperations();
    // get all of the table names with the prefix
    final Set<String> toDel = Sets.newHashSet();
    for (final String t : tops.list()) {
        if (t.startsWith(tableName)) {
            toDel.add(t);
        }
    }
    for (final String t : toDel) {
        tops.delete(t);
    }
}
Also used : TableOperations(org.apache.accumulo.core.client.admin.TableOperations) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) Before(org.junit.Before)

Example 83 with AccumuloRdfConfiguration

use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.

the class RyaSailFactory method getRyaSail.

private static Sail getRyaSail(final Configuration config) throws InferenceEngineException, RyaDAOException, AccumuloException, AccumuloSecurityException, SailException {
    final RdfCloudTripleStore store = new RdfCloudTripleStore();
    final RyaDAO<?> dao;
    final RdfCloudTripleStoreConfiguration rdfConfig;
    final String user;
    final String pswd;
    // XXX Should(?) be MongoDBRdfConfiguration.MONGO_COLLECTION_PREFIX inside the if below. RYA-135
    final String ryaInstance = config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX);
    Objects.requireNonNull(ryaInstance, "RyaInstance or table prefix is missing from configuration." + RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX);
    if (ConfigUtils.getUseMongo(config)) {
        // Get a reference to a Mongo DB configuration object.
        final MongoDBRdfConfiguration mongoConfig = (config instanceof MongoDBRdfConfiguration) ? (MongoDBRdfConfiguration) config : new MongoDBRdfConfiguration(config);
        // Instantiate a Mongo client and Mongo DAO.
        dao = getMongoDAO(mongoConfig);
        // Then use the DAO's newly-created stateful conf in place of the original
        rdfConfig = dao.getConf();
    } else {
        rdfConfig = new AccumuloRdfConfiguration(config);
        user = rdfConfig.get(ConfigUtils.CLOUDBASE_USER);
        pswd = rdfConfig.get(ConfigUtils.CLOUDBASE_PASSWORD);
        Objects.requireNonNull(user, "Accumulo user name is missing from configuration." + ConfigUtils.CLOUDBASE_USER);
        Objects.requireNonNull(pswd, "Accumulo user password is missing from configuration." + ConfigUtils.CLOUDBASE_PASSWORD);
        rdfConfig.setTableLayoutStrategy(new TablePrefixLayoutStrategy(ryaInstance));
        updateAccumuloConfig((AccumuloRdfConfiguration) rdfConfig, user, pswd, ryaInstance);
        dao = getAccumuloDAO((AccumuloRdfConfiguration) rdfConfig);
    }
    store.setRyaDAO(dao);
    rdfConfig.setTablePrefix(ryaInstance);
    if (rdfConfig.isInfer()) {
        final InferenceEngine inferenceEngine = new InferenceEngine();
        inferenceEngine.setConf(rdfConfig);
        inferenceEngine.setRyaDAO(dao);
        inferenceEngine.init();
        store.setInferenceEngine(inferenceEngine);
    }
    store.initialize();
    return store;
}
Also used : RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) InferenceEngine(org.apache.rya.rdftriplestore.inference.InferenceEngine) TablePrefixLayoutStrategy(org.apache.rya.api.layout.TablePrefixLayoutStrategy) RdfCloudTripleStoreConfiguration(org.apache.rya.api.RdfCloudTripleStoreConfiguration) MongoDBRdfConfiguration(org.apache.rya.mongodb.MongoDBRdfConfiguration) StatefulMongoDBRdfConfiguration(org.apache.rya.mongodb.StatefulMongoDBRdfConfiguration) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 84 with AccumuloRdfConfiguration

use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.

the class AccumuloAddUserIT method makeRyaConfig.

private static AccumuloRdfConfiguration makeRyaConfig(final String ryaInstanceName, final String username, final String password, final String instanceName, final String zookeepers) {
    final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix(ryaInstanceName);
    // Accumulo connection information.
    conf.set(ConfigUtils.CLOUDBASE_USER, username);
    conf.set(ConfigUtils.CLOUDBASE_PASSWORD, password);
    conf.set(ConfigUtils.CLOUDBASE_INSTANCE, instanceName);
    conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, zookeepers);
    conf.set(ConfigUtils.CLOUDBASE_AUTHS, "");
    return conf;
}
Also used : AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 85 with AccumuloRdfConfiguration

use of org.apache.rya.accumulo.AccumuloRdfConfiguration in project incubator-rya by apache.

the class RdfCloudTripleStoreSelectivityEvaluationStatisticsTest method init.

@Before
public void init() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException {
    mock = new MockInstance("accumulo");
    PasswordToken pToken = new PasswordToken("pass".getBytes());
    conn = mock.getConnector("user", pToken);
    config = new BatchWriterConfig();
    config.setMaxMemory(1000);
    config.setMaxLatency(1000, TimeUnit.SECONDS);
    config.setMaxWriteThreads(10);
    if (conn.tableOperations().exists("rya_prospects")) {
        conn.tableOperations().delete("rya_prospects");
    }
    if (conn.tableOperations().exists("rya_selectivity")) {
        conn.tableOperations().delete("rya_selectivity");
    }
    arc = new AccumuloRdfConfiguration();
    arc.setTableLayoutStrategy(new TablePrefixLayoutStrategy());
    arc.setMaxRangesForScanner(300);
}
Also used : PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) TablePrefixLayoutStrategy(org.apache.rya.api.layout.TablePrefixLayoutStrategy) BatchWriterConfig(org.apache.accumulo.core.client.BatchWriterConfig) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) Before(org.junit.Before)

Aggregations

AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)108 MockInstance (org.apache.accumulo.core.client.mock.MockInstance)26 AccumuloRyaDAO (org.apache.rya.accumulo.AccumuloRyaDAO)25 Test (org.junit.Test)24 RyaURI (org.apache.rya.api.domain.RyaURI)22 Connector (org.apache.accumulo.core.client.Connector)21 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)20 RyaStatement (org.apache.rya.api.domain.RyaStatement)20 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)15 Sail (org.openrdf.sail.Sail)15 RyaType (org.apache.rya.api.domain.RyaType)14 StatementPattern (org.openrdf.query.algebra.StatementPattern)14 AccumuloException (org.apache.accumulo.core.client.AccumuloException)13 Before (org.junit.Before)13 ArrayList (java.util.ArrayList)12 RdfCloudTripleStore (org.apache.rya.rdftriplestore.RdfCloudTripleStore)12 RyaDAOException (org.apache.rya.api.persist.RyaDAOException)11 LiteralImpl (org.openrdf.model.impl.LiteralImpl)10 BindingSet (org.openrdf.query.BindingSet)10 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)10