Search in sources :

Example 1 with AccumuloRyaDAO

use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.

the class AccumuloRyaUtils method setupDao.

/**
 * Sets up a {@link AccumuloRyaDAO} with the specified connector and config.
 * @param connector the {@link Connector}.
 * @param accumuloRdfConfiguration the {@link AccumuloRdfConfiguration}.
 * @return the {@link AccumuloRyaDAO}.
 */
public static AccumuloRyaDAO setupDao(final Connector connector, final AccumuloRdfConfiguration accumuloRdfConfiguration) {
    final AccumuloRyaDAO accumuloRyaDao = new AccumuloRyaDAO();
    accumuloRyaDao.setConnector(connector);
    accumuloRyaDao.setConf(accumuloRdfConfiguration);
    try {
        accumuloRyaDao.init();
    } catch (final RyaDAOException e) {
        log.error("Error initializing DAO", e);
    }
    return accumuloRyaDao;
}
Also used : AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) RyaDAOException(org.apache.rya.api.persist.RyaDAOException)

Example 2 with AccumuloRyaDAO

use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.

the class GraphXInputFormatTest method init.

@Before
public void init() throws Exception {
    instance = new MockInstance(GraphXInputFormatTest.class.getName() + ".mock_instance");
    Connector connector = instance.getConnector(username, password);
    connector.tableOperations().create(table);
    AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("rya_");
    conf.setDisplayQueryPlan(false);
    conf.setBoolean("sc.use_entity", true);
    apiImpl = new AccumuloRyaDAO();
    apiImpl.setConf(conf);
    apiImpl.setConnector(connector);
    apiImpl.init();
}
Also used : Connector(org.apache.accumulo.core.client.Connector) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) Before(org.junit.Before)

Example 3 with AccumuloRyaDAO

use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.

the class RyaInputFormatTest method init.

@BeforeClass
public static void init() throws Exception {
    instance = new MockInstance(RyaInputFormatTest.class.getName() + ".mock_instance");
    Connector connector = instance.getConnector(username, password);
    connector.tableOperations().create(table);
    AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
    conf.setTablePrefix("rya_");
    conf.setDisplayQueryPlan(false);
    apiImpl = new AccumuloRyaDAO();
    apiImpl.setConf(conf);
    apiImpl.setConnector(connector);
}
Also used : Connector(org.apache.accumulo.core.client.Connector) AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) BeforeClass(org.junit.BeforeClass)

Example 4 with AccumuloRyaDAO

use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.

the class Upgrade322ToolTest method testUpgrade.

public void testUpgrade() throws Exception {
    Upgrade322Tool.main(new String[] { "-Dac.mock=true", "-Dac.instance=" + instance, "-Dac.username=" + user, "-Dac.pwd=" + pwd, "-Drdf.tablePrefix=" + tablePrefix });
    final AccumuloRdfConfiguration configuration = new AccumuloRdfConfiguration();
    configuration.setTablePrefix(tablePrefix);
    final AccumuloRyaDAO ryaDAO = new AccumuloRyaDAO();
    ryaDAO.setConnector(connector);
    ryaDAO.setConf(configuration);
    ryaDAO.init();
    final AccumuloRyaQueryEngine queryEngine = ryaDAO.getQueryEngine();
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#booleanLit"), new RyaType(XMLSchema.BOOLEAN, "true")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#longLit"), new RyaType(XMLSchema.LONG, "10")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#intLit"), new RyaType(XMLSchema.INTEGER, "10")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#byteLit"), new RyaType(XMLSchema.BYTE, "10")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#doubleLit"), new RyaType(XMLSchema.DOUBLE, "10.0")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#dateLit"), new RyaType(XMLSchema.DATETIME, "2011-07-12T06:00:00.000Z")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#stringLit"), new RyaType("stringLit")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("http://here/2010/tracked-data-provenance/ns#uuid10"), new RyaURI("http://here/2010/tracked-data-provenance/ns#uriLit"), new RyaURI("http://here/2010/tracked-data-provenance/ns" + "#objectuuid1")), queryEngine);
    TestUtils.verify(new RyaStatement(new RyaURI("urn:org.apache.rya/2012/05#rts"), new RyaURI("urn:org.apache.rya/2012/05#version"), new RyaType("3.0.0")), queryEngine);
}
Also used : AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) RyaURI(org.apache.rya.api.domain.RyaURI) AccumuloRyaQueryEngine(org.apache.rya.accumulo.query.AccumuloRyaQueryEngine) RyaStatement(org.apache.rya.api.domain.RyaStatement) RyaType(org.apache.rya.api.domain.RyaType) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 5 with AccumuloRyaDAO

use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.

the class RyaOutputFormat method getRyaIndexer.

private static AccumuloRyaDAO getRyaIndexer(final Configuration conf) throws IOException {
    try {
        if (!conf.getBoolean(ENABLE_CORE, true)) {
            return null;
        }
        final AccumuloRyaDAO ryaIndexer = new AccumuloRyaDAO();
        final Connector conn = ConfigUtils.getConnector(conf);
        ryaIndexer.setConnector(conn);
        final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
        final String tablePrefix = conf.get(OUTPUT_PREFIX_PROPERTY, null);
        if (tablePrefix != null) {
            ryaConf.setTablePrefix(tablePrefix);
        }
        ryaConf.setDisplayQueryPlan(false);
        ryaIndexer.setConf(ryaConf);
        ryaIndexer.init();
        return ryaIndexer;
    } catch (final AccumuloException e) {
        logger.error("Cannot create RyaIndexer", e);
        throw new IOException(e);
    } catch (final AccumuloSecurityException e) {
        logger.error("Cannot create RyaIndexer", e);
        throw new IOException(e);
    } catch (final RyaDAOException e) {
        logger.error("Cannot create RyaIndexer", e);
        throw new IOException(e);
    }
}
Also used : AccumuloRyaDAO(org.apache.rya.accumulo.AccumuloRyaDAO) Connector(org.apache.accumulo.core.client.Connector) AccumuloException(org.apache.accumulo.core.client.AccumuloException) RyaDAOException(org.apache.rya.api.persist.RyaDAOException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) IOException(java.io.IOException) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Aggregations

AccumuloRyaDAO (org.apache.rya.accumulo.AccumuloRyaDAO)45 AccumuloRdfConfiguration (org.apache.rya.accumulo.AccumuloRdfConfiguration)26 MockInstance (org.apache.accumulo.core.client.mock.MockInstance)21 Connector (org.apache.accumulo.core.client.Connector)18 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)10 RyaStatement (org.apache.rya.api.domain.RyaStatement)10 RdfCloudTripleStore (org.apache.rya.rdftriplestore.RdfCloudTripleStore)10 Before (org.junit.Before)9 RyaURI (org.apache.rya.api.domain.RyaURI)7 Test (org.junit.Test)7 Instance (org.apache.accumulo.core.client.Instance)6 RyaDAOException (org.apache.rya.api.persist.RyaDAOException)6 RyaSailRepository (org.apache.rya.rdftriplestore.RyaSailRepository)5 ZooKeeperInstance (org.apache.accumulo.core.client.ZooKeeperInstance)4 SecurityOperations (org.apache.accumulo.core.client.admin.SecurityOperations)4 Configuration (org.apache.hadoop.conf.Configuration)4 RyaType (org.apache.rya.api.domain.RyaType)4 ArrayList (java.util.ArrayList)3 Path (org.apache.hadoop.fs.Path)3 SailRepository (org.openrdf.repository.sail.SailRepository)3