Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.TupleExpr


  @Override
  public void meet(Union node)
    throws RuntimeException
  {
    super.meet(node);
    TupleExpr l = node.getLeftArg();
    TupleExpr r = node.getRightArg();
    if (!(l instanceof SelectQuery && r instanceof SelectQuery))
      return;
    SelectQuery left = (SelectQuery)l;
    SelectQuery right = (SelectQuery)r;
    if (left.isComplex() || right.isComplex())
View Full Code Here


  @Override
  public void meet(Join node)
    throws RuntimeException
  {
    super.meet(node);
    TupleExpr l = node.getLeftArg();
    TupleExpr r = node.getRightArg();
    if (!(l instanceof SelectQuery && r instanceof SelectQuery))
      return;
    SelectQuery left = (SelectQuery)l;
    SelectQuery right = (SelectQuery)r;
    if (left.isComplex() || right.isComplex())
View Full Code Here

  @Override
  public void meet(LeftJoin node)
    throws RuntimeException
  {
    super.meet(node);
    TupleExpr l = node.getLeftArg();
    TupleExpr r = node.getRightArg();
    if (!(l instanceof SelectQuery && r instanceof SelectQuery))
      return;
    SelectQuery left = (SelectQuery)l;
    SelectQuery right = (SelectQuery)r;
    if (left.isComplex() || right.isComplex())
View Full Code Here

      }

      joinArgs = sortExpressions(joinArgs, new HashSet<String>());

      // Build new join hierarchy
      TupleExpr replacement = joinArgs.get(0);
      for (int i = 1; i < joinArgs.size(); i++) {
        replacement = new Join(replacement, joinArgs.get(i));
      }

      // Replace old join hierarchy
View Full Code Here

     */
    protected List<TupleExpr> sortExpressions(List<TupleExpr> expressions, Set<String> boundVars) {
      List<TupleExpr> orderedExpressions = new ArrayList<TupleExpr>(expressions.size());

      while (!expressions.isEmpty()) {
        TupleExpr tupleExpr = selectNextTupleExpr(expressions, boundVars);

        expressions.remove(tupleExpr);
        orderedExpressions.add(tupleExpr);

        boundVars.addAll(tupleExpr.getBindingNames());
      }

      return orderedExpressions;
    }
View Full Code Here

     * highest number of bound variables, preferring variables that have been
     * bound in other tuple expressions over variables with a fixed value.
     */
    protected TupleExpr selectNextTupleExpr(List<TupleExpr> expressions, Set<String> boundVars) {
      double lowestCardinality = Double.MAX_VALUE;
      TupleExpr result = null;

      for (TupleExpr tupleExpr : expressions) {
        // Calculate a score for this tuple expression
        double cardinality = statistics.getCardinality(tupleExpr, boundVars);

View Full Code Here

    @Override
    public void meet(Join join) {
      super.meet(join);

      TupleExpr leftArg = join.getLeftArg();
      TupleExpr rightArg = join.getRightArg();

      if (leftArg instanceof EmptySet || rightArg instanceof EmptySet) {
        join.replaceWith(new EmptySet());
      }
      else if (leftArg instanceof SingletonSet) {
View Full Code Here

    @Override
    public void meet(LeftJoin leftJoin) {
      super.meet(leftJoin);

      TupleExpr leftArg = leftJoin.getLeftArg();
      TupleExpr rightArg = leftJoin.getRightArg();
      ValueExpr condition = leftJoin.getCondition();

      if (leftArg instanceof EmptySet) {
        leftJoin.replaceWith(leftArg);
      }
View Full Code Here

    @Override
    public void meet(Union union) {
      super.meet(union);

      TupleExpr leftArg = union.getLeftArg();
      TupleExpr rightArg = union.getRightArg();

      if (leftArg instanceof EmptySet) {
        union.replaceWith(rightArg);
      }
      else if (rightArg instanceof EmptySet) {
View Full Code Here

    @Override
    public void meet(Difference difference) {
      super.meet(difference);

      TupleExpr leftArg = difference.getLeftArg();
      TupleExpr rightArg = difference.getRightArg();

      if (leftArg instanceof EmptySet) {
        difference.replaceWith(leftArg);
      }
      else if (rightArg instanceof EmptySet) {
View Full Code Here

TOP

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

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.