use of org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder in project incubator-rya by apache.
the class AccumuloPcjSerializerTest method serialize_bindingsSubsetOfVarOrder.
/**
* The BindingSet has fewer Bindings than there are variables in the variable
* order, but they are all in the variable order. This is the case where
* the missing bindings were optional.
*/
@Test
public void serialize_bindingsSubsetOfVarOrder() throws BindingSetConversionException {
// Setup the Binding Set.
final MapBindingSet originalBindingSet = new MapBindingSet();
originalBindingSet.addBinding("x", new URIImpl("http://a"));
originalBindingSet.addBinding("y", new URIImpl("http://b"));
// Setup the variable order.
final VariableOrder varOrder = new VariableOrder("x", "a", "y", "b");
// Create the byte[] representation of the BindingSet.
BindingSetConverter<byte[]> converter = new AccumuloPcjSerializer();
byte[] serialized = converter.convert(originalBindingSet, varOrder);
// Deserialize the byte[] back into the binding set.
BindingSet deserialized = converter.convert(serialized, varOrder);
// Ensure the deserialized value matches the original.
assertEquals(originalBindingSet, deserialized);
}
use of org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder in project incubator-rya by apache.
the class AccumuloPcjSerializerTest method basicLongMixLiteralBsTest.
@Test
public void basicLongMixLiteralBsTest() throws BindingSetConversionException {
final QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("X", new LiteralImpl("literal1"));
bs.addBinding("Y", new LiteralImpl("5", new URIImpl("http://www.w3.org/2001/XMLSchema#integer")));
bs.addBinding("Z", new LiteralImpl("5.0", new URIImpl("http://www.w3.org/2001/XMLSchema#double")));
bs.addBinding("W", new LiteralImpl("1000", new URIImpl("http://www.w3.org/2001/XMLSchema#long")));
final VariableOrder varOrder = new VariableOrder("W", "X", "Y", "Z");
BindingSetConverter<byte[]> converter = new AccumuloPcjSerializer();
final byte[] byteVal = converter.convert(bs, varOrder);
final BindingSet newBs = converter.convert(byteVal, varOrder);
assertEquals(bs, newBs);
}
use of org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder in project incubator-rya by apache.
the class PcjTablesTest method shiftVarOrdersFactory.
@Test
public void shiftVarOrdersFactory() {
Set<VariableOrder> expected = Sets.newHashSet(new VariableOrder("a;b;c"), new VariableOrder("b;c;a"), new VariableOrder("c;a;b"));
Set<VariableOrder> varOrders = new ShiftVarOrderFactory().makeVarOrders(new VariableOrder("a;b;c"));
assertEquals(expected, varOrders);
}
use of org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder in project incubator-rya by apache.
the class PcjTablesTest method pcjMetadata_equals.
@Test
public void pcjMetadata_equals() {
PcjMetadata meta1 = new PcjMetadata("A SPARQL string.", 5, Sets.newHashSet(new VariableOrder("a", "b", "c"), new VariableOrder("d", "e", "f")));
PcjMetadata meta2 = new PcjMetadata("A SPARQL string.", 5, Sets.newHashSet(new VariableOrder("a", "b", "c"), new VariableOrder("d", "e", "f")));
assertEquals(meta1, meta2);
}
Aggregations