use of org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails in project incubator-rya by apache.
the class MongoInstall 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)
* @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) throws AlreadyInitializedException, RyaDetailsRepositoryException {
final RyaDetailsRepository detailsRepo = new MongoRyaInstanceDetailsRepository(adminClient, instanceName);
if (installConfig.getFluoPcjAppName().isPresent()) {
log.warn("Mongo does not have fluo support, use ignoring the configured fluo application name: " + installConfig.getFluoPcjAppName().get());
}
// Build the PCJ Index details.
final PCJIndexDetails.Builder pcjDetailsBuilder = PCJIndexDetails.builder().setEnabled(installConfig.isPcjIndexEnabled());
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion(getVersion()).setTemporalIndexDetails(new TemporalIndexDetails(installConfig.isTemporalIndexEnabled())).setFreeTextDetails(new FreeTextIndexDetails(installConfig.isFreeTextIndexEnabled())).setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).setPCJIndexDetails(pcjDetailsBuilder).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).build();
// Initialize the table.
detailsRepo.initialize(details);
return details;
}
use of org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails 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());
}
use of org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails in project incubator-rya by apache.
the class MongoPcjStorageIT method listPcjs.
@Test
public void listPcjs() throws Exception {
try (final PrecomputedJoinStorage pcjStorage = new MongoPcjStorage(getMongoClient(), conf.getRyaInstanceName())) {
final MongoRyaInstanceDetailsRepository detailsRepo = new MongoRyaInstanceDetailsRepository(getMongoClient(), conf.getRyaInstanceName());
detailsRepo.initialize(RyaDetails.builder().setRyaInstanceName(conf.getRyaInstanceName()).setRyaVersion("test").setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).setTemporalIndexDetails(new TemporalIndexDetails(false)).setFreeTextDetails(new FreeTextIndexDetails(false)).setProspectorDetails(new ProspectorDetails(Optional.absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent())).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).build());
// Create a few PCJs and hold onto their IDs.
final List<String> expectedIds = new ArrayList<>();
String pcjId = pcjStorage.createPcj("SELECT * WHERE { ?a <http://isA> ?b } ");
expectedIds.add(pcjId);
pcjId = pcjStorage.createPcj("SELECT * WHERE { ?a <http://isA> ?b } ");
expectedIds.add(pcjId);
pcjId = pcjStorage.createPcj("SELECT * WHERE { ?a <http://isA> ?b } ");
expectedIds.add(pcjId);
// Fetch the PCJ names
final List<String> pcjIds = pcjStorage.listPcjs();
// Ensure the expected IDs match the fetched IDs.
Collections.sort(expectedIds);
Collections.sort(pcjIds);
assertEquals(expectedIds, pcjIds);
}
}
use of org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails in project incubator-rya by apache.
the class MongoPcjStorageIT method createPCJ.
@Test
public void createPCJ() throws Exception {
// Setup the PCJ storage that will be tested against.
try (final PrecomputedJoinStorage pcjStorage = new MongoPcjStorage(getMongoClient(), conf.getRyaInstanceName())) {
// Create a PCJ.
final MongoRyaInstanceDetailsRepository detailsRepo = new MongoRyaInstanceDetailsRepository(getMongoClient(), conf.getRyaInstanceName());
detailsRepo.initialize(RyaDetails.builder().setRyaInstanceName(conf.getRyaInstanceName()).setRyaVersion("test").setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).setTemporalIndexDetails(new TemporalIndexDetails(false)).setFreeTextDetails(new FreeTextIndexDetails(false)).setProspectorDetails(new ProspectorDetails(Optional.absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent())).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).build());
final String pcjId = pcjStorage.createPcj("SELECT * WHERE { ?a <http://isA> ?b } ");
// Ensure the Rya details have been updated to include the PCJ's ID.
final ImmutableMap<String, PCJDetails> detailsMap = detailsRepo.getRyaInstanceDetails().getPCJIndexDetails().getPCJDetails();
final PCJDetails expectedDetails = PCJDetails.builder().setId(pcjId).build();
assertEquals(expectedDetails, detailsMap.get(pcjId));
}
}
use of org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails in project incubator-rya by apache.
the class MongoPcjStorageIT method addResults.
@Test
public void addResults() throws Exception {
try (final PrecomputedJoinStorage pcjStorage = new MongoPcjStorage(getMongoClient(), conf.getRyaInstanceName())) {
final MongoRyaInstanceDetailsRepository detailsRepo = new MongoRyaInstanceDetailsRepository(getMongoClient(), conf.getRyaInstanceName());
detailsRepo.initialize(RyaDetails.builder().setRyaInstanceName(conf.getRyaInstanceName()).setRyaVersion("test").setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).setTemporalIndexDetails(new TemporalIndexDetails(false)).setFreeTextDetails(new FreeTextIndexDetails(false)).setProspectorDetails(new ProspectorDetails(Optional.absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent())).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).build());
// Create a PCJ.
final String sparql = "SELECT * WHERE { ?a <http://isA> ?b }";
final String pcjId = pcjStorage.createPcj(sparql);
// Add some binding sets to it.
final Set<VisibilityBindingSet> results = new HashSet<>();
final MapBindingSet aliceBS = new MapBindingSet();
aliceBS.addBinding("a", new URIImpl("http://Alice"));
aliceBS.addBinding("b", new URIImpl("http://Person"));
results.add(new VisibilityBindingSet(aliceBS, ""));
final MapBindingSet charlieBS = new MapBindingSet();
charlieBS.addBinding("a", new URIImpl("http://Charlie"));
charlieBS.addBinding("b", new URIImpl("http://Comedian"));
results.add(new VisibilityBindingSet(charlieBS, ""));
pcjStorage.addResults(pcjId, results);
// Make sure the PCJ metadata was updated.
final PcjMetadata metadata = pcjStorage.getPcjMetadata(pcjId);
final Set<VariableOrder> varOrders = new ShiftVarOrderFactory().makeVarOrders(sparql);
final PcjMetadata expectedMetadata = new PcjMetadata(sparql, 2L, varOrders);
assertEquals(expectedMetadata, metadata);
}
}
Aggregations