use of org.apache.rya.indexing.accumulo.entity.EntityCentricIndex in project incubator-rya by apache.
the class RyaOutputFormatTest method testEntityIndexing.
@Test
public void testEntityIndexing() throws Exception {
final EntityCentricIndex entity = new EntityCentricIndex();
entity.setConf(conf);
final RyaStatement input = RyaStatement.builder().setSubject(new RyaURI(GRAPH + ":s")).setPredicate(new RyaURI(GRAPH + ":p")).setObject(new RyaURI(GRAPH + ":o")).build();
RyaOutputFormat.setCoreTablesEnabled(job, false);
RyaOutputFormat.setFreeTextEnabled(job, false);
RyaOutputFormat.setTemporalEnabled(job, false);
RyaOutputFormat.setEntityEnabled(job, true);
write(input);
entity.close();
final Set<Statement> expected = new HashSet<>();
final Set<Statement> inserted = new HashSet<>();
expected.add(RyaToRdfConversions.convertStatement(input));
final String table = EntityCentricIndex.getTableName(conf);
final Scanner scanner = connector.createScanner(table, new Authorizations(CV));
for (final Map.Entry<Key, Value> row : scanner) {
System.out.println(row);
inserted.add(RyaToRdfConversions.convertStatement(EntityCentricIndex.deserializeStatement(row.getKey(), row.getValue())));
}
Assert.assertEquals(expected, inserted);
}
use of org.apache.rya.indexing.accumulo.entity.EntityCentricIndex in project incubator-rya by apache.
the class RyaOutputFormat method getEntityIndexer.
private static EntityCentricIndex getEntityIndexer(final Configuration conf) {
if (!conf.getBoolean(ENABLE_ENTITY, true)) {
return null;
}
final EntityCentricIndex entity = new EntityCentricIndex();
entity.setConf(conf);
return entity;
}
Aggregations