public static ElementFilter buildFilter(ElementGroup elg, List<Binding> bindings) {
		List<Var> vars = new ArrayList<Var>();
		vars.addAll(elg.varsMentioned());
		
		Expr expr = null;
		for(Binding b:bindings) {
			Expr and = null;
			for(Var v:vars) {
				if(b.contains(v)) {
					ExprVar eVar = new ExprVar(v);
					NodeValueNode eVal = new NodeValueNode(b.get(v));
					E_Equals eq = new E_Equals(eVar,eVal);
					if(and == null)//is this the first result filter? can use true as the initial value of and to avoid the if clause
						and = eq;
					else
						and = new E_LogicalAnd(and,eq);//do the logical and with previous result filter
				}
			}
			
			if(and != null) {
				if(expr == null) 
					expr = and;
				else
					expr = new E_LogicalOr(expr,and);
			}
				
		}
		
		if(expr != null)
			return new ElementFilter(expr);
			
		return null;
	}