Search in sources :

Example 16 with Install

use of org.apache.rya.api.client.Install in project incubator-rya by apache.

the class AccumuloGetInstanceDetailsIT method getDetails.

@Test
public void getDetails() throws AccumuloException, AccumuloSecurityException, DuplicateInstanceNameException, RyaClientException {
    // Install an instance of Rya.
    final String instanceName = getRyaInstanceName();
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnablePcjIndex(true).setEnableGeoIndex(true).build();
    final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
    final Install install = new AccumuloInstall(connectionDetails, getConnector());
    install.install(instanceName, installConfig);
    // Verify the correct details were persisted.
    final GetInstanceDetails getInstanceDetails = new AccumuloGetInstanceDetails(connectionDetails, getConnector());
    final Optional<RyaDetails> details = getInstanceDetails.getDetails(instanceName);
    final RyaDetails expectedDetails = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion(details.get().getRyaVersion()).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).build();
    assertEquals(expectedDetails, details.get());
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) GetInstanceDetails(org.apache.rya.api.client.GetInstanceDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) Install(org.apache.rya.api.client.Install) Test(org.junit.Test)

Example 17 with Install

use of org.apache.rya.api.client.Install in project incubator-rya by apache.

the class AccumuloLoadStatementsFileIT method loadTurtleFile.

@Test
public void loadTurtleFile() throws Exception {
    // Install an instance of Rya.
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableEntityCentricIndex(false).setEnableFreeTextIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(false).setEnableGeoIndex(false).setFluoPcjAppName("fluo_app_name").build();
    final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
    final RyaClient ryaClient = AccumuloRyaClientFactory.build(connectionDetails, getConnector());
    final Install install = ryaClient.getInstall();
    install.install(getRyaInstanceName(), installConfig);
    // Load the test statement file.
    ryaClient.getLoadStatementsFile().loadStatements(getRyaInstanceName(), Paths.get("src/test/resources/example.ttl"), RDFFormat.TURTLE);
    // Verify that the statements were loaded.
    final ValueFactory vf = new ValueFactoryImpl();
    final List<Statement> expected = new ArrayList<>();
    expected.add(vf.createStatement(vf.createURI("http://example#alice"), vf.createURI("http://example#talksTo"), vf.createURI("http://example#bob")));
    expected.add(vf.createStatement(vf.createURI("http://example#bob"), vf.createURI("http://example#talksTo"), vf.createURI("http://example#charlie")));
    expected.add(vf.createStatement(vf.createURI("http://example#charlie"), vf.createURI("http://example#likes"), vf.createURI("http://example#icecream")));
    final List<Statement> statements = new ArrayList<>();
    final WholeRowTripleResolver tripleResolver = new WholeRowTripleResolver();
    final Scanner scanner = getConnector().createScanner(getRyaInstanceName() + "spo", new Authorizations());
    final Iterator<Entry<Key, Value>> it = scanner.iterator();
    while (it.hasNext()) {
        final Entry<Key, Value> next = it.next();
        final Key key = next.getKey();
        final byte[] row = key.getRow().getBytes();
        final byte[] columnFamily = key.getColumnFamily().getBytes();
        final byte[] columnQualifier = key.getColumnQualifier().getBytes();
        final TripleRow tripleRow = new TripleRow(row, columnFamily, columnQualifier);
        final RyaStatement ryaStatement = tripleResolver.deserialize(TABLE_LAYOUT.SPO, tripleRow);
        final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement);
        // Filter out the rya version statement if it is present.
        if (!isRyaMetadataStatement(vf, statement)) {
            statements.add(statement);
        }
    }
    assertEquals(expected, statements);
}
Also used : Scanner(org.apache.accumulo.core.client.Scanner) Authorizations(org.apache.accumulo.core.security.Authorizations) Statement(org.openrdf.model.Statement) RyaStatement(org.apache.rya.api.domain.RyaStatement) ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) ArrayList(java.util.ArrayList) RyaStatement(org.apache.rya.api.domain.RyaStatement) RyaClient(org.apache.rya.api.client.RyaClient) ValueFactory(org.openrdf.model.ValueFactory) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Entry(java.util.Map.Entry) TripleRow(org.apache.rya.api.resolver.triple.TripleRow) WholeRowTripleResolver(org.apache.rya.api.resolver.triple.impl.WholeRowTripleResolver) Value(org.apache.accumulo.core.data.Value) Install(org.apache.rya.api.client.Install) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Example 18 with Install

use of org.apache.rya.api.client.Install in project incubator-rya by apache.

the class MongoUninstallIT method uninstall.

@Test
public void uninstall() throws MongoException, RyaClientException {
    // Install an instance of Rya.
    final String instanceName = "testInstance_";
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnablePcjIndex(true).setEnableGeoIndex(true).setFluoPcjAppName("fluo_app_name").build();
    final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
    final Install install = ryaClient.getInstall();
    install.install(instanceName, installConfig);
    // Show that the instance exists.
    final InstanceExists instanceExists = ryaClient.getInstanceExists();
    assertTrue(instanceExists.exists(instanceName));
    // Uninstall the instance
    final Uninstall uninstall = ryaClient.getUninstall();
    uninstall.uninstall(instanceName);
    // Check that the instance no longer exists.
    assertFalse(instanceExists.exists(instanceName));
}
Also used : InstanceExists(org.apache.rya.api.client.InstanceExists) Uninstall(org.apache.rya.api.client.Uninstall) RyaClient(org.apache.rya.api.client.RyaClient) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Install(org.apache.rya.api.client.Install) Test(org.junit.Test)

Example 19 with Install

use of org.apache.rya.api.client.Install 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.
    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;
}
Also used : Sail(org.openrdf.sail.Sail) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) Install(org.apache.rya.api.client.Install) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration)

Example 20 with Install

use of org.apache.rya.api.client.Install in project incubator-rya by apache.

the class MongoCreatePCJIT method createPCJ_invalidSparql.

@Test(expected = RyaClientException.class)
public void createPCJ_invalidSparql() throws DuplicateInstanceNameException, RyaClientException {
    final MongoConnectionDetails connectionDetails = getConnectionDetails();
    final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
    // Initialize the commands that will be used by this test.
    final CreatePCJ createPCJ = ryaClient.getCreatePCJ();
    final Install installRya = ryaClient.getInstall();
    final InstallConfiguration installConf = InstallConfiguration.builder().setEnablePcjIndex(true).build();
    installRya.install(conf.getRyaInstanceName(), installConf);
    // Create a PCJ.
    final String sparql = "not valid sparql";
    createPCJ.createPCJ(conf.getRyaInstanceName(), sparql);
}
Also used : CreatePCJ(org.apache.rya.api.client.CreatePCJ) AccumuloCreatePCJ(org.apache.rya.api.client.accumulo.AccumuloCreatePCJ) RyaClient(org.apache.rya.api.client.RyaClient) Install(org.apache.rya.api.client.Install) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Test(org.junit.Test)

Aggregations

Install (org.apache.rya.api.client.Install)22 InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)20 Test (org.junit.Test)20 RyaClient (org.apache.rya.api.client.RyaClient)17 CreatePCJ (org.apache.rya.api.client.CreatePCJ)4 RyaDetails (org.apache.rya.api.instance.RyaDetails)4 InstallPrompt (org.apache.rya.shell.util.InstallPrompt)4 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)4 UninstallPrompt (org.apache.rya.shell.util.UninstallPrompt)4 ArrayList (java.util.ArrayList)3 InstanceExists (org.apache.rya.api.client.InstanceExists)3 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)3 AccumuloCreatePCJ (org.apache.rya.api.client.accumulo.AccumuloCreatePCJ)3 Date (java.util.Date)2 GetInstanceDetails (org.apache.rya.api.client.GetInstanceDetails)2 ListInstances (org.apache.rya.api.client.ListInstances)2 EntityCentricIndexDetails (org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails)2 FreeTextIndexDetails (org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails)2 JoinSelectivityDetails (org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails)2 PCJDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails)2