Search in sources :

Example 6 with RyaSailRepository

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);
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) Sail(org.openrdf.sail.Sail) MiniAccumuloCluster(org.apache.accumulo.minicluster.MiniAccumuloCluster) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) RyaClient(org.apache.rya.api.client.RyaClient) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 7 with RyaSailRepository

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;
}
Also used : AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 8 with RyaSailRepository

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;
}
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 9 with RyaSailRepository

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;
}
Also used : MongoClient(com.mongodb.MongoClient) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) MongodForTestsFactory(de.flapdoodle.embed.mongo.tests.MongodForTestsFactory)

Example 10 with RyaSailRepository

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;
}
Also used : Sail(org.openrdf.sail.Sail) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) MongoDBRdfConfiguration(org.apache.rya.mongodb.MongoDBRdfConfiguration)

Aggregations

RyaSailRepository (org.apache.rya.rdftriplestore.RyaSailRepository)20 RdfCloudTripleStore (org.apache.rya.rdftriplestore.RdfCloudTripleStore)9 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)8 AccumuloRyaDAO (org.apache.rya.accumulo.AccumuloRyaDAO)5 Sail (org.openrdf.sail.Sail)5 Test (org.junit.Test)4 HashSet (java.util.HashSet)3 Connector (org.apache.accumulo.core.client.Connector)3 PcjMetadata (org.apache.rya.indexing.pcj.storage.PcjMetadata)3 MongoDBRyaDAO (org.apache.rya.mongodb.MongoDBRyaDAO)3 StatefulMongoDBRdfConfiguration (org.apache.rya.mongodb.StatefulMongoDBRdfConfiguration)3 NamespaceManager (org.apache.rya.rdftriplestore.namespace.NamespaceManager)3 Statement (org.openrdf.model.Statement)3 LiteralImpl (org.openrdf.model.impl.LiteralImpl)3 NumericLiteralImpl (org.openrdf.model.impl.NumericLiteralImpl)3 StatementImpl (org.openrdf.model.impl.StatementImpl)3 URIImpl (org.openrdf.model.impl.URIImpl)3 SailRepositoryConnection (org.openrdf.repository.sail.SailRepositoryConnection)3 MongoClient (com.mongodb.MongoClient)2 Install (org.apache.rya.api.client.Install)2