Search in sources :

Example 6 with InstallConfiguration

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

the class MongoDeletePCJIT method deletePCJ.

@Test
public void deletePCJ() throws Exception {
    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);
    System.out.println(getMongoClient().getDatabase(conf.getRyaInstanceName()).getCollection("instance_details").find().first().toJson());
    // Create a PCJ.
    final String sparql = "SELECT ?x " + "WHERE { " + "?x <http://talksTo> <http://Eve>. " + "?x <http://worksAt> <http://TacoJoint>." + "}";
    final String pcjId = createPCJ.createPCJ(conf.getRyaInstanceName(), sparql);
    final DeletePCJ deletePCJ = ryaClient.getDeletePCJ();
    deletePCJ.deletePCJ(conf.getRyaInstanceName(), pcjId);
    // Verify the RyaDetails were updated to include the new PCJ.
    final Optional<RyaDetails> ryaDetails = ryaClient.getGetInstanceDetails().getDetails(conf.getRyaInstanceName());
    final ImmutableMap<String, PCJDetails> details = ryaDetails.get().getPCJIndexDetails().getPCJDetails();
    final PCJDetails pcjDetails = details.get(pcjId);
    assertNull(pcjDetails);
}
Also used : CreatePCJ(org.apache.rya.api.client.CreatePCJ) AccumuloCreatePCJ(org.apache.rya.api.client.accumulo.AccumuloCreatePCJ) RyaDetails(org.apache.rya.api.instance.RyaDetails) RyaClient(org.apache.rya.api.client.RyaClient) DeletePCJ(org.apache.rya.api.client.DeletePCJ) Install(org.apache.rya.api.client.Install) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) PCJDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails) Test(org.junit.Test)

Example 7 with InstallConfiguration

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

the class MongoGetInstanceDetailsIT method getDetails.

@Test
public void getDetails() throws MongoException, RyaClientException {
    final String instanceName = "instance";
    // Install an instance of Rya.
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnablePcjIndex(true).build();
    final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
    final Install install = ryaClient.getInstall();
    install.install(instanceName, installConfig);
    // Verify the correct details were persisted.
    final GetInstanceDetails getInstanceDetails = ryaClient.getGetInstanceDetails();
    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(false)).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) RyaClient(org.apache.rya.api.client.RyaClient) 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 8 with InstallConfiguration

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

the class MongoLoadStatementsIT method loadStatements.

/**
 * Pass a list of statements to our loadStatement class.
 */
@Test
public void loadStatements() throws Exception {
    // Install an instance of Rya.
    final MongoConnectionDetails connectionDetails = getConnectionDetails();
    final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableEntityCentricIndex(false).setEnableFreeTextIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(false).setEnableGeoIndex(false).build();
    ryaClient.getInstall().install(conf.getRyaInstanceName(), installConfig);
    // Create the statements that will be loaded.
    final Set<Statement> statements = makeTestStatements();
    // Load them.
    ryaClient.getLoadStatements().loadStatements(conf.getRyaInstanceName(), statements);
    // Fetch the statements that have been stored in Mongo DB.
    final Set<Statement> stmtResults = new HashSet<>();
    final MongoCursor<Document> triplesIterator = getMongoClient().getDatabase(conf.getRyaInstanceName()).getCollection(conf.getTriplesCollectionName()).find().iterator();
    while (triplesIterator.hasNext()) {
        final Document triple = triplesIterator.next();
        stmtResults.add(VF.createStatement(VF.createURI(triple.getString("subject")), VF.createURI(triple.getString("predicate")), VF.createURI(triple.getString("object"))));
    }
    // Show the discovered statements match the original statements.
    assertEquals(statements, stmtResults);
}
Also used : Statement(org.openrdf.model.Statement) RyaClient(org.apache.rya.api.client.RyaClient) Document(org.bson.Document) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 9 with InstallConfiguration

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

the class AccumuloSetRyaStreamsConfigurationIT method updatesRyaDetails.

@Test
public void updatesRyaDetails() throws Exception {
    final String ryaInstance = getRyaInstanceName();
    final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
    final RyaClient ryaClient = AccumuloRyaClientFactory.build(connectionDetails, getConnector());
    // Install an instance of Rya.
    final Install installRya = ryaClient.getInstall();
    final InstallConfiguration installConf = InstallConfiguration.builder().build();
    installRya.install(ryaInstance, installConf);
    // Fetch its details and show they do not have any RyaStreamsDetails.
    com.google.common.base.Optional<RyaStreamsDetails> streamsDetails = ryaClient.getGetInstanceDetails().getDetails(ryaInstance).get().getRyaStreamsDetails();
    assertFalse(streamsDetails.isPresent());
    // Set the details.
    final RyaStreamsDetails details = new RyaStreamsDetails("localhost", 6);
    ryaClient.getSetRyaStreamsConfiguration().setRyaStreamsConfiguration(ryaInstance, details);
    // Fetch its details again and show that they are now filled in.
    streamsDetails = ryaClient.getGetInstanceDetails().getDetails(ryaInstance).get().getRyaStreamsDetails();
    assertEquals(details, streamsDetails.get());
}
Also used : RyaStreamsDetails(org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails) 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)

Example 10 with InstallConfiguration

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

the class MongoInstallIT method install_alreadyExists.

@Test(expected = DuplicateInstanceNameException.class)
public void install_alreadyExists() throws DuplicateInstanceNameException, RyaClientException {
    // Install an instance of Rya.
    final String instanceName = conf.getRyaInstanceName();
    final InstallConfiguration installConfig = InstallConfiguration.builder().build();
    final MongoConnectionDetails connectionDetails = getConnectionDetails();
    final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
    final Install install = ryaClient.getInstall();
    install.install(instanceName, installConfig);
    // Install it again throws expected error.
    install.install(instanceName, installConfig);
}
Also used : 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)

Aggregations

InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)32 RyaClient (org.apache.rya.api.client.RyaClient)26 Test (org.junit.Test)26 Install (org.apache.rya.api.client.Install)20 InstallPrompt (org.apache.rya.shell.util.InstallPrompt)6 Statement (org.openrdf.model.Statement)5 CreatePCJ (org.apache.rya.api.client.CreatePCJ)4 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)4 RyaDetails (org.apache.rya.api.instance.RyaDetails)4 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)4 UninstallPrompt (org.apache.rya.shell.util.UninstallPrompt)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 DuplicateInstanceNameException (org.apache.rya.api.client.Install.DuplicateInstanceNameException)3 InstanceExists (org.apache.rya.api.client.InstanceExists)3 RyaClientException (org.apache.rya.api.client.RyaClientException)3 AccumuloCreatePCJ (org.apache.rya.api.client.accumulo.AccumuloCreatePCJ)3 ValueFactory (org.openrdf.model.ValueFactory)3 Sail (org.openrdf.sail.Sail)3 CliCommand (org.springframework.shell.core.annotation.CliCommand)3