Search in sources :

Example 1 with EntityCentricIndex

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);
}
Also used : Scanner(org.apache.accumulo.core.client.Scanner) Authorizations(org.apache.accumulo.core.security.Authorizations) Statement(org.openrdf.model.Statement) RyaStatement(org.apache.rya.api.domain.RyaStatement) EntityCentricIndex(org.apache.rya.indexing.accumulo.entity.EntityCentricIndex) RyaStatement(org.apache.rya.api.domain.RyaStatement) RyaURI(org.apache.rya.api.domain.RyaURI) Value(org.apache.accumulo.core.data.Value) Map(java.util.Map) Key(org.apache.accumulo.core.data.Key) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with EntityCentricIndex

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;
}
Also used : EntityCentricIndex(org.apache.rya.indexing.accumulo.entity.EntityCentricIndex)

Aggregations

EntityCentricIndex (org.apache.rya.indexing.accumulo.entity.EntityCentricIndex)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Scanner (org.apache.accumulo.core.client.Scanner)1 Key (org.apache.accumulo.core.data.Key)1 Value (org.apache.accumulo.core.data.Value)1 Authorizations (org.apache.accumulo.core.security.Authorizations)1 RyaStatement (org.apache.rya.api.domain.RyaStatement)1 RyaURI (org.apache.rya.api.domain.RyaURI)1 Test (org.junit.Test)1 Statement (org.openrdf.model.Statement)1