Search in sources :

Example 31 with AccumuloRdfConfiguration

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

the class ProspectorServiceEvalStatsDAO method make.

/**
 * Creates an instance of {@link ProspectorServiceEvalStatsDAO} that is connected to the Accumulo and Rya instance
 * that is specified within the provided {@link Configuration}.
 *
 * @param config - Configures which instance of Accumulo Rya this DAO will be backed by. (not null)
 * @return A new instance of {@link ProspectorServiceEvalStatsDAO}.
 * @throws AccumuloException The connector couldn't be created because of an Accumulo problem.
 * @throws AccumuloSecurityException The connector couldn't be created because of an Accumulo security violation.
 */
public static ProspectorServiceEvalStatsDAO make(Configuration config) throws AccumuloException, AccumuloSecurityException {
    requireNonNull(config);
    AccumuloRdfConfiguration accConfig = new AccumuloRdfConfiguration(config);
    return new ProspectorServiceEvalStatsDAO(ConnectorFactory.connect(accConfig), accConfig);
}
Also used : AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 32 with AccumuloRdfConfiguration

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

the class AccumuloBatchUpdatePCJ method connectToRya.

private Sail connectToRya(final String ryaInstanceName) throws RyaClientException {
    try {
        final AccumuloConnectionDetails connectionDetails = super.getAccumuloConnectionDetails();
        final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
        ryaConf.setTablePrefix(ryaInstanceName);
        ryaConf.set(ConfigUtils.CLOUDBASE_USER, connectionDetails.getUsername());
        ryaConf.set(ConfigUtils.CLOUDBASE_PASSWORD, new String(connectionDetails.getUserPass()));
        ryaConf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, connectionDetails.getZookeepers());
        ryaConf.set(ConfigUtils.CLOUDBASE_INSTANCE, connectionDetails.getInstanceName());
        // Turn PCJs off so that we will only scan the core Rya tables while building the PCJ results.
        ryaConf.set(ConfigUtils.USE_PCJ, "false");
        return RyaSailFactory.getInstance(ryaConf);
    } catch (SailException | AccumuloException | AccumuloSecurityException | RyaDAOException | InferenceEngineException e) {
        throw new RyaClientException("Could not connect to the Rya instance named '" + ryaInstanceName + "'.", e);
    }
}
Also used : AccumuloException(org.apache.accumulo.core.client.AccumuloException) RyaClientException(org.apache.rya.api.client.RyaClientException) RyaDAOException(org.apache.rya.api.persist.RyaDAOException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) InferenceEngineException(org.apache.rya.rdftriplestore.inference.InferenceEngineException) SailException(org.openrdf.sail.SailException) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 33 with AccumuloRdfConfiguration

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

the class PcjTablesIT method setupRya.

/**
 * Format a Mini Accumulo to be a Rya repository.
 *
 * @return The Rya repository sitting on top of the Mini Accumulo.
 */
private RyaSailRepository setupRya() throws AccumuloException, AccumuloSecurityException, RepositoryException {
    // Setup the Rya Repository that will be used to create Repository Connections.
    final RdfCloudTripleStore ryaStore = new RdfCloudTripleStore();
    final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
    crdfdao.setConnector(cluster.getConnector());
    // Setup Rya configuration values.
    final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix(getRyaInstanceName());
    conf.setDisplayQueryPlan(true);
    conf.setBoolean(USE_MOCK_INSTANCE, false);
    conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, getRyaInstanceName());
    conf.set(CLOUDBASE_USER, cluster.getUsername());
    conf.set(CLOUDBASE_PASSWORD, cluster.getPassword());
    conf.set(CLOUDBASE_INSTANCE, cluster.getInstanceName());
    crdfdao.setConf(conf);
    ryaStore.setRyaDAO(crdfdao);
    final RyaSailRepository ryaRepo = new RyaSailRepository(ryaStore);
    ryaRepo.initialize();
    return ryaRepo;
}
Also used : RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 34 with AccumuloRdfConfiguration

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

the class GeoIndexerTest method before.

@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);
    }
}
Also used : TableOperations(org.apache.accumulo.core.client.admin.TableOperations) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) Before(org.junit.Before)

Example 35 with AccumuloRdfConfiguration

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

the class GeoWaveFeatureReaderTest method setupConf.

private void setupConf() throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("triplestore_");
    final String tableName = GeoWaveGeoIndexer.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_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)

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