use of org.apache.rya.api.RdfCloudTripleStoreConfiguration in project incubator-rya by apache.
the class AccumuloStatementMetadataOptimizerIT method getConf.
private static RdfCloudTripleStoreConfiguration getConf() {
RdfCloudTripleStoreConfiguration conf;
Set<RyaURI> propertySet = new HashSet<RyaURI>(Arrays.asList(new RyaURI("http://createdBy"), new RyaURI("http://createdOn")));
conf = new AccumuloRdfConfiguration();
conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, true);
conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya_");
conf.set(ConfigUtils.CLOUDBASE_USER, "root");
conf.set(ConfigUtils.CLOUDBASE_PASSWORD, "");
conf.set(ConfigUtils.CLOUDBASE_INSTANCE, "instance");
conf.set(ConfigUtils.CLOUDBASE_AUTHS, "");
conf.setUseStatementMetadata(true);
conf.setStatementMetadataProperties(propertySet);
return conf;
}
use of org.apache.rya.api.RdfCloudTripleStoreConfiguration in project incubator-rya by apache.
the class InfoRyaCommand method doRyaExecute.
@Override
protected Object doRyaExecute() throws Exception {
System.out.println("******************RYA Configuration******************");
RdfCloudTripleStoreConfiguration conf = rdfDAO.getConf();
for (Map.Entry<String, String> next : conf) {
System.out.println(next.getKey() + ":\t\t" + next.getValue());
}
System.out.println("*****************************************************");
return null;
}
use of org.apache.rya.api.RdfCloudTripleStoreConfiguration in project incubator-rya by apache.
the class EntityOptimizer method setConf.
@Override
public void setConf(Configuration conf) {
if (conf instanceof RdfCloudTripleStoreConfiguration) {
this.conf = (RdfCloudTripleStoreConfiguration) conf;
} else {
this.conf = new AccumuloRdfConfiguration(conf);
}
if (!isEvalDaoSet) {
if (this.conf.isUseStats() && this.conf.isUseSelectivity()) {
try {
eval = new AccumuloSelectivityEvalDAO(this.conf, ConfigUtils.getConnector(this.conf));
((AccumuloSelectivityEvalDAO) eval).setRdfEvalDAO(new ProspectorServiceEvalStatsDAO(ConfigUtils.getConnector(this.conf), this.conf));
eval.init();
} catch (final AccumuloException | AccumuloSecurityException e) {
LOG.warn("A problem was encountered while setting the Configuration for the EntityOptimizer.", e);
}
isEvalDaoSet = true;
} else {
eval = null;
isEvalDaoSet = true;
}
}
}
use of org.apache.rya.api.RdfCloudTripleStoreConfiguration in project incubator-rya by apache.
the class AccumuloIndexSetProvider method getIndices.
@Override
protected List<ExternalTupleSet> getIndices() throws PcjIndexSetException {
requireNonNull(conf);
try {
final String tablePrefix = requireNonNull(conf.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX));
final Connector conn = requireNonNull(ConfigUtils.getConnector(conf));
List<String> tables = null;
if (conf instanceof RdfCloudTripleStoreConfiguration) {
tables = ((RdfCloudTripleStoreConfiguration) conf).getPcjTables();
}
// this maps associates pcj table name with pcj sparql query
final Map<String, String> indexTables = Maps.newLinkedHashMap();
try (final PrecomputedJoinStorage storage = new AccumuloPcjStorage(conn, tablePrefix)) {
final PcjTableNameFactory pcjFactory = new PcjTableNameFactory();
final boolean tablesProvided = tables != null && !tables.isEmpty();
if (tablesProvided) {
// if tables provided, associate table name with sparql
for (final String table : tables) {
indexTables.put(table, storage.getPcjMetadata(pcjFactory.getPcjId(table)).getSparql());
}
} else if (hasRyaDetails(tablePrefix, conn)) {
// If this is a newer install of Rya, and it has PCJ Details, then
// use those.
final List<String> ids = storage.listPcjs();
for (final String id : ids) {
indexTables.put(pcjFactory.makeTableName(tablePrefix, id), storage.getPcjMetadata(id).getSparql());
}
} else {
// Otherwise figure it out by scanning tables.
final PcjTables pcjTables = new PcjTables();
for (final String table : conn.tableOperations().list()) {
if (table.startsWith(tablePrefix + "INDEX")) {
indexTables.put(table, pcjTables.getPcjMetadata(conn, table).getSparql());
}
}
}
}
// use table name sparql map (indexTables) to create {@link
// AccumuloIndexSet}
final List<ExternalTupleSet> index = Lists.newArrayList();
if (indexTables.isEmpty()) {
log.info("No Index found");
} else {
for (final String table : indexTables.keySet()) {
final String indexSparqlString = indexTables.get(table);
index.add(new AccumuloIndexSet(indexSparqlString, conf, table));
}
}
return index;
} catch (final PCJStorageException | AccumuloException | AccumuloSecurityException | MalformedQueryException | SailException | QueryEvaluationException | TableNotFoundException e) {
throw new PcjIndexSetException("Failed to retrieve the indicies.", e);
}
}
use of org.apache.rya.api.RdfCloudTripleStoreConfiguration in project incubator-rya by apache.
the class ConfigUtils method createBatchScanner.
public static BatchScanner createBatchScanner(final String tablename, final Configuration conf) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
final Connector connector = ConfigUtils.getConnector(conf);
final Authorizations auths = ConfigUtils.getAuthorizations(conf);
Integer numThreads = null;
if (conf instanceof RdfCloudTripleStoreConfiguration) {
numThreads = ((RdfCloudTripleStoreConfiguration) conf).getNumThreads();
} else {
numThreads = conf.getInt(RdfCloudTripleStoreConfiguration.CONF_NUM_THREADS, 2);
}
return connector.createBatchScanner(tablename, auths, numThreads);
}
Aggregations