Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.ValueConstant


    }
    else {
      literal = valueFactory.createLiteral(litNode.getLabel());
    }

    return new ValueConstant(literal);
  }
View Full Code Here


      or.visitChildren(this);

      try {
        if (isConstant(or.getLeftArg()) && isConstant(or.getRightArg())) {
          boolean value = strategy.isTrue(or, EmptyBindingSet.getInstance());
          or.replaceWith(new ValueConstant(BooleanLiteralImpl.valueOf(value)));
        }
        else if (isConstant(or.getLeftArg())) {
          boolean leftIsTrue = strategy.isTrue(or.getLeftArg(), EmptyBindingSet.getInstance());
          if (leftIsTrue) {
            or.replaceWith(new ValueConstant(BooleanLiteralImpl.TRUE));
          }
          else {
            or.replaceWith(or.getRightArg());
          }
        }
        else if (isConstant(or.getRightArg())) {
          boolean rightIsTrue = strategy.isTrue(or.getRightArg(), EmptyBindingSet.getInstance());
          if (rightIsTrue) {
            or.replaceWith(new ValueConstant(BooleanLiteralImpl.TRUE));
          }
          else {
            or.replaceWith(or.getLeftArg());
          }
        }
View Full Code Here

      and.visitChildren(this);

      try {
        if (isConstant(and.getLeftArg()) && isConstant(and.getRightArg())) {
          boolean value = strategy.isTrue(and, EmptyBindingSet.getInstance());
          and.replaceWith(new ValueConstant(BooleanLiteralImpl.valueOf(value)));
        }
        else if (isConstant(and.getLeftArg())) {
          boolean leftIsTrue = strategy.isTrue(and.getLeftArg(), EmptyBindingSet.getInstance());
          if (leftIsTrue) {
            and.replaceWith(and.getRightArg());
          }
          else {
            and.replaceWith(new ValueConstant(BooleanLiteralImpl.FALSE));
          }
        }
        else if (isConstant(and.getRightArg())) {
          boolean rightIsTrue = strategy.isTrue(and.getRightArg(), EmptyBindingSet.getInstance());
          if (rightIsTrue) {
            and.replaceWith(and.getLeftArg());
          }
          else {
            and.replaceWith(new ValueConstant(BooleanLiteralImpl.FALSE));
          }
        }
      }
      catch (ValueExprEvaluationException e) {
        logger.warn("Failed to evaluate BinaryValueOperator with two constant arguments", e);
View Full Code Here

      super.meetBinaryValueOperator(binaryValueOp);

      if (isConstant(binaryValueOp.getLeftArg()) && isConstant(binaryValueOp.getRightArg())) {
        try {
          Value value = strategy.evaluate(binaryValueOp, EmptyBindingSet.getInstance());
          binaryValueOp.replaceWith(new ValueConstant(value));
        }
        catch (ValueExprEvaluationException e) {
          logger.warn("Failed to evaluate BinaryValueOperator with two constant arguments", e);
        }
        catch (QueryEvaluationException e) {
View Full Code Here

      super.meetUnaryValueOperator(unaryValueOp);

      if (isConstant(unaryValueOp.getArg())) {
        try {
          Value value = strategy.evaluate(unaryValueOp, EmptyBindingSet.getInstance());
          unaryValueOp.replaceWith(new ValueConstant(value));
        }
        catch (ValueExprEvaluationException e) {
          logger.warn("Failed to evaluate UnaryValueOperator with a constant argument", e);
        }
        catch (QueryEvaluationException e) {
View Full Code Here

      // All arguments are constant

      try {
        Value value = strategy.evaluate(functionCall, EmptyBindingSet.getInstance());
        functionCall.replaceWith(new ValueConstant(value));
      }
      catch (ValueExprEvaluationException e) {
        logger.warn("Failed to evaluate BinaryValueOperator with two constant arguments", e);
      }
      catch (QueryEvaluationException e) {
View Full Code Here

    {
      super.meet(bound);

      if (bound.getArg().hasValue()) {
        // variable is always bound
        bound.replaceWith(new ValueConstant(BooleanLiteralImpl.TRUE));
      }
    }
View Full Code Here

            ValueExpr flagsArg = node.getFlagsArg();
            if (flagsArg == null) {
              super.meet(node);
            }
            else if (flagsArg instanceof ValueConstant) {
              ValueConstant flags = (ValueConstant)flagsArg;
              if (flags.getValue().stringValue().equals("i")) {
                super.meet(node);
              }
              else {
                throw unsupported(node);
              }
View Full Code Here

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

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

  @Override
  public Object visit(ASTFunctionCall node, Object data)
    throws VisitorException
  {
    ValueConstant uriNode = (ValueConstant)node.jjtGetChild(0).jjtAccept(this, null);
    URI functionURI = (URI)uriNode.getValue();

    FunctionCall functionCall = new FunctionCall(functionURI.toString());

    for (int i = 1; i < node.jjtGetNumChildren(); i++) {
      Node argNode = node.jjtGetChild(i);
View Full Code Here

TOP

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

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.