Search in sources :

Example 16 with FreeTextIndexDetails

use of org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails 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 17 with FreeTextIndexDetails

use of org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails in project incubator-rya by apache.

the class RyaDetailsFormatterTest method format_mongo.

@Test
public void format_mongo() {
    // This test failed if the default timezone was not EST, so now it's fixed at EST.
    TimeZone.setDefault(TimeZone.getTimeZone("America/New_York"));
    // Create the object that will be formatted.
    final RyaDetails details = RyaDetails.builder().setRyaInstanceName("test_instance").setRyaVersion("1.2.3.4").setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).setProspectorDetails(new ProspectorDetails(Optional.absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent())).build();
    final String formatted = new RyaDetailsFormatter().format(StorageType.MONGO, details);
    // Verify the created object matches the expected result.
    final String expected = "General Metadata:\n" + "  Instance Name: test_instance\n" + "  RYA Version: 1.2.3.4\n" + "Secondary Indicies:\n" + // RYA-215                "    Enabled: true\n" +
    "  Free Text Index:\n" + "    Enabled: true\n" + "  Temporal Index:\n" + "    Enabled: true\n" + "  PCJ Index:\n" + "    Enabled: true\n" + "    PCJs:\n" + "      No PCJs have been added yet.\n";
    assertEquals(expected, formatted);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Test(org.junit.Test)

Example 18 with FreeTextIndexDetails

use of org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails in project incubator-rya by apache.

the class RyaDetailsFormatterTest method format_accumulo.

@Test
public void format_accumulo() {
    // This test failed if the default timezone was not EST, so now it's fixed at EST.
    TimeZone.setDefault(TimeZone.getTimeZone("America/New_York"));
    // Create the object that will be formatted.
    final RyaDetails details = RyaDetails.builder().setRyaInstanceName("test_instance").setRyaVersion("1.2.3.4").addUser("alice").addUser("bob").addUser("charlie").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("test_instance_rya_pcj_updater")).addPCJDetails(PCJDetails.builder().setId("pcj 1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date(1252521351L))).addPCJDetails(PCJDetails.builder().setId("pcj 2").setUpdateStrategy(PCJUpdateStrategy.INCREMENTAL))).setProspectorDetails(new ProspectorDetails(Optional.of(new Date(12525211L)))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.of(new Date(125221351L)))).build();
    final String formatted = new RyaDetailsFormatter().format(StorageType.ACCUMULO, details);
    // Verify the created object matches the expected result.
    final String expected = "General Metadata:\n" + "  Instance Name: test_instance\n" + "  RYA Version: 1.2.3.4\n" + "  Users: alice, bob, charlie\n" + "Secondary Indicies:\n" + "  Entity Centric Index:\n" + "    Enabled: true\n" + // RYA-215                "    Enabled: true\n" +
    "  Free Text Index:\n" + "    Enabled: true\n" + "  Temporal Index:\n" + "    Enabled: true\n" + "  PCJ Index:\n" + "    Enabled: true\n" + "    Fluo App Name: test_instance_rya_pcj_updater\n" + "    PCJs:\n" + "      ID: pcj 1\n" + "        Update Strategy: BATCH\n" + "        Last Update Time: Thu Jan 15 06:55:21 EST 1970\n" + "      ID: pcj 2\n" + "        Update Strategy: INCREMENTAL\n" + "        Last Update Time: unavailable\n" + "Statistics:\n" + "  Prospector:\n" + "    Last Update Time: Wed Dec 31 22:28:45 EST 1969\n" + "  Join Selectivity:\n" + "    Last Updated Time: Fri Jan 02 05:47:01 EST 1970\n";
    assertEquals(expected, formatted);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Test(org.junit.Test)

Example 19 with FreeTextIndexDetails

use of org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails in project incubator-rya by apache.

the class RyaAdminCommandsTest method getInstanceDetails.

@Test
public void getInstanceDetails() throws InstanceDoesNotExistException, RyaClientException {
    // This test is failed if the default timezone was not EST, so now it's fixed at EST.
    // If you get assert mismatch of EST!=EDT, try the deprecated getTimeZone("EST") instead.
    TimeZone.setDefault(TimeZone.getTimeZone("America/New_York"));
    // Mock the object that performs the get operation.
    final GetInstanceDetails mockGetInstanceDetails = mock(GetInstanceDetails.class);
    final String instanceName = "test_instance";
    final RyaDetails details = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion("1.2.3.4").addUser("alice").addUser("bob").addUser("charlie").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("test_instance_rya_pcj_updater")).addPCJDetails(PCJDetails.builder().setId("pcj 1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date(1252521351L))).addPCJDetails(PCJDetails.builder().setId("pcj 2").setUpdateStrategy(PCJUpdateStrategy.INCREMENTAL))).setProspectorDetails(new ProspectorDetails(Optional.of(new Date(12525211L)))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.of(new Date(125221351L)))).build();
    when(mockGetInstanceDetails.getDetails(eq(instanceName))).thenReturn(Optional.of(details));
    final RyaClient mockCommands = mock(RyaClient.class);
    when(mockCommands.getGetInstanceDetails()).thenReturn(mockGetInstanceDetails);
    final SharedShellState state = new SharedShellState();
    state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockCommands);
    state.connectedToInstance(instanceName);
    // Execute the command.
    final RyaAdminCommands commands = new RyaAdminCommands(state, mock(InstallPrompt.class), mock(SparqlPrompt.class), mock(UninstallPrompt.class));
    final String message = commands.printInstanceDetails();
    // Verify the values that were provided to the command were passed through to the GetInstanceDetails.
    verify(mockGetInstanceDetails).getDetails(eq(instanceName));
    // Verify a message is returned that includes the details.
    final String expected = "General Metadata:\n" + "  Instance Name: test_instance\n" + "  RYA Version: 1.2.3.4\n" + "  Users: alice, bob, charlie\n" + "Secondary Indicies:\n" + "  Entity Centric Index:\n" + "    Enabled: true\n" + // RYA-215"    Enabled: true\n" +
    "  Free Text Index:\n" + "    Enabled: true\n" + "  Temporal Index:\n" + "    Enabled: true\n" + "  PCJ Index:\n" + "    Enabled: true\n" + "    Fluo App Name: test_instance_rya_pcj_updater\n" + "    PCJs:\n" + "      ID: pcj 1\n" + "        Update Strategy: BATCH\n" + "        Last Update Time: Thu Jan 15 06:55:21 EST 1970\n" + "      ID: pcj 2\n" + "        Update Strategy: INCREMENTAL\n" + "        Last Update Time: unavailable\n" + "Statistics:\n" + "  Prospector:\n" + "    Last Update Time: Wed Dec 31 22:28:45 EST 1969\n" + "  Join Selectivity:\n" + "    Last Updated Time: Fri Jan 02 05:47:01 EST 1970\n";
    assertEquals(expected, message);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) RyaClient(org.apache.rya.api.client.RyaClient) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) UninstallPrompt(org.apache.rya.shell.util.UninstallPrompt) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) GetInstanceDetails(org.apache.rya.api.client.GetInstanceDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) InstallPrompt(org.apache.rya.shell.util.InstallPrompt) Test(org.junit.Test)

Example 20 with FreeTextIndexDetails

use of org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails in project incubator-rya by apache.

the class AccumuloInstall method initializeRyaDetails.

/**
 * Initializes the {@link RyaDetails} and stores them for the new instance.
 *
 * @param instanceName - The name of the instance that is being created. (not null)
 * @param installConfig - The instance's install configuration. (not null)
 * @param installUser - The user who is installing the instance of Rya. (not null)
 * @return The {@link RyaDetails} that were stored.
 * @throws AlreadyInitializedException Could not be initialized because
 *   a table with this instance name has already exists and is holding the details.
 * @throws RyaDetailsRepositoryException Something caused the initialization
 *   operation to fail.
 */
private RyaDetails initializeRyaDetails(final String instanceName, final InstallConfiguration installConfig, final String installUser) throws AlreadyInitializedException, RyaDetailsRepositoryException {
    requireNonNull(instanceName);
    requireNonNull(installConfig);
    requireNonNull(installUser);
    final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(getConnector(), instanceName);
    // Build the PCJ Index details.
    final PCJIndexDetails.Builder pcjDetailsBuilder = PCJIndexDetails.builder().setEnabled(installConfig.isPcjIndexEnabled());
    if (installConfig.getFluoPcjAppName().isPresent()) {
        final String fluoPcjAppName = installConfig.getFluoPcjAppName().get();
        pcjDetailsBuilder.setFluoDetails(new FluoDetails(fluoPcjAppName));
    }
    final RyaDetails details = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion(getVersion()).addUser(installUser).setTemporalIndexDetails(new TemporalIndexDetails(installConfig.isTemporalIndexEnabled())).setFreeTextDetails(new FreeTextIndexDetails(installConfig.isFreeTextIndexEnabled())).setEntityCentricIndexDetails(new EntityCentricIndexDetails(installConfig.isEntityCentrixIndexEnabled())).setPCJIndexDetails(pcjDetailsBuilder).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).build();
    // Initialize the table.
    detailsRepo.initialize(details);
    return details;
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) AccumuloRyaInstanceDetailsRepository(org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository) 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) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetailsRepository(org.apache.rya.api.instance.RyaDetailsRepository) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) PCJIndexDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails)

Aggregations

EntityCentricIndexDetails (org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails)38 FreeTextIndexDetails (org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails)38 JoinSelectivityDetails (org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails)38 ProspectorDetails (org.apache.rya.api.instance.RyaDetails.ProspectorDetails)38 TemporalIndexDetails (org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails)38 Test (org.junit.Test)32 Date (java.util.Date)29 RyaDetails (org.apache.rya.api.instance.RyaDetails)25 FluoDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails)17 RyaDetailsRepository (org.apache.rya.api.instance.RyaDetailsRepository)15 MongoRyaInstanceDetailsRepository (org.apache.rya.mongodb.instance.MongoRyaInstanceDetailsRepository)8 PrecomputedJoinStorage (org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage)7 RyaStreamsDetails (org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails)6 BasicDBObject (com.mongodb.BasicDBObject)5 Connector (org.apache.accumulo.core.client.Connector)5 AccumuloRyaInstanceDetailsRepository (org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository)4 HashSet (java.util.HashSet)3 GetInstanceDetails (org.apache.rya.api.client.GetInstanceDetails)3 VisibilityBindingSet (org.apache.rya.api.model.VisibilityBindingSet)3 PcjMetadata (org.apache.rya.indexing.pcj.storage.PcjMetadata)3