use of org.openrdf.query.algebra.IsLiteral in project incubator-rya by apache.
the class AggregationPipelineQueryNodeTest method testFilter.
@Test
public void testFilter() {
final AggregationPipelineQueryNode base = new AggregationPipelineQueryNode(collection, new LinkedList<>(), Sets.newHashSet("x", "y"), Sets.newHashSet("x", "y", "opt"), HashBiMap.create());
// Extend with a supported filter
AggregationPipelineQueryNode node = base.clone();
boolean success = node.filter(new Compare(new Var("x"), new Var("y"), Compare.CompareOp.EQ));
Assert.assertTrue(success);
Assert.assertEquals(Sets.newHashSet("x", "y", "opt"), node.getBindingNames());
Assert.assertEquals(Sets.newHashSet("x", "y"), node.getAssuredBindingNames());
Assert.assertEquals(3, node.getPipeline().size());
// Extend with an unsupported filter
node = base.clone();
success = node.filter(new IsLiteral(new Var("opt")));
Assert.assertFalse(success);
Assert.assertEquals(Sets.newHashSet("x", "y", "opt"), node.getBindingNames());
Assert.assertEquals(Sets.newHashSet("x", "y"), node.getAssuredBindingNames());
Assert.assertEquals(0, node.getPipeline().size());
}