public boolean varUsedInFilterOrAssignment(IVariable<?> var){
  if (!usageMap.containsKey(var)) {
    return false;
  }
  final List<IQueryNode> varOccurrences=usageMap.get(var);
  for (int i=0; i < varOccurrences.size(); i++) {
    final IQueryNode n=varOccurrences.get(i);
    if (n instanceof FilterNode || n instanceof AssignmentNode) {
      return true;
    }
  }
  return false;
}

public boolean varUsedInFilterOrAssignment ( IVariable < ? > var ) { if ( ! usageMap . containsKey ( var ) ) { return false ; } final List < IQueryNode > varOccurrences = usageMap . get ( var ) ; for ( int i = 0 ; i < varOccurrences . size ( ) ; i ++ ) { final IQueryNode n = varOccurrences . get ( i ) ; if ( n instanceof FilterNode || n instanceof AssignmentNode ) { return true ; } } return false ; }
returns true if a usage record for the given variable inside a filter or bind / values node has been recorded . the rationale of this check is as follows : if a variable used inside a static binding is queries in such an ancestor filter , the binding must not be considered global . as an example , consider the following query : < pre > select * where { filter ( ! bound ( ? x ) ) { bind ( 1 as ? x ) } } expected result is the empty set , according to bottom - up semantics . we must * not * rewrite this query as select * where { filter ( ! bound ( ? x ) ) } values ? x { 1 } the reason is that in this case the filter will pass , while ? x in the original query the bind ( 1 as ? x ) is in scope and the filter fails . the same holds for queries where the filter is at the same level as the bind / values clause , such as : select * where { filter ( ! bound ( ? x ) ) { bind ( 1 as ? x ) } }
