Search in sources :

Example 11 with RdfCloudTripleStore

use of org.apache.rya.rdftriplestore.RdfCloudTripleStore in project incubator-rya by apache.

the class DemoDriver method setupRya.

/**
 * Format a Mini Accumulo to be a Rya repository.
 *
 * @param accumulo - The Mini Accumulo cluster Rya will sit on top of. (not null)
 * @return The Rya repository sitting on top of the Mini Accumulo.
 */
private static RyaSailRepository setupRya(final MiniAccumuloCluster accumulo) throws AccumuloException, AccumuloSecurityException, RepositoryException, AlreadyInitializedException, RyaDetailsRepositoryException {
    checkNotNull(accumulo);
    // Setup the Rya Repository that will be used to create Repository Connections.
    final RdfCloudTripleStore ryaStore = new RdfCloudTripleStore();
    final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
    crdfdao.setConnector(accumuloConn);
    // Setup Rya configuration values.
    final String ryaInstanceName = "demo_";
    final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("demo_");
    conf.setDisplayQueryPlan(true);
    conf.setBoolean(USE_MOCK_INSTANCE, true);
    conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, RYA_TABLE_PREFIX);
    conf.set(CLOUDBASE_USER, "root");
    conf.set(CLOUDBASE_PASSWORD, "password");
    conf.set(CLOUDBASE_INSTANCE, accumulo.getInstanceName());
    crdfdao.setConf(conf);
    ryaStore.setRyaDAO(crdfdao);
    final RyaSailRepository ryaRepo = new RyaSailRepository(ryaStore);
    ryaRepo.initialize();
    // Create Rya Details for the instance name.
    final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(accumuloConn, ryaInstanceName);
    final RyaDetails details = RyaDetails.builder().setRyaInstanceName(ryaInstanceName).setRyaVersion("0.0.0.0").setFreeTextDetails(new FreeTextIndexDetails(true)).setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).build();
    detailsRepo.initialize(details);
    return ryaRepo;
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) RyaDetails(org.apache.rya.api.instance.RyaDetails) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) AccumuloRyaInstanceDetailsRepository(org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Date(java.util.Date) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository)

Example 12 with RdfCloudTripleStore

use of org.apache.rya.rdftriplestore.RdfCloudTripleStore in project incubator-rya by apache.

the class RdfCloudTripleStoreTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    connector = new MockInstance().getConnector("", "");
    RdfCloudTripleStore sail = new RdfCloudTripleStore();
    AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("lubm_");
    sail.setConf(conf);
    AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
    crdfdao.setConnector(connector);
    crdfdao.setConf(conf);
    sail.setRyaDAO(crdfdao);
    repository = new SailRepository(sail);
    repository.initialize();
    connection = repository.getConnection();
    loadData();
}
Also used : RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) SailRepository(org.openrdf.repository.sail.SailRepository) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 13 with RdfCloudTripleStore

use of org.apache.rya.rdftriplestore.RdfCloudTripleStore in project incubator-rya by apache.

the class EntityTupleSet method getRyaSailConnection.

private RdfCloudTripleStoreConnection getRyaSailConnection() throws AccumuloException, AccumuloSecurityException, SailException {
    RdfCloudTripleStore store = new RdfCloudTripleStore();
    AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
    crdfdao.setConnector(accCon);
    AccumuloRdfConfiguration acc = new AccumuloRdfConfiguration(conf);
    crdfdao.setConf(acc);
    store.setRyaDAO(crdfdao);
    store.initialize();
    return (RdfCloudTripleStoreConnection) store.getConnection();
}
Also used : RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) RdfCloudTripleStoreConnection(org.apache.rya.rdftriplestore.RdfCloudTripleStoreConnection)

Example 14 with RdfCloudTripleStore

use of org.apache.rya.rdftriplestore.RdfCloudTripleStore in project incubator-rya by apache.

the class RyaAccumuloSailFactory method getSail.

@Override
public Sail getSail(final SailImplConfig config) throws SailConfigException {
    try {
        final RdfCloudTripleStore store = new RdfCloudTripleStore();
        final RyaAccumuloSailConfig cbconfig = (RyaAccumuloSailConfig) config;
        final String instanceName = cbconfig.getInstance();
        final String zooKeepers = cbconfig.getZookeepers();
        Instance i;
        if (cbconfig.isMock()) {
            i = new MockInstance(instanceName);
        } else {
            i = new ZooKeeperInstance(instanceName, zooKeepers);
        }
        final String user = cbconfig.getUser();
        final String pass = cbconfig.getPassword();
        final Connector connector = i.getConnector(user, new PasswordToken(pass));
        final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
        crdfdao.setConnector(connector);
        final AccumuloRdfConfiguration conf = cbconfig.toRdfConfiguation();
        ConfigUtils.setIndexers(conf);
        conf.setDisplayQueryPlan(true);
        crdfdao.setConf(conf);
        crdfdao.init();
        store.setRyaDAO(crdfdao);
        return store;
    } catch (RyaDAOException | AccumuloException | AccumuloSecurityException e) {
        throw new SailConfigException(e);
    }
}
Also used : RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) Connector(org.apache.accumulo.core.client.Connector) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) AccumuloException(org.apache.accumulo.core.client.AccumuloException) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) Instance(org.apache.accumulo.core.client.Instance) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance) PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) RyaDAOException(org.apache.rya.api.persist.RyaDAOException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) SailConfigException(org.openrdf.sail.config.SailConfigException)

Example 15 with RdfCloudTripleStore

use of org.apache.rya.rdftriplestore.RdfCloudTripleStore in project incubator-rya by apache.

the class PcjTablesWithMockTest method setupRya.

private static RyaSailRepository setupRya(Connector accumuloConn) 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(accumuloConn);
    // Setup Rya configuration values.
    final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("demo_");
    conf.setDisplayQueryPlan(false);
    conf.setBoolean(USE_MOCK_INSTANCE, true);
    conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, RYA_TABLE_PREFIX);
    conf.set(CLOUDBASE_USER, "root");
    conf.set(CLOUDBASE_PASSWORD, "");
    conf.set(CLOUDBASE_INSTANCE, "instance");
    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)

Aggregations

RdfCloudTripleStore (org.apache.rya.rdftriplestore.RdfCloudTripleStore)21 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)12 RyaSailRepository (org.apache.rya.rdftriplestore.RyaSailRepository)11 AccumuloRyaDAO (org.apache.rya.accumulo.AccumuloRyaDAO)10 SailRepository (org.openrdf.repository.sail.SailRepository)6 MockInstance (org.apache.accumulo.core.client.mock.MockInstance)5 StatefulMongoDBRdfConfiguration (org.apache.rya.mongodb.StatefulMongoDBRdfConfiguration)5 InferenceEngine (org.apache.rya.rdftriplestore.inference.InferenceEngine)5 Test (org.junit.Test)5 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)4 MongoDBRyaDAO (org.apache.rya.mongodb.MongoDBRyaDAO)4 Statement (org.openrdf.model.Statement)4 StatementImpl (org.openrdf.model.impl.StatementImpl)4 SailRepositoryConnection (org.openrdf.repository.sail.SailRepositoryConnection)4 HashSet (java.util.HashSet)3 PcjMetadata (org.apache.rya.indexing.pcj.storage.PcjMetadata)3 NamespaceManager (org.apache.rya.rdftriplestore.namespace.NamespaceManager)3 LiteralImpl (org.openrdf.model.impl.LiteralImpl)3 NumericLiteralImpl (org.openrdf.model.impl.NumericLiteralImpl)3 URIImpl (org.openrdf.model.impl.URIImpl)3