WhereHandler implements Handler { public <K extends Collection<?>> void addValueVars(PrefixMapping prefixMapping, Map<?,K> dataTable) { ValuesHandler hdlr = new ValuesHandler(); for (Map.Entry<?, K> entry : dataTable.entrySet()) { Collection<Node> values = null; if (entry.getValue() != null) { values = Converters.makeValueNodes( entry.getValue().iterator(), prefixMapping ); } hdlr.addValueVar(Converters.makeVar(entry.getKey()), values ); } valuesHandler.addAll( hdlr ); } WhereHandler(Query query);  WhereHandler(); Element getQueryPattern(); Query getQuery(); void addAll(WhereHandler whereHandler); Element getElement(); ElementGroup getClause(); void addWhere(TriplePath t); void addWhere(ValuesHandler values); void addOptional(TriplePath t); void addOptional(WhereHandler whereHandler); void addFilter(String expression); void addFilter(Expr expr); void addSubQuery(AbstractQueryBuilder<?> subQuery); ElementSubQuery makeSubQuery(AbstractQueryBuilder<?> subQuery); void addUnion(AbstractQueryBuilder<?> subQuery); void addGraph(Node graph, WhereHandler subQuery); void addGraph(Node graph, TriplePath subQuery); void addBind(Expr expr, Var var); void addBind(String expression, Var var); @Override void setVars(Map<Var, Node> values); @Override void build(); Node list(Object... objs); void addMinus( AbstractQueryBuilder<?> qb ); void addValueVar(PrefixMapping prefixMapping, Object var); void addValueVar(PrefixMapping prefixMapping, Object var, Object... objects); void addValueVars(PrefixMapping prefixMapping, Map<?,K> dataTable); void addValueRow(PrefixMapping prefixMapping, Object... values); void addValueRow(PrefixMapping prefixMapping, Collection<?> values); List<Var> getValuesVars(); Map<Var,List<Node>> getValuesMap(); void clearValues();  }
@Test public void testAddValueVars() { final Var v = Var.alloc("v"); Map<Object,List<?>> map = new LinkedHashMap<Object,List<?>>(); map.put( Var.alloc("v"), Arrays.asList( "<one>", "<two>")); map.put( "?x", Arrays.asList( "three", "four")); handler.addValueVars( query.getPrefixMapping(), map ); handler.build(); Var x = Var.alloc("x"); ElementData edat = new ElementData(); edat.add( v ); edat.add( x ); BindingHashMap binding = new BindingHashMap(); binding.add( v, NodeFactory.createURI( "one" )); binding.add( x, NodeFactory.createLiteral("three")); edat.add( binding ); binding = new BindingHashMap(); binding.add( v, NodeFactory.createURI( "two" )); binding.add( x, NodeFactory.createLiteral("four")); edat.add( binding ); WhereValidator visitor = new WhereValidator( edat ); query.getQueryPattern().visit( visitor ); assertTrue( visitor.matching ); }