@Test public void serialize_bindingNotInVariableOrder() throws RyaTypeResolverException, BindingSetConversionException { final MapBindingSet originalBindingSet = new MapBindingSet(); originalBindingSet.addBinding("x", VF.createIRI("http: originalBindingSet.addBinding("y", VF.createIRI("http: originalBindingSet.addBinding("z", VF.createIRI("http: final VariableOrder varOrder = new VariableOrder("x", "y"); BindingSetConverter<byte[]> converter = new AccumuloPcjSerializer(); byte[] serialized = converter.convert(originalBindingSet, varOrder); BindingSet deserialized = converter.convert(serialized, varOrder); MapBindingSet expected = new MapBindingSet(); expected.addBinding("x", VF.createIRI("http: expected.addBinding("y", VF.createIRI("http: assertEquals(expected, deserialized); }
@Override public byte[] convert(BindingSet bindingSet, VariableOrder varOrder) throws BindingSetConversionException { checkNotNull(bindingSet); checkNotNull(varOrder); final List<byte[]> byteSegments = new LinkedList<>(); try { for(final String varName: varOrder) { if(bindingSet.hasBinding(varName)) { final RyaType rt = RdfToRyaConversions.convertValue(bindingSet.getBinding(varName).getValue()); final byte[][] serializedVal = RyaContext.getInstance().serializeType(rt); byteSegments.add(serializedVal[0]); byteSegments.add(serializedVal[1]); } byteSegments.add(DELIM_BYTES); } return concat(byteSegments); } catch (RyaTypeResolverException e) { throw new BindingSetConversionException("Could not convert the BindingSet into a byte[].", e); } }
AccumuloPcjSerializer implements BindingSetConverter<byte[]> { @Override public byte[] convert(BindingSet bindingSet, VariableOrder varOrder) throws BindingSetConversionException { checkNotNull(bindingSet); checkNotNull(varOrder); final List<byte[]> byteSegments = new LinkedList<>(); try { for(final String varName: varOrder) { if(bindingSet.hasBinding(varName)) { final RyaType rt = RdfToRyaConversions.convertValue(bindingSet.getBinding(varName).getValue()); final byte[][] serializedVal = RyaContext.getInstance().serializeType(rt); byteSegments.add(serializedVal[0]); byteSegments.add(serializedVal[1]); } byteSegments.add(DELIM_BYTES); } return concat(byteSegments); } catch (RyaTypeResolverException e) { throw new BindingSetConversionException("Could not convert the BindingSet into a byte[].", e); } } }
AccumuloPcjSerializer implements BindingSetConverter<byte[]> { @Override public byte[] convert(BindingSet bindingSet, VariableOrder varOrder) throws BindingSetConversionException { checkNotNull(bindingSet); checkNotNull(varOrder); final List<byte[]> byteSegments = new LinkedList<>(); try { for(final String varName: varOrder) { if(bindingSet.hasBinding(varName)) { final RyaType rt = RdfToRyaConversions.convertValue(bindingSet.getBinding(varName).getValue()); final byte[][] serializedVal = RyaContext.getInstance().serializeType(rt); byteSegments.add(serializedVal[0]); byteSegments.add(serializedVal[1]); } byteSegments.add(DELIM_BYTES); } return concat(byteSegments); } catch (RyaTypeResolverException e) { throw new BindingSetConversionException("Could not convert the BindingSet into a byte[].", e); } }  }
AccumuloPcjSerializer implements BindingSetConverter<byte[]> { @Override public byte[] convert(BindingSet bindingSet, VariableOrder varOrder) throws BindingSetConversionException { checkNotNull(bindingSet); checkNotNull(varOrder); final List<byte[]> byteSegments = new LinkedList<>(); try { for(final String varName: varOrder) { if(bindingSet.hasBinding(varName)) { final RyaType rt = RdfToRyaConversions.convertValue(bindingSet.getBinding(varName).getValue()); final byte[][] serializedVal = RyaContext.getInstance().serializeType(rt); byteSegments.add(serializedVal[0]); byteSegments.add(serializedVal[1]); } byteSegments.add(DELIM_BYTES); } return concat(byteSegments); } catch (RyaTypeResolverException e) { throw new BindingSetConversionException("Could not convert the BindingSet into a byte[].", e); } }  @Override byte[] convert(BindingSet bindingSet, VariableOrder varOrder); @Override BindingSet convert(byte[] bindingSetBytes, VariableOrder varOrder); }
AccumuloPcjSerializer implements BindingSetConverter<byte[]> { @Override public byte[] convert(BindingSet bindingSet, VariableOrder varOrder) throws BindingSetConversionException { checkNotNull(bindingSet); checkNotNull(varOrder); final List<byte[]> byteSegments = new LinkedList<>(); try { for(final String varName: varOrder) { if(bindingSet.hasBinding(varName)) { final RyaType rt = RdfToRyaConversions.convertValue(bindingSet.getBinding(varName).getValue()); final byte[][] serializedVal = RyaContext.getInstance().serializeType(rt); byteSegments.add(serializedVal[0]); byteSegments.add(serializedVal[1]); } byteSegments.add(DELIM_BYTES); } return concat(byteSegments); } catch (RyaTypeResolverException e) { throw new BindingSetConversionException("Could not convert the BindingSet into a byte[].", e); } }  @Override byte[] convert(BindingSet bindingSet, VariableOrder varOrder); @Override BindingSet convert(byte[] bindingSetBytes, VariableOrder varOrder);  }