use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class SparqlQueryPigEngine method init.
public void init() throws Exception {
Preconditions.checkNotNull(sparqlToPigTransformVisitor, "Sparql To Pig Transform Visitor must not be null");
logger.info("Initializing Sparql Query Pig Engine");
if (hadoopDir != null) {
// set hadoop dir property
System.setProperty("HADOOPDIR", hadoopDir);
}
if (pigServer == null) {
pigServer = new PigServer(execType);
}
if (inference || stats) {
final String instance = sparqlToPigTransformVisitor.getInstance();
final String zoo = sparqlToPigTransformVisitor.getZk();
final String user = sparqlToPigTransformVisitor.getUser();
final String pass = sparqlToPigTransformVisitor.getPassword();
final Connector connector = new ZooKeeperInstance(instance, zoo).getConnector(user, new PasswordToken(pass.getBytes(StandardCharsets.UTF_8)));
final String tablePrefix = sparqlToPigTransformVisitor.getTablePrefix();
conf.setTablePrefix(tablePrefix);
if (inference) {
logger.info("Using inference");
inferenceEngine = new InferenceEngine();
ryaDAO = new AccumuloRyaDAO();
ryaDAO.setConf(conf);
ryaDAO.setConnector(connector);
ryaDAO.init();
inferenceEngine.setRyaDAO(ryaDAO);
inferenceEngine.setConf(conf);
inferenceEngine.setSchedule(false);
inferenceEngine.init();
}
if (stats) {
logger.info("Using stats");
rdfEvalStatsDAO = new AccumuloRdfEvalStatsDAO();
rdfEvalStatsDAO.setConf(conf);
rdfEvalStatsDAO.setConnector(connector);
// rdfEvalStatsDAO.setEvalTable(tablePrefix + RdfCloudTripleStoreConstants.TBL_EVAL_SUFFIX);
rdfEvalStatsDAO.init();
rdfCloudTripleStoreEvaluationStatistics = new RdfCloudTripleStoreEvaluationStatistics<AccumuloRdfConfiguration>(conf, rdfEvalStatsDAO);
}
}
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class InferenceIT method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
dao = new AccumuloRyaDAO();
connector = new MockInstance().getConnector("", new PasswordToken(""));
dao.setConnector(connector);
conf = new AccumuloRdfConfiguration();
conf.setInfer(true);
dao.setConf(conf);
dao.init();
store = new RdfCloudTripleStore();
store.setConf(conf);
store.setRyaDAO(dao);
inferenceEngine = new InferenceEngine();
inferenceEngine.setRyaDAO(dao);
store.setInferenceEngine(inferenceEngine);
inferenceEngine.refreshGraph();
store.initialize();
repository = new SailRepository(store);
conn = repository.getConnection();
solutions = new LinkedList<>();
resultHandler = new TupleQueryResultHandler() {
@Override
public void endQueryResult() throws TupleQueryResultHandlerException {
}
@Override
public void handleBoolean(final boolean value) throws QueryResultHandlerException {
}
@Override
public void handleLinks(final List<String> linkUrls) throws QueryResultHandlerException {
}
@Override
public void handleSolution(final BindingSet bindingSet) throws TupleQueryResultHandlerException {
if (bindingSet != null && bindingSet.iterator().hasNext()) {
solutions.add(bindingSet);
}
}
@Override
public void startQueryResult(final List<String> bindingNames) throws TupleQueryResultHandlerException {
solutions.clear();
}
};
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class HashJoinTest method init.
@Before
public void init() throws Exception {
dao = new AccumuloRyaDAO();
connector = new MockInstance().getConnector("", "");
dao.setConnector(connector);
dao.setConf(conf);
dao.init();
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class TestUtils method verify.
public static void verify(Connector connector, AccumuloRdfConfiguration conf, RyaStatement... ryaStatements) throws RyaDAOException, IOException {
AccumuloRyaDAO dao = new AccumuloRyaDAO();
dao.setConnector(connector);
dao.setConf(conf);
dao.init();
AccumuloRyaQueryEngine engine = dao.getQueryEngine();
for (RyaStatement ryaStatement : ryaStatements) {
verify(ryaStatement, engine);
}
dao.destroy();
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class GeoRyaSailFactory method getAccumuloDAO.
private static AccumuloRyaDAO getAccumuloDAO(final AccumuloRdfConfiguration config) throws AccumuloException, AccumuloSecurityException, RyaDAOException {
final Connector connector = ConfigUtils.getConnector(config);
final AccumuloRyaDAO dao = new AccumuloRyaDAO();
dao.setConnector(connector);
OptionalConfigUtils.setIndexers(config);
config.setDisplayQueryPlan(true);
dao.setConf(config);
dao.init();
return dao;
}
Aggregations