Examples of QueryBindingSet


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

  @Override
  protected BindingSet convert(ResultSet rs)
    throws SQLException
  {
    QueryBindingSet result = new QueryBindingSet(bindings);
    for (ColumnVar var : projections) {
      String name = var.getName();
      if (var != null && !result.hasBinding(name)) {
        Value value = var.getValue();
        if (value == null) {
          value = createValue(rs, var.getIndex() + 1);
        }
        if (value != null) {
          result.addBinding(var.getName(), value);
        }
      }
    }
    return result;
  }
View Full Code Here

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

    if (problemVars.isEmpty()) {
      // left join is "well designed"
      return new LeftJoinIterator(this, leftJoin, bindings);
    }
    else {
      QueryBindingSet filteredBindings = new QueryBindingSet(bindings);
      filteredBindings.removeAll(problemVars);
      CloseableIteration<BindingSet, QueryEvaluationException> iter;

      iter = new LeftJoinIterator(this, leftJoin, filteredBindings);
      iter = new CompatibleBindingSetFilter(iter, bindings);
View Full Code Here

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

  }

  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

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

  protected boolean accept(BindingSet bindings)
    throws QueryEvaluationException
  {
    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(filter.getCondition(), scopeBindings);
    }
    catch (ValueExprEvaluationException e) {
      // failed to evaluate condition
View Full Code Here

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

      bindingSets = new HashSet<BindingSet>();
      entries = buildUnorderedEntries();
    }

    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(entry.getSolutions(), ge.getOperator());
        if (value != null) {
          // Potentially overwrites bindings from super
          sol.setBinding(ge.getName(), value);
        }
      }

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

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

  @Override
  public BindingSet convert(BindingSet sourceBindings)
    throws QueryEvaluationException
  {
    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

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

            requestURL.append('/');
          }
          String namespace = requestURL.toString();

          while (queryResult.hasNext()) {
            QueryBindingSet bindings = new QueryBindingSet(queryResult.next());

            String id = bindings.getValue("id").stringValue();
            bindings.addBinding("uri", vf.createURI(namespace, id));

            bindingSets.add(bindings);
          }

          bindingNames.add("uri");
View Full Code Here

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

  private CloseableIteration<BindingSet, QueryEvaluationException> evaluate(SelectQuery qb, BindingSet b)
    throws UnsupportedRdbmsOperatorException, RdbmsQueryEvaluationException
  {
    List<Object> parameters = new ArrayList<Object>();
    try {
      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

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

  @Override
  protected BindingSet convert(ResultSet rs)
    throws SQLException
  {
    QueryBindingSet result = new QueryBindingSet(bindings);
    for (ColumnVar var : projections) {
      String name = var.getName();
      if (var != null && !result.hasBinding(name)) {
        Value value = var.getValue();
        if (value == null) {
          value = createValue(rs, var.getIndex() + 1);
        }
        if (value != null) {
          result.addBinding(var.getName(), value);
        }
      }
    }
    return result;
  }
View Full Code Here

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

    // Return an iterator that converts the statements to var bindings
    return new ConvertingIteration<Statement, BindingSet, QueryEvaluationException>(stIter) {

      @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
TOP
Copyright © 2018 www.massapi.com. 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.