public static Binding create(Binding parent) { return new BindingMap(parent) ; } }
protected void startBindingValueRow(int line, int col) { values.add(new BindingMap()) ; currentColumn = -1 ; }
public static Binding asBinding(QuerySolution qSolution) { if ( qSolution == null ) return null ; Binding binding = new BindingMap(null) ; addToBinding(binding, qSolution) ; return binding ; }
static private Binding copyProject(VarExprList vars, Binding binding, ExecutionContext execCxt) { // No group vars (implicit or explicit) => working on whole result set. // Still need a BindingMap to assign to later. Binding x = new BindingMap() ; for ( Iterator<Var> iter = vars.getVars().iterator() ; iter.hasNext() ; ) { Var var = iter.next() ; Node node = vars.get(var, binding, execCxt) ; // Null returned for unbound and error. if ( node != null ) x.add(var, node) ; } return x ; } }
private static Binding graphResultsToBinding(Binding parent, Domain d, Var[] projectionVars) { // Copy out Binding binding = new BindingMap(parent) ; for ( int i = 0 ; i < projectionVars.length ; i++ ) { Var var = projectionVars[i] ; Node n = d.get(i) ; if ( n == null ) // There was no variable of this name. continue ; binding.add(var, n) ; } return binding ; }
private Binding copyToBinding(QuerySolution qs) { BindingMap b = new BindingMap() ; for ( Iterator<String> iter = qs.varNames() ; iter.hasNext() ; ) { String varName = iter.next() ; RDFNode rn = qs.get(varName) ; b.add(Var.alloc(varName), rn.asNode()) ; } return b ; }
private static QueryIterator findIndexMember(Graph graph, Binding binding, Node listNode, Var varIndex, Var varMember, ExecutionContext execCxt) { // Iterate over list List<Node> members = GraphList.members(new GNode(graph, listNode)) ; List<Binding> bindings = new ArrayList<Binding>() ; for ( int i = 0 ; i < members.size() ; i++ ) { Node idx = NodeFactory.intToNode(i) ; Node member = members.get(i) ; Binding b = new BindingMap(binding) ; b.add(varIndex, idx) ; b.add(varMember, member) ; bindings.add(b) ; } return new QueryIterPlainWrapper(bindings.iterator(), execCxt) ; } }
public static Binding merge(Binding bindingLeft, Binding bindingRight) { // Test to see if compatible: Iterate over variables in left boolean matches = compatible(bindingLeft, bindingRight) ; if ( ! matches ) return null ; // If compatible, merge. Iterate over variables in right but not in left. Binding b = new BindingMap(bindingLeft) ; for ( Iterator<Var> vIter = bindingRight.vars() ; vIter.hasNext() ; ) { Var v = vIter.next(); Node n = bindingRight.get(v) ; if ( ! bindingLeft.contains(v) ) b.add(v, n) ; } return b ; }
public Binding map1(HitLARQ hit) { Binding b = new BindingMap(binding) ; b.add(match, hit.getNode()) ; if ( score != null ) b.add(score, NodeFactory.floatToNode(hit.getScore())) ; return b ; }
? new BindingMap() : new BindingMap( parent );
private Binding mapper(Triple r) { Binding results = new BindingMap(binding) ; if ( ! insert(s, r.getSubject(), results) ) return null ; if ( ! insert(p, r.getPredicate(), results) ) return null ; if ( ! insert(o, r.getObject(), results) ) return null ; return results ; }
public Plan getPlan() { if ( plan == null ) { DatasetGraph dsg = prepareDataset(dataset, query, fileManager) ; Binding inputBinding = null ; if ( initialBinding != null ) { inputBinding = new BindingMap() ; BindingUtils.addToBinding(inputBinding, initialBinding) ; } if ( inputBinding == null ) inputBinding = BindingRoot.create() ; plan = qeFactory.create(query, dsg, inputBinding, getContext()) ; } return plan ; }
public Binding map1(HitLARQ hit) { Binding b = new BindingMap(binding) ; b.add(Var.alloc(subject), hit.getNode()) ; if ( score != null ) b.add(Var.alloc(score), NodeFactory.floatToNode(hit.getScore())) ; return b ; }
@Override public QueryIterator execEvaluated(Binding binding, PropFuncArg subject, Node predicate, PropFuncArg object, ExecutionContext execCxt) { List<Binding> results = new ArrayList<Binding>() ; Node subj = subject.getArg() ; Node obj = object.getArg() ; Iterator<SystemInfo> iter = SystemARQ.registeredSubsystems() ; for ( ; iter.hasNext() ; ) { SystemInfo info = iter.next(); if ( ! isSameOrVar(subj, info.getIRI()) ) continue ; Node version = Node.createLiteral(info.getVersion()) ; if ( ! isSameOrVar(obj, version) ) continue ; Binding b = new BindingMap(binding) ; if ( subj.isVariable() ) b.add(Var.alloc(subj), info.getIRI()) ; if ( subj.isVariable() ) b.add(Var.alloc(obj), version) ; results.add(b) ; } return new QueryIterPlainWrapper(results.iterator(), execCxt) ; }
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 accept(Binding binding) { Binding b = new BindingMap(binding) ; for ( Var v : exprs.getVars() ) { // Not this, where expressions do not see the new bindings. // Node n = exprs.get(v, bind, funcEnv) ; // which gives (Lisp) "let" semantics, not "let*" semantics Node n = exprs.get(v, b, getExecContext()) ; if ( n == null ) // Expression failed to evaluate - no assignment continue ; // Check is already has a value; if so, must be sameValueAs if ( b.contains(v) ) { Node n2 = b.get(v) ; if ( ! n2.sameValueAs(n) ) //throw new QueryExecException("Already set: "+v) ; // Error in single assignment. return null ; continue ; } b.add(v, n) ; } return b ; } }
private QueryIterator nodesReifTriple(Node node, TripleMatch triple) { Binding b = BindingRoot.create() ; if ( node == Node.ANY ) node = null ; if ( node != null || triple != null ) { b = new BindingMap(b) ; if ( node != null ) bind(b, reifNodeVar, node) ; if ( triple != null ) { bind(b, varS, triple.getMatchSubject()) ; bind(b, varP, triple.getMatchPredicate()) ; bind(b, varO, triple.getMatchObject()) ; } } Plan plan = factory.create(op, ds, b, null) ; QueryIterator qIter = plan.iterator() ; return qIter ; }
@Override public QueryIterator execEvaluated(Binding binding, PropFuncArg subject, Node predicate, PropFuncArg object, ExecutionContext execCxt) { Binding b = new BindingMap(binding) ; Node subj = subject.getArg() ; if ( ! isSameOrVar(subj, arq) ) IterLib.noResults(execCxt) ; if ( subj.isVariable() ) b.add(Var.alloc(subj), arq) ; Node obj = object.getArg() ; if ( ! isSameOrVar(obj, version) ) IterLib.noResults(execCxt) ; if ( obj.isVariable() ) b.add(Var.alloc(obj), version) ; return IterLib.result(b, execCxt) ; }
private Binding buildBinding(Resource soln) Binding rb = new BindingMap() ;
BuilderLib.broken(list, "Does not start ("+Tags.tagRow+" ...) or ("+Tags.tagBinding+" ...)", head) ; Binding binding = new BindingMap() ; for ( int i = 1 ; i < list.size() ; i++ )