use of org.apache.rya.rdftriplestore.RyaSailRepository in project incubator-rya by apache.
the class KafkaExportITBase method installRyaInstance.
private void installRyaInstance() throws Exception {
final MiniAccumuloCluster cluster = super.getMiniAccumuloCluster();
final String instanceName = cluster.getInstanceName();
final String zookeepers = cluster.getZooKeepers();
// Install the Rya instance to the mini accumulo cluster.
final RyaClient ryaClient = AccumuloRyaClientFactory.build(new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), instanceName, zookeepers), super.getAccumuloConnector());
ryaClient.getInstall().install(RYA_INSTANCE_NAME, InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableFreeTextIndex(false).setEnableEntityCentricIndex(false).setEnableGeoIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(true).setFluoPcjAppName(super.getFluoConfiguration().getApplicationName()).build());
// Connect to the Rya instance that was just installed.
final AccumuloRdfConfiguration conf = makeConfig(instanceName, zookeepers);
final Sail sail = RyaSailFactory.getInstance(conf);
dao = RyaSailFactory.getAccumuloDAOWithUpdatedConfig(conf);
ryaSailRepo = new RyaSailRepository(sail);
}
use of org.apache.rya.rdftriplestore.RyaSailRepository in project incubator-rya by apache.
the class PcjAdminClient method makeRyaRepository.
private static RyaSailRepository makeRyaRepository(final PcjAdminClientProperties clientProps, final Connector accumulo) throws RepositoryException {
checkNotNull(clientProps);
checkNotNull(accumulo);
// Setup Rya configuration values.
final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
ryaConf.setTablePrefix(clientProps.getRyaTablePrefix());
// Connect to the Rya repo.
final AccumuloRyaDAO accumuloRyaDao = new AccumuloRyaDAO();
accumuloRyaDao.setConnector(accumulo);
accumuloRyaDao.setConf(ryaConf);
final RdfCloudTripleStore ryaStore = new RdfCloudTripleStore();
ryaStore.setRyaDAO(accumuloRyaDao);
final RyaSailRepository ryaRepo = new RyaSailRepository(ryaStore);
ryaRepo.initialize();
return ryaRepo;
}
use of org.apache.rya.rdftriplestore.RyaSailRepository 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.RyaSailRepository in project incubator-rya by apache.
the class ITBase method getNewMongoResources.
/**
* @return A new {@link MongoClient}. Note: This does not have RYA installed.
* @throws MongoException
* @throws InferenceEngineException
* @throws RyaDAOException
* @throws AccumuloSecurityException
* @throws AccumuloException
* @throws RepositoryException
* @throws NumberFormatException
* @throws IOException
* @throws SailException
*/
public static MongoClient getNewMongoResources(final String ryaInstanceName) throws MongoException, NumberFormatException, RepositoryException, AccumuloException, AccumuloSecurityException, RyaDAOException, InferenceEngineException, IOException, SailException {
// Initialize the test mongo that will be used to host rya.
final MongodForTestsFactory mongodTestFactory = new MongodForTestsFactory();
final MongoClient newClient = mongodTestFactory.newMongo();
clients.add(newClient);
final String host = newClient.getAddress().getHost();
final int port = newClient.getAddress().getPort();
final RyaSailRepository newRepo = setupRya(ryaInstanceName, host, port, newClient);
ryaRepos.add(newRepo);
return newClient;
}
use of org.apache.rya.rdftriplestore.RyaSailRepository in project incubator-rya by apache.
the class ITBase method setupRya.
/**
* Sets up a Rya instance
*
* @param user
* @param password
* @param instanceName
* @param zookeepers
* @param appName
* @return
* @throws AccumuloException
* @throws AccumuloSecurityException
* @throws RepositoryException
* @throws RyaDAOException
* @throws NumberFormatException
* @throws UnknownHostException
* @throws InferenceEngineException
* @throws SailException
*/
protected static RyaSailRepository setupRya(final String ryaInstanceName, final String hostname, final int port, final MongoClient client) throws AccumuloException, AccumuloSecurityException, RepositoryException, RyaDAOException, NumberFormatException, UnknownHostException, InferenceEngineException, SailException {
checkNotNull(ryaInstanceName);
// Setup Rya configuration values.
final MongoDBRdfConfiguration conf = getConf(ryaInstanceName, hostname, port);
configs.put(client, conf);
final Sail sail = RyaSailFactory.getInstance(conf);
final RyaSailRepository ryaRepo = new RyaSailRepository(sail);
return ryaRepo;
}
Aggregations