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;
}
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();
}
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);
}
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);
}
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);
}
}
Aggregations