use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class EntityTupleSet method getRyaSailConnection.
private RdfCloudTripleStoreConnection getRyaSailConnection() throws AccumuloException, AccumuloSecurityException, SailException {
RdfCloudTripleStore store = new RdfCloudTripleStore();
AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
crdfdao.setConnector(accCon);
AccumuloRdfConfiguration acc = new AccumuloRdfConfiguration(conf);
crdfdao.setConf(acc);
store.setRyaDAO(crdfdao);
store.initialize();
return (RdfCloudTripleStoreConnection) store.getConnection();
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class StatementStoreFactory method getBaseAccumuloStore.
private AccumuloRyaStatementStore getBaseAccumuloStore(final String ryaInstanceName, final InstanceType type, final boolean isParent, final String username, final String password, final String tablePrefix, final String auths, final String zookeepers) throws Exception {
final AccumuloInstanceDriver aInstance = new AccumuloInstanceDriver(ryaInstanceName + "_driver", type, true, false, isParent, username, password, ryaInstanceName, tablePrefix, auths, zookeepers);
aInstance.setUp();
final AccumuloRyaDAO dao = aInstance.getDao();
return new AccumuloRyaStatementStore(dao, tablePrefix, ryaInstanceName);
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class AccumuloStatementMetadataOptimizerIT method init.
@Before
public void init() throws Exception {
conf = getConf();
sail = RyaSailFactory.getInstance(conf);
repo = new SailRepository(sail);
conn = repo.getConnection();
Connector conn = ConfigUtils.getConnector(conf);
dao = new AccumuloRyaDAO();
dao.setConnector(conn);
dao.init();
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class RyaAccumuloSailFactory method getSail.
@Override
public Sail getSail(final SailImplConfig config) throws SailConfigException {
try {
final RdfCloudTripleStore store = new RdfCloudTripleStore();
final RyaAccumuloSailConfig cbconfig = (RyaAccumuloSailConfig) config;
final String instanceName = cbconfig.getInstance();
final String zooKeepers = cbconfig.getZookeepers();
Instance i;
if (cbconfig.isMock()) {
i = new MockInstance(instanceName);
} else {
i = new ZooKeeperInstance(instanceName, zooKeepers);
}
final String user = cbconfig.getUser();
final String pass = cbconfig.getPassword();
final Connector connector = i.getConnector(user, new PasswordToken(pass));
final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
crdfdao.setConnector(connector);
final AccumuloRdfConfiguration conf = cbconfig.toRdfConfiguation();
ConfigUtils.setIndexers(conf);
conf.setDisplayQueryPlan(true);
crdfdao.setConf(conf);
crdfdao.init();
store.setRyaDAO(crdfdao);
return store;
} catch (RyaDAOException | AccumuloException | AccumuloSecurityException e) {
throw new SailConfigException(e);
}
}
use of org.apache.rya.accumulo.AccumuloRyaDAO in project incubator-rya by apache.
the class RulesetCopyIT method testRulesetCopyTool.
@Test
public void testRulesetCopyTool() throws Exception {
// Should be copied and are involved in the solution:
final RyaStatement[] solutionStatements = { statement("test:FullProfessor1", "rdf:type", "test:FullProfessor"), statement("test:GraduateStudent1", "test:advisor", "test:FullProfessor1"), statement("test:FullProfessor1", "test:telephone", literal("123-456-7890")), statement("test:University1", "test:telephone", literal("555")), statement("test:FullProfessor1", "test:worksFor", "test:University1"), statement("test:FullProfessor1", "test:hired", literal("2001-01-01T04:01:02.000Z", XMLSchema.DATETIME)), statement("test:University1", "geo:asWKT", literal("Point(-77.03524 38.889468)", new URIImpl("http://www.opengis.net/ont/geosparql#wktLiteral"))) };
// These aren't solutions but should be copied:
final RyaStatement[] copyStatements = { statement("test:FullProfessor2", "rdf:type", "test:FullProfessor"), statement("test:GraduateStudent1", "test:advisor", "test:AssistantProfessor1"), statement("test:GraduateStudent1", "test:telephone", literal("555-123-4567")), statement("test:FullProfessor1", "test:telephone", literal("567-8901")), statement("test:University1", "test:telephone", literal("800-123-4567")) };
// Should not be copied:
final RyaStatement[] irrelevantStatements = { statement("test:GraduateStudent2", "test:advisor", "test:FullProfessor1"), statement("test:UndergraduateStudent1", "rdf:type", "test:UndergraduateStudent"), statement("test:UndergraduateStudent2", "rdf:type", "test:UndergraduateStudent"), statement("test:GraduateStudent1", "rdf:type", "test:GraduateStudent"), statement("test:GraduateStudent1", "test:name", literal("GraduateStudent1")), statement("test:UndergraduateStudent2", "test:name", literal("UndergraduateStudent2")), statement("test:Course1", "test:name", literal("Course1")), statement("test:GraduateStudent1", "test:emailAddress", literal("GraduateStudent1@Department0.University0.edu")), statement("test:GraduateStudent1", "test:teachingAssistantOf", "test:Course1"), statement("test:GraduateStudent2", "test:undergraduateDegreeFrom", "test:University1"), statement("test:AssistantProfessor1", "test:teacherOf", "test:Course1"), statement("test:FullProfessor1", "test:telephone", literal("xxx-xxx-xxxx")), statement("test:University1", "test:telephone", literal("0000")), // If inferencing is disabled, these shouldn't matter:
statement("test:employs", "owl:inverseOf", "test:worksFor"), statement("test:University1", "test:employs", "test:FullProfessor2") };
final String query = QUERY_PREFIXES + "SELECT * {\n" + " test:GraduateStudent1 test:advisor ?person .\n" + " ?person rdf:type test:FullProfessor .\n" + " ?person test:telephone ?number .\n" + " ?person test:worksFor ?university .\n" + " FILTER regex(?number, \"...-...-....\")\n" + " ?university geo:asWKT ?place .\n" + " FILTER regex(?number, \"^[0-9]\")\n" + " ?university test:telephone ?universityNumber\n" + " FILTER regex(?universityNumber, \"^5\")\n" + // Would be good to test index functions, but indexing is unreliable (see RYA-72):
" ?person test:hired ?time .\n" + // + " FILTER(tempo:after(?time, '2000-01-01T01:01:03-08:00'))\n"
"}";
final int parentNamespaceCount = 2;
int childNamespaceCount = 0;
parentDao.addNamespace("ns1", "http://www.example.com/ns1#");
parentDao.addNamespace("ns2", "http://www.example.com/ns2#");
// Run the test
final AccumuloRyaDAO childDao = runRulesetCopyTest(solutionStatements, copyStatements, irrelevantStatements, query, 1, false);
// Verify namespaces were copied
final CloseableIteration<Namespace, RyaDAOException> nsIter = childDao.iterateNamespace();
while (nsIter.hasNext()) {
childNamespaceCount++;
nsIter.next();
}
Assert.assertEquals("Incorrect number of namespaces copied to child:", parentNamespaceCount, childNamespaceCount);
log.info("DONE");
}
Aggregations