Search in sources :

Example 16 with RyaTypeResolverException

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

the class AccumuloPcjSerializer method convert.

@Override
public BindingSet convert(byte[] bindingSetBytes, VariableOrder varOrder) throws BindingSetConversionException {
    checkNotNull(bindingSetBytes);
    checkNotNull(varOrder);
    try {
        // Slice the row into bindings.
        List<byte[]> values = splitlByDelimByte(bindingSetBytes);
        String[] varOrderStrings = varOrder.toArray();
        checkArgument(values.size() == varOrderStrings.length);
        // Convert the Binding bytes into a BindingSet.
        final QueryBindingSet bindingSet = new QueryBindingSet();
        for (int i = 0; i < varOrderStrings.length; i++) {
            byte[] valueBytes = values.get(i);
            if (valueBytes.length > 0) {
                String name = varOrderStrings[i];
                Value value = deserializeValue(valueBytes);
                bindingSet.addBinding(name, value);
            }
        }
        return bindingSet;
    } catch (RyaTypeResolverException e) {
        throw new BindingSetConversionException("Could not convert the byte[] into a BindingSet.", e);
    }
}
Also used : Value(org.openrdf.model.Value) RyaTypeResolverException(org.apache.rya.api.resolver.RyaTypeResolverException) QueryBindingSet(org.openrdf.query.algebra.evaluation.QueryBindingSet)

Aggregations

RyaTypeResolverException (org.apache.rya.api.resolver.RyaTypeResolverException)16 IOException (java.io.IOException)5 TABLE_LAYOUT (org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT)5 RyaRange (org.apache.rya.api.domain.RyaRange)5 RyaType (org.apache.rya.api.domain.RyaType)5 RyaURI (org.apache.rya.api.domain.RyaURI)5 ByteRange (org.apache.rya.api.query.strategy.ByteRange)5 RyaContext (org.apache.rya.api.resolver.RyaContext)5 TripleRowResolverException (org.apache.rya.api.resolver.triple.TripleRowResolverException)4 MessageDigest (java.security.MessageDigest)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 HashMap (java.util.HashMap)2 RdfCloudTripleStoreConstants (org.apache.rya.api.RdfCloudTripleStoreConstants)2 RyaStatement (org.apache.rya.api.domain.RyaStatement)2 TripleRow (org.apache.rya.api.resolver.triple.TripleRow)2 Value (org.openrdf.model.Value)2 QueryBindingSet (org.openrdf.query.algebra.evaluation.QueryBindingSet)2 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 Value (org.apache.accumulo.core.data.Value)1