@Override public QueryIterator matchRightLeft(Binding bindingLeft, boolean includeOnNoMatch, ExprList conditions, ExecutionContext execContext) { List<Binding> out = new ArrayList<Binding>() ; for (Iterator<Binding> iter = rows.iterator(); iter.hasNext();) { Binding bindingRight = iter.next() ; Binding r = Algebra.merge(bindingLeft, bindingRight) ; if ( r == null ) continue ; // This does the conditional part. Theta-join. if ( conditions == null || conditions.isSatisfied(r, execContext) ) out.add(r) ; } if ( out.size() == 0 && includeOnNoMatch ) out.add(bindingLeft) ; if ( out.size() == 0 ) return QueryIterNullIterator.create(execContext) ; return new QueryIterPlainWrapper(out.iterator(), execContext) ; }
public QueryIterator matchRightLeft(Binding bindingLeft, boolean includeOnNoMatch, ExprList conditions, ExecutionContext execContext) { List<Binding> out = new ArrayList<Binding>() ; for ( Iterator<Binding> iter = rows.iterator() ; iter.hasNext() ; ) { Binding bindingRight = iter.next() ; Binding r = Algebra.merge(bindingLeft, bindingRight) ; if ( r == null ) continue ; // This does the conditional part. Theta-join. if ( conditions == null || conditions.isSatisfied(r, execContext) ) out.add(r) ; } if ( out.size() == 0 && includeOnNoMatch ) out.add(bindingLeft) ; if ( out.size() == 0 ) return new QueryIterNullIterator(execContext) ; return new QueryIterPlainWrapper(out.iterator(), execContext) ; }
public Table filter(ExprList expressions, Table table) { if ( debug ) { System.out.println("Restriction") ; System.out.println(expressions) ; dump(table) ; } QueryIterator iter = table.iterator(execCxt) ; List<Binding> output = new ArrayList<Binding>() ; for ( ; iter.hasNext() ; ) { Binding b = iter.nextBinding() ; if ( expressions.isSatisfied(b, execCxt) ) output.add(b) ; } return new TableN(new QueryIterPlainWrapper(output.iterator(), execCxt)) ; }
@Override public Table filter(ExprList expressions, Table table) { if ( debug ) { System.out.println("Restriction") ; System.out.println(expressions) ; dump(table) ; } QueryIterator iter = table.iterator(execCxt) ; List<Binding> output = new ArrayList<Binding>() ; for ( ; iter.hasNext() ; ) { Binding b = iter.nextBinding() ; if ( expressions.isSatisfied(b, execCxt) ) output.add(b) ; } return new TableN(new QueryIterPlainWrapper(output.iterator(), execCxt)) ; }
@Override public QueryIterator matchRightLeft(Binding bindingLeft, boolean includeOnNoMatch, ExprList conditions, ExecutionContext execContext) { boolean matches = true ; Node other = bindingLeft.get(var) ; if ( other == null ) { // Not present - return the merge = the other binding + this // (var/value) Binding mergedBinding = BindingFactory.binding(bindingLeft, var, value) ; return QueryIterSingleton.create(mergedBinding, execContext) ; } if ( !other.equals(value) ) matches = false ; else { if ( conditions != null ) matches = conditions.isSatisfied(bindingLeft, execContext) ; } if ( !matches && !includeOnNoMatch ) return QueryIterNullIterator.create(execContext) ; // Matches, or does not match and it's a left join - return the left // binding. return QueryIterSingleton.create(bindingLeft, execContext) ; }
public QueryIterator matchRightLeft(Binding bindingLeft, boolean includeOnNoMatch, ExprList conditions, ExecutionContext execContext) { boolean matches = true ; Node other = bindingLeft.get(var) ; if ( other == null ) { // Not present - return the merge = the other binding + this (var/value) Binding mergedBinding = BindingFactory.binding(bindingLeft, var, value) ; return QueryIterSingleton.create(mergedBinding, execContext) ; } if ( ! other.equals(value) ) matches = false ; else { if ( conditions != null ) matches = conditions.isSatisfied(bindingLeft, execContext) ; } if ( ! matches && ! includeOnNoMatch) return new QueryIterNullIterator(execContext) ; // Matches, or does not match and it's a left join - return the left binding. return QueryIterSingleton.create(bindingLeft, execContext) ; }