Search in sources :

Example 1 with AccumuloRdfEvalStatsDAO

use of org.apache.rya.accumulo.AccumuloRdfEvalStatsDAO 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);
        }
    }
}
Also used : Connector(org.apache.accumulo.core.client.Connector) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) InferenceEngine(org.apache.rya.rdftriplestore.inference.InferenceEngine) PigServer(org.apache.pig.PigServer) AccumuloRdfEvalStatsDAO(org.apache.rya.accumulo.AccumuloRdfEvalStatsDAO) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance)

Aggregations

Connector (org.apache.accumulo.core.client.Connector)1 ZooKeeperInstance (org.apache.accumulo.core.client.ZooKeeperInstance)1 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)1 PigServer (org.apache.pig.PigServer)1 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)1 AccumuloRdfEvalStatsDAO (org.apache.rya.accumulo.AccumuloRdfEvalStatsDAO)1 AccumuloRyaDAO (org.apache.rya.accumulo.AccumuloRyaDAO)1 InferenceEngine (org.apache.rya.rdftriplestore.inference.InferenceEngine)1