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;
}
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();
}
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();
}
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);
}
}
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;
}
Aggregations