Search in sources :

Example 21 with TripleRowResolverException

use of org.apache.rya.api.resolver.triple.TripleRowResolverException in project incubator-rya by apache.

the class KeyValueToRyaStatementFunction method apply.

@Override
public RyaStatement apply(Map.Entry<Key, Value> input) {
    Key key = input.getKey();
    Value value = input.getValue();
    RyaStatement statement = null;
    try {
        statement = context.deserializeTriple(tableLayout, new TripleRow(key.getRowData().toArray(), key.getColumnFamilyData().toArray(), key.getColumnQualifierData().toArray(), key.getTimestamp(), key.getColumnVisibilityData().toArray(), (value != null) ? value.get() : null));
    } catch (TripleRowResolverException e) {
        throw new RuntimeException(e);
    }
    return statement;
}
Also used : TripleRowResolverException(org.apache.rya.api.resolver.triple.TripleRowResolverException) TripleRow(org.apache.rya.api.resolver.triple.TripleRow) Value(org.apache.accumulo.core.data.Value) RyaStatement(org.apache.rya.api.domain.RyaStatement) Key(org.apache.accumulo.core.data.Key)

Example 22 with TripleRowResolverException

use of org.apache.rya.api.resolver.triple.TripleRowResolverException in project incubator-rya by apache.

the class MRReasoningUtils method getStatement.

/**
 * Convert an Accumulo row to a RyaStatement.
 */
static RyaStatement getStatement(Key row, Value data, Configuration conf) {
    try {
        RyaTripleContext ryaContext = RyaTripleContext.getInstance(new AccumuloRdfConfiguration(conf));
        RyaStatement ryaStatement = ryaContext.deserializeTriple(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO, new TripleRow(row.getRow().getBytes(), row.getColumnFamily().getBytes(), row.getColumnQualifier().getBytes(), row.getTimestamp(), row.getColumnVisibility().getBytes(), data.get()));
        return ryaStatement;
    } catch (TripleRowResolverException e) {
        e.printStackTrace();
        System.err.println("row: " + row);
        return null;
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        System.err.println("row: " + row);
        throw e;
    }
}
Also used : TripleRowResolverException(org.apache.rya.api.resolver.triple.TripleRowResolverException) RyaTripleContext(org.apache.rya.api.resolver.RyaTripleContext) TripleRow(org.apache.rya.api.resolver.triple.TripleRow) RyaStatement(org.apache.rya.api.domain.RyaStatement) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Aggregations

TripleRowResolverException (org.apache.rya.api.resolver.triple.TripleRowResolverException)22 RyaStatement (org.apache.rya.api.domain.RyaStatement)14 TripleRow (org.apache.rya.api.resolver.triple.TripleRow)13 IOException (java.io.IOException)8 Key (org.apache.accumulo.core.data.Key)7 Value (org.apache.accumulo.core.data.Value)7 HashMap (java.util.HashMap)4 TABLE_LAYOUT (org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT)4 RyaURI (org.apache.rya.api.domain.RyaURI)4 RyaTypeResolverException (org.apache.rya.api.resolver.RyaTypeResolverException)4 RyaDAOException (org.apache.rya.api.persist.RyaDAOException)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Map (java.util.Map)2 Mutation (org.apache.accumulo.core.data.Mutation)2 Transaction (org.apache.fluo.api.client.Transaction)2 RdfCloudTripleStoreConstants (org.apache.rya.api.RdfCloudTripleStoreConstants)2 RyaType (org.apache.rya.api.domain.RyaType)2 RyaTripleContext (org.apache.rya.api.resolver.RyaTripleContext)2 MessageDigest (java.security.MessageDigest)1