Package de.fuberlin.wiwiss.d2rq.expr

Examples of de.fuberlin.wiwiss.d2rq.expr.Expression


      return TripleRelation.EMPTY;
    }
   
    MutableRelation mutator = new MutableRelation(selected.baseRelation());

    Expression constraint = nodeMakers.constraint();
    if (!constraint.isTrue()) {
      // Same variable occured more than once, so we add a constraint to the base relation
      mutator.select(constraint);
    }
   
    mutator.project(nodeMakers.allProjections());
View Full Code Here


          firstBaseRelation.joinConditions(),
          projectionsAndConditions,
          allUnique, longestOrderSpecs, firstBaseRelation.limit(), firstBaseRelation.limitInverse());
    } else {
      // Multiple relations with same condition
      Expression softCondition = firstBaseRelation.softCondition();
      if (differentSoftConditions) {
        Set<Expression> allSoftConditions = new HashSet<Expression>();
        for (BiningMakerAndCondition maker: makers) {
          allSoftConditions.add(maker.softCondition);
        }
View Full Code Here

  {
    logger.debug("convertNotEquals " + expr.toString());
   
    expr.getArg1().visit(this);
    expr.getArg2().visit(this);
    Expression e2 = expression.pop();
    Expression e1 = expression.pop();
   
    // TODO Expression.FALSE and Expression.TRUE are not constants
    if (e1.equals(Expression.FALSE))
      e1 = CONSTANT_FALSE;
    else if (e1.equals(Expression.TRUE))
      e1 = CONSTANT_TRUE;
    if (e2.equals(Expression.FALSE))
      e2 = CONSTANT_FALSE;
    else if (e2.equals(Expression.TRUE))
      e2 = CONSTANT_TRUE;
View Full Code Here

  }
 
  private void convertLogicalNot(E_LogicalNot expr)
  {
    expr.getArg().visit(this);
    Expression e1 = expression.pop();
    if (e1 instanceof Negation)
      expression.push(((Negation) e1).getBase());
    else
      expression.push(new Negation(e1));
  }
View Full Code Here

  }
 
  private void convert(E_UnaryMinus expr)
  {
    expr.getArg().visit(this);
    Expression e1 = expression.pop();
    if (e1 instanceof UnaryMinus)
      expression.push(((UnaryMinus) e1).getBase());
    else
      expression.push(new UnaryMinus(e1));
  }
View Full Code Here

  {
    logger.debug("convertIsIRI " + expr.toString());
   
    expr.getArg().visit(this);
   
    Expression arg = expression.pop();
   
    if (arg instanceof AttributeExprEx) {
      AttributeExprEx variable = (AttributeExprEx) arg;
      NodeMaker nm = variable.getNodeMaker();
      DetermineNodeType filter = new DetermineNodeType();
View Full Code Here

        translated.addAll(matchPatterns(first, it.next()));
      }
    }
    if (expressions.size() >= 2) {
      Iterator<Expression> it = expressions.iterator();
      Expression first = it.next();
      while (it.hasNext()) {
        translated.add(Equality.create(first, it.next()));
      }
    }
    if (blankNodeIDs.size() >= 2) {
      Iterator<BlankNodeID> it = blankNodeIDs.iterator();
      BlankNodeID first = it.next();
      while (it.hasNext()) {
        translated.addAll(matchBlankNodeIDs(first, it.next()));
      }
    }
    if (constantValue != null) {
      if (!attributes.isEmpty()) {
        Attribute first = attributes.iterator().next();
        translated.add(Equality.createAttributeValue(first, constantValue));
      }
      if (!blankNodeIDs.isEmpty()) {
        BlankNodeID first = blankNodeIDs.iterator().next();
        translated.add(first.valueExpression(constantValue));
      }
      if (!patterns.isEmpty()) {
        Pattern first = patterns.iterator().next();
        translated.add(first.valueExpression(constantValue));
      }
      if (!expressions.isEmpty()) {
        Expression first = expressions.iterator().next();
        translated.add(Equality.createExpressionValue(first, constantValue));
      }
    } else if (!attributes.isEmpty()) {
      AttributeExpr attribute = new AttributeExpr(attributes.iterator().next());
      if (!blankNodeIDs.isEmpty()) {
        BlankNodeID first = blankNodeIDs.iterator().next();
        translated.add(Equality.create(attribute, first.toExpression()));
      }
      if (!patterns.isEmpty()) {
        Pattern first = patterns.iterator().next();
        translated.add(Equality.create(attribute, first.toExpression()));
        checkUsesColumnFunctions(first);
      }
      if (!expressions.isEmpty()) {
        Expression first = expressions.iterator().next();
        translated.add(Equality.create(attribute, first));
      }
    } else if (!expressions.isEmpty()) {
      Expression expression = expressions.iterator().next();
      if (!blankNodeIDs.isEmpty()) {
        BlankNodeID first = blankNodeIDs.iterator().next();
        translated.add(Equality.create(expression, first.toExpression()));
      }
      if (!patterns.isEmpty()) {
View Full Code Here

  {
    logger.debug("convertIsBlank " + expr.toString());
   
    expr.getArg().visit(this);
   
    Expression arg = expression.pop();
   
    if (arg instanceof AttributeExprEx) {
      AttributeExprEx variable = (AttributeExprEx) arg;
      NodeMaker nm = variable.getNodeMaker();
      DetermineNodeType filter = new DetermineNodeType();
View Full Code Here

  {
    logger.debug("convertIsLiteral " + expr.toString());
   
    expr.getArg().visit(this);
   
    Expression arg = expression.pop();
   
    logger.debug("arg " + arg);
   
    if (arg instanceof AttributeExprEx) {
      AttributeExprEx variable = (AttributeExprEx) arg;
View Full Code Here

  {
    logger.debug("convertStr " + expr.toString());
   
    expr.getArg().visit(this);
   
    Expression arg = expression.pop();
   
    if (arg instanceof AttributeExprEx) {
      // make a new AttributeExprEx with changed NodeMaker, which returns plain literal
      // TODO this seems to work, but needs more testing.
      AttributeExprEx attribute = (AttributeExprEx) arg;
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.expr.Expression

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.