static protected void addBinding(BindingMap binding, Var var, Node value) { Node n = binding.get(var) ; if ( n != null ) { // Same - silently skip. if ( n.equals(value) ) return ; Log.warn(SPARQLResult.class, String.format("Multiple occurences of a binding for variable '%s' with different values - ignored", var.getName())) ; return ; } binding.add(var, value) ; }
private static boolean insert(Node inputNode, Node outputNode, BindingMap results) { if ( ! Var.isVar(inputNode) ) return true ; Var v = Var.alloc(inputNode) ; Node x = results.get(v) ; if ( x != null ) return outputNode.equals(x) ; results.add(v, outputNode) ; return true ; }
public Binding convert(Binding b) { if ( parentBinding == null || parentBinding.isEmpty() ) return b ; // This is the result. Could have BindingBase.setParent etc. BindingMap b2 = new BindingMap(parentBinding) ; // Copy the resultSet bindings to the combined result binding with checking. for ( Iterator<Var> iter = b.vars() ; iter.hasNext(); ) { Var v = iter.next(); Node n = b.get(v) ; if ( b2.contains(v) ) { Node n2 = b2.get(v) ; if ( n2.equals(n) ) Log.warn(this, "Binding already for "+v+" (same value)" ) ; else { Log.fatal(this, "Binding already for "+v+" (different values)" ) ; throw new ARQInternalErrorException("QueryIteratorResultSet: Incompatible bindings for "+v) ; } } b2.add(v, n) ; } return b2 ; } }
@Override public Binding convert(Binding b) { if ( parentBinding == null || parentBinding.isEmpty() ) return b ; // This is the result. Could have BindingBase.setParent etc. BindingMap b2 = BindingFactory.create(parentBinding) ; // Copy the resultSet bindings to the combined result binding with checking. for ( Iterator<Var> iter = b.vars() ; iter.hasNext(); ) { Var v = iter.next(); Node n = b.get(v) ; if ( b2.contains(v) ) { Node n2 = b2.get(v) ; if ( n2.equals(n) ) Log.warn(this, "Binding already for "+v+" (same value)" ) ; else { Log.fatal(this, "Binding already for "+v+" (different values)" ) ; throw new ARQInternalErrorException("Incompatible bindings for "+v) ; } } b2.add(v, n) ; } return b2 ; } }
throw new QueryExecException("Already set: "+v) ; Node n2 = b.get(v) ; if ( ! n2.sameValueAs(n) )