use of org.apache.rya.rdftriplestore.RyaSailRepository in project incubator-rya by apache.
the class ITBase method shutdownMiniResources.
@AfterClass
public static void shutdownMiniResources() throws RepositoryException {
for (final RyaSailRepository repo : ryaRepos) {
repo.shutDown();
}
for (final RepositoryConnection conn : ryaConns) {
conn.close();
}
for (final MongoClient client : clients) {
client.close();
}
ryaRepos.clear();
ryaConns.clear();
clients.clear();
}
use of org.apache.rya.rdftriplestore.RyaSailRepository in project incubator-rya by apache.
the class CbSailTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
store = new MockRdfCloudStore();
// store.setDisplayQueryPlan(true);
// store.setInferencing(false);
NamespaceManager nm = new NamespaceManager(store.getRyaDAO(), store.getConf());
store.setNamespaceManager(nm);
repository = new RyaSailRepository(store);
repository.initialize();
JndiRegistry registry = super.createRegistry();
registry.bind(Repository.class.getName(), repository);
return registry;
}
use of org.apache.rya.rdftriplestore.RyaSailRepository in project incubator-rya by apache.
the class PcjAdminClient method main.
public static void main(final String[] args) {
log.trace("Starting up the PCJ Admin Client.");
// If no command provided or the command isn't recognized, then print the usage.
if (args.length == 0 || !commands.containsKey(args[0])) {
System.out.println(usage);
System.exit(-1);
}
// Load the properties file.
final Properties props = new Properties();
try (InputStream pin = Files.newInputStream(PROPERTIES_FILE)) {
props.load(pin);
} catch (final IOException e) {
throw new RuntimeException("Could not load properties file: " + PROPERTIES_FILE, e);
}
// Fetch the command that will be executed.
final String command = args[0];
final String[] commandArgs = Arrays.copyOfRange(args, 1, args.length);
final PcjAdminClientCommand pcjCommand = commands.get(command);
RyaSailRepository rya = null;
FluoClient fluo = null;
try {
// Connect to Accumulo, Rya, and Fluo.
final PcjAdminClientProperties clientProps = new PcjAdminClientProperties(props);
final Connector accumulo = createAccumuloConnector(clientProps);
rya = makeRyaRepository(clientProps, accumulo);
fluo = createFluoClient(clientProps);
// Execute the command.
pcjCommand.execute(accumulo, clientProps.getRyaTablePrefix(), rya, fluo, commandArgs);
} catch (final AccumuloException | AccumuloSecurityException e) {
System.err.println("Could not connect to the Accumulo instance that hosts the export PCJ tables.");
e.printStackTrace();
System.exit(-1);
} catch (final RepositoryException e) {
System.err.println("Could not connect to the Rya instance that hosts the historic RDF statements.");
e.printStackTrace();
System.exit(-1);
} catch (final ArgumentsException e) {
System.err.println(pcjCommand.getUsage());
System.exit(-1);
} catch (final ExecutionException e) {
System.err.println("Could not execute the command.");
e.printStackTrace();
System.exit(-1);
} catch (UnsupportedQueryException e) {
System.err.println("Could not execute the command because the query is invalid.");
e.printStackTrace();
} finally {
log.trace("Shutting down the PCJ Admin Client.");
if (rya != null) {
try {
rya.shutDown();
} catch (final RepositoryException e) {
System.err.println("Problem while shutting down the Rya connection.");
e.printStackTrace();
}
}
if (fluo != null) {
fluo.close();
}
}
}
use of org.apache.rya.rdftriplestore.RyaSailRepository in project incubator-rya by apache.
the class FluoITBase method setupRya.
/**
* Sets up a Rya instance.
*/
protected RyaSailRepository setupRya() throws AccumuloException, AccumuloSecurityException, RepositoryException, RyaDAOException, NumberFormatException, UnknownHostException, InferenceEngineException, AlreadyInitializedException, RyaDetailsRepositoryException, DuplicateInstanceNameException, RyaClientException, SailException {
checkNotNull(instanceName);
checkNotNull(zookeepers);
// Setup Rya configuration values.
final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
conf.setTablePrefix(getRyaInstanceName());
conf.setDisplayQueryPlan(true);
conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, false);
conf.set(ConfigUtils.CLOUDBASE_USER, clusterInstance.getUsername());
conf.set(ConfigUtils.CLOUDBASE_PASSWORD, clusterInstance.getPassword());
conf.set(ConfigUtils.CLOUDBASE_INSTANCE, clusterInstance.getInstanceName());
conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, clusterInstance.getZookeepers());
conf.set(ConfigUtils.USE_PCJ, "true");
conf.set(ConfigUtils.FLUO_APP_NAME, getRyaInstanceName());
conf.set(ConfigUtils.PCJ_STORAGE_TYPE, PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType.ACCUMULO.toString());
conf.set(ConfigUtils.PCJ_UPDATER_TYPE, PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType.FLUO.toString());
conf.set(ConfigUtils.CLOUDBASE_AUTHS, "");
// Install the test instance of Rya.
final Install install = new AccumuloInstall(createConnectionDetails(), accumuloConn);
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnablePcjIndex(true).setEnableGeoIndex(true).setFluoPcjAppName(getRyaInstanceName()).build();
install.install(getRyaInstanceName(), installConfig);
// Connect to the instance of Rya that was just installed.
final Sail sail = RyaSailFactory.getInstance(conf);
final RyaSailRepository ryaRepo = new RyaSailRepository(sail);
return ryaRepo;
}
use of org.apache.rya.rdftriplestore.RyaSailRepository 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