Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.SameTerm


        boolean rightIsResource = isResource(rightArg);

        if (leftIsVar && rightIsResource || leftIsResource && rightIsVar || leftIsResource
            && rightIsResource)
        {
          SameTerm sameTerm = new SameTerm(leftArg, rightArg);
          compare.replaceWith(sameTerm);
        }
      }
    }
View Full Code Here


        Var var2 = nodeVars.get(j);

        // At least one of the variables should be non-constant
        // for the unequality to make any sense:
        if (!var1.hasValue() || !var2.hasValue()) {
          graphPattern.addConstraint(new Not(new SameTerm(var1, var2)));
        }
      }
    }

    return nodeVars;
View Full Code Here

    public void meet(Filter filter) {
      super.meet(filter);

      if (filter.getCondition() instanceof SameTerm) {
        // SameTerm applies to the filter's argument
        SameTerm sameTerm = (SameTerm)filter.getCondition();
        TupleExpr filterArg = filter.getArg();

        ValueExpr leftArg = sameTerm.getLeftArg();
        ValueExpr rightArg = sameTerm.getRightArg();

        // Verify that vars are (potentially) bound by filterArg
        Set<String> bindingNames = filterArg.getBindingNames();
        if (leftArg instanceof Var && !bindingNames.contains(((Var)leftArg).getName())
            || rightArg instanceof Var && !bindingNames.contains(((Var)rightArg).getName()))
View Full Code Here

    List<SameTerm> sameTerms = new ArrayList<SameTerm>(2 * node.jjtGetNumChildren());

    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
      ValueExpr resource = (ValueExpr)node.jjtGetChild(i).jjtAccept(this, null);

      sameTerms.add(new SameTerm(subjVar.clone(), resource));
      sameTerms.add(new SameTerm(objVar.clone(), resource));
    }

    ValueExpr constraint = new Or(sameTerms);

    result = new Filter(result, constraint);
View Full Code Here

  public SameTerm visit(ASTSameTerm node, Object data)
    throws VisitorException
  {
    ValueExpr leftArg = (ValueExpr)node.jjtGetChild(0).jjtAccept(this, null);
    ValueExpr rightArg = (ValueExpr)node.jjtGetChild(1).jjtAccept(this, null);
    return new SameTerm(leftArg, rightArg);
  }
View Full Code Here

        boolean rightIsResource = isResource(rightArg);

        if (leftIsVar && rightIsResource || leftIsResource && rightIsVar || leftIsResource
            && rightIsResource)
        {
          SameTerm sameTerm = new SameTerm(leftArg, rightArg);
          compare.replaceWith(sameTerm);
        }
      }
    }
View Full Code Here

        Var var2 = nodeVars.get(j);

        // At least one of the variables should be non-constant
        // for the unequality to make any sense:
        if (!var1.hasValue() || !var2.hasValue()) {
          graphPattern.addConstraint(new Not(new SameTerm(var1, var2)));
        }
      }
    }

    return nodeVars;
View Full Code Here

    List<SameTerm> sameTerms = new ArrayList<SameTerm>(2 * node.jjtGetNumChildren());

    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
      ValueExpr resource = (ValueExpr)node.jjtGetChild(i).jjtAccept(this, null);

      sameTerms.add(new SameTerm(subjVar.clone(), resource));
      sameTerms.add(new SameTerm(objVar.clone(), resource));
    }

    ValueExpr constraint = sameTerms.get(0);
    for (int i = 0; i < sameTerms.size(); i++) {
      constraint = new Or(constraint, sameTerms.get(i));
View Full Code Here

  public SameTerm visit(ASTSameTerm node, Object data)
    throws VisitorException
  {
    ValueExpr leftArg = (ValueExpr)node.jjtGetChild(0).jjtAccept(this, null);
    ValueExpr rightArg = (ValueExpr)node.jjtGetChild(1).jjtAccept(this, null);
    return new SameTerm(leftArg, rightArg);
  }
View Full Code Here

TOP

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

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.