Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.ValueExpr


          @Override
          public void meet(Regex node)
            throws UnsupportedRdbmsOperatorException
          {
            ValueExpr flagsArg = node.getFlagsArg();
            if (flagsArg == null) {
              super.meet(node);
            }
            else if (flagsArg instanceof ValueConstant) {
              ValueConstant flags = (ValueConstant)flagsArg;
View Full Code Here


    // Create BNodeGenerator's for all anonymous variables
    Map<Var, ExtensionElem> extElemMap = new HashMap<Var, ExtensionElem>();

    for (Var var : constructVars) {
      if (var.isAnonymous() && !extElemMap.containsKey(var)) {
        ValueExpr valueExpr = null;

        if (var.hasValue()) {
          valueExpr = new ValueConstant(var.getValue());
        }
        else if (explicit) {
View Full Code Here

     * them out of the condition into the right side.
     */
    @Override
    public void meet(LeftJoin node) {
      super.meet(node);
      ValueExpr condition = node.getCondition();
      if (condition != null) {
        And and = new And();
        List<ValueExpr> constraints = new ArrayList<ValueExpr>(16);
        getConjunctiveConstraints(condition, constraints);

        for (int i = constraints.size() - 1; i >= 0; i--) {
          ValueExpr constraint = constraints.get(i);
          TupleExpr right = node.getRightArg();
          Set<String> filterVars = new VarFinder(constraint).getVars();
          if (right.getBindingNames().containsAll(filterVars)) {
            node.setRightArg(new Filter(right.clone(), constraint.clone()));
          }
          else {
            and.addArg(constraint);
          }
        }
View Full Code Here

    throws StoreException
  {
    if (operator instanceof Count) {
      Count countOp = (Count)operator;

      ValueExpr arg = countOp.getArg();

      if (arg != null) {
        Set<Value> values = makeValueSet(strategy, arg, bindingSets);
        return new LiteralImpl(Integer.toString(values.size()), XMLSchema.INTEGER);
      }
View Full Code Here

    @Override
    public void meet(Compare compare) {
      super.meet(compare);

      if (compare.getOperator() == CompareOp.EQ) {
        ValueExpr leftArg = compare.getLeftArg();
        ValueExpr rightArg = compare.getRightArg();

        boolean leftIsVar = isVar(leftArg);
        boolean rightIsVar = isVar(rightArg);
        boolean leftIsResource = isResource(leftArg);
        boolean rightIsResource = isResource(rightArg);
View Full Code Here

    Extension extension = new Extension();
    ProjectionElemList projElemList = new ProjectionElemList();

    for (ASTProjectionElem projElemNode : node.getProjectionElemList()) {
      ValueExpr valueExpr = (ValueExpr)projElemNode.getValueExpr().jjtAccept(this, null);

      String alias = projElemNode.getAlias();
      if (alias != null) {
        // aliased projection element
        extension.addElement(new ExtensionElem(valueExpr, alias));
View Full Code Here

    StatementPattern.Scope scope = StatementPattern.Scope.DEFAULT_CONTEXTS;
    Var contextVar = null;

    if (node.hasContextID()) {
      scope = StatementPattern.Scope.NAMED_CONTEXTS;
      ValueExpr contextID = (ValueExpr)node.getContextID().jjtAccept(this, null);

      if (contextID instanceof Var) {
        contextVar = (Var)contextID;
      }
      else if (contextID instanceof ValueConstant) {
        ValueConstant vc = (ValueConstant)contextID;
        contextVar = createConstantVar(vc.getValue());
      }
      else {
        throw new IllegalArgumentException("Unexpected contextID result type: " + contextID.getClass());
      }
    }

    graphPattern.setStatementPatternScope(scope);
    graphPattern.setContextVar(contextVar);
View Full Code Here

  @Override
  public Integer visit(ASTWhere node, Object data)
    throws VisitorException
  {
    ValueExpr valueExpr = (ValueExpr)node.getCondition().jjtAccept(this, null);
    graphPattern.addConstraint(valueExpr);
    return null;
  }
View Full Code Here

  @Override
  public Var visit(ASTEdge node, Object data)
    throws VisitorException
  {
    ValueExpr arg = (ValueExpr)node.getValueExpr().jjtAccept(this, null);

    if (arg instanceof Var) {
      return (Var)arg;
    }
    else if (arg instanceof ValueConstant) {
      ValueConstant vc = (ValueConstant)arg;
      return createConstantVar(vc.getValue());
    }
    else {
      throw new IllegalArgumentException("Unexpected edge argument type: " + arg.getClass());
    }
  }
View Full Code Here

  @Override
  public Var visit(ASTNodeElem node, Object data)
    throws VisitorException
  {
    ValueExpr valueExpr = (ValueExpr)node.getChild().jjtAccept(this, null);

    if (valueExpr instanceof Var) {
      return (Var)valueExpr;
    }
    else if (valueExpr instanceof ValueConstant) {
      ValueConstant vc = (ValueConstant)valueExpr;
      return createConstantVar(vc.getValue());
    }
    else {
      throw new IllegalArgumentException("Unexpected node element result type: " + valueExpr.getClass());
    }
  }
View Full Code Here

TOP

Related Classes of org.openrdf.query.algebra.ValueExpr

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.