Package org.openrdf.query.algebra.evaluation

Examples of org.openrdf.query.algebra.evaluation.QueryBindingSet


      if (leftJoin.hasCondition()) {
        // Find a binding for which the join condition holds
        while (rightBindings != null) {
          // Limit the bindings to the ones that are in scope for this
          // filter
          QueryBindingSet scopeBindings = new QueryBindingSet(rightBindings);
          scopeBindings.retainAll(scopeBindingNames);

          try {
            if (strategy.isTrue(leftJoin.getCondition(), scopeBindings)) {
              return rightBindings;
            }
View Full Code Here


      bindingSets = new HashSet<BindingSet>();
      entries = buildUnorderedEntries(strategy, group, parentBindings);
    }

    for (Entry entry : entries) {
      QueryBindingSet sol = new QueryBindingSet(parentBindings);

      for (String name : group.getGroupBindingNames()) {
        Value value = entry.getPrototype().getValue(name);
        if (value != null) {
          // Potentially overwrites bindings from super
          sol.setBinding(name, value);
        }
      }

      for (GroupElem ge : group.getGroupElements()) {
        Value value = processAggregate(strategy, entry.getSolutions(), ge.getOperator());
        if (value != null) {
          // Potentially overwrites bindings from super
          sol.setBinding(ge.getName(), value);
        }
      }

      bindingSets.add(sol);
    }
View Full Code Here

  @Override
  public BindingSet convert(BindingSet sourceBindings)
    throws StoreException
  {
    QueryBindingSet targetBindings = new QueryBindingSet(sourceBindings);

    for (ExtensionElem extElem : extension.getElements()) {
      Value targetValue = strategy.evaluate(extElem.getExpr(), sourceBindings);

      if (targetValue != null) {
        // Potentially overwrites bindings from super
        targetBindings.setBinding(extElem.getName(), targetValue);
      }
    }

    return targetBindings;
  }
View Full Code Here

  }

  public static BindingSet project(ProjectionElemList projElemList, BindingSet sourceBindings,
      BindingSet parentBindings)
  {
    QueryBindingSet resultBindings = new QueryBindingSet(parentBindings);

    for (ProjectionElem pe : projElemList.getElements()) {
      Value targetValue = sourceBindings.getValue(pe.getSourceName());
      if (targetValue != null) {
        // Potentially overwrites bindings from super
        resultBindings.setBinding(pe.getTargetName(), targetValue);
      }
    }

    return resultBindings;
  }
View Full Code Here

  protected boolean accept(BindingSet bindings)
    throws StoreException
  {
    try {
      // Limit the bindings to the ones that are in scope for this filter
      QueryBindingSet scopeBindings = new QueryBindingSet(bindings);
      scopeBindings.retainAll(scopeBindingNames);

      return strategy.isTrue(condition, scopeBindings);
    }
    catch (ValueExprEvaluationException e) {
      // failed to evaluate condition
View Full Code Here

    }

    if (result != null) {
      // Make sure the provided problemVars are part of the returned results
      // (necessary in case of e.g. LeftJoin and Union arguments)
      QueryBindingSet extendedResult = null;

      for (String problemVar : problemVars) {
        if (!result.hasBinding(problemVar)) {
          if (extendedResult == null) {
            extendedResult = new QueryBindingSet(result);
          }
          extendedResult.addBinding(problemVar, inputBindings.getValue(problemVar));
        }
      }

      if (extendedResult != null) {
        result = extendedResult;
View Full Code Here

  /*--------------------*
   * Static util method *
   *--------------------*/

  private static QueryBindingSet getFilteredBindings(BindingSet bindings, Set<String> problemVars) {
    QueryBindingSet filteredBindings = new QueryBindingSet(bindings);
    filteredBindings.removeAll(problemVars);
    return filteredBindings;
  }
View Full Code Here

    conVar = sp.getContextVar();
  }

  @Override
  protected BindingSet convert(Statement st) {
    QueryBindingSet result = new QueryBindingSet(bindings);

    if (subjVar != null && !result.hasBinding(subjVar.getName())) {
      result.addBinding(subjVar.getName(), st.getSubject());
    }
    if (predVar != null && !result.hasBinding(predVar.getName())) {
      result.addBinding(predVar.getName(), st.getPredicate());
    }
    if (objVar != null && !result.hasBinding(objVar.getName())) {
      result.addBinding(objVar.getName(), st.getObject());
    }
    if (conVar != null && !result.hasBinding(conVar.getName()) && st.getContext() != null) {
      result.addBinding(conVar.getName(), st.getContext());
    }

    return result;
  }
View Full Code Here

  private Cursor<BindingSet> evaluate(SelectQuery qb, BindingSet b)
    throws UnsupportedRdbmsOperatorException, RdbmsException
  {
    List<Object> parameters = new ArrayList<Object>();
    QueryBindingSet bindings = new QueryBindingSet(b);
    String query = toQueryString(qb, bindings, parameters);
    try {
      Connection conn = triples.getConnection();
      PreparedStatement stmt = conn.prepareStatement(query);
      int p = 0;
View Full Code Here

    BindingSet next = super.next();
    if (next == null) {
      return null;
    }
    int size = bindings.size() + next.size();
    QueryBindingSet set = new QueryBindingSet(size);
    set.addAll(bindings);
    for (Binding binding : next) {
      set.setBinding(binding);
    }
    return set;
  }
View Full Code Here

TOP

Related Classes of org.openrdf.query.algebra.evaluation.QueryBindingSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.