Package de.fuberlin.wiwiss.d2rq.nodes

Examples of de.fuberlin.wiwiss.d2rq.nodes.NodeMaker


   
    logger.debug("arg " + arg);
   
    if (arg instanceof AttributeExprEx) {
      AttributeExprEx variable = (AttributeExprEx) arg;
      NodeMaker nm = variable.getNodeMaker();
     
      DetermineNodeType filter = new DetermineNodeType();
      nm.describeSelf(filter);
      expression.push(filter.isLimittedToLiterals() ? Expression.TRUE : Expression.FALSE);
    } else if (arg instanceof ConstantEx) {
      ConstantEx constant = (ConstantEx) arg;
      Node node = constant.getNode();
      expression.push(node.isLiteral() ? Expression.TRUE : Expression.FALSE);
View Full Code Here


   
    Expression arg = expression.pop();
   
    if (arg instanceof AttributeExprEx) {
      AttributeExprEx variable = (AttributeExprEx) arg;
      NodeMaker nm = variable.getNodeMaker();
      DetermineNodeType filter = new DetermineNodeType();
      nm.describeSelf(filter);
      String lang = filter.getLanguage();
      logger.debug("lang " + lang);
      if (lang == null)
        lang = "";
     
View Full Code Here

   
    Expression arg = expression.pop();
   
    if (arg instanceof AttributeExprEx) {
      AttributeExprEx variable = (AttributeExprEx) arg;
      NodeMaker nm = variable.getNodeMaker();
      DetermineNodeType filter = new DetermineNodeType();
      nm.describeSelf(filter);
      if (!filter.isLimittedToLiterals()) {
        // type error, return false?
        logger.warn("type error: " + variable + " is not a literal, returning FALSE");
        expression.push(Expression.FALSE);
        return;
View Full Code Here

        constant = (ConstantEx) e1;
      }
     
      logger.debug("isEqual(" + variable + ", " + constant + ")");
     
      NodeMaker nm = variable.getNodeMaker();
     
      if (nm instanceof TypedNodeMaker) {
        ValueMaker vm = ((TypedNodeMaker) nm).valueMaker();
        Node node = constant.getNode();
        logger.debug("checking " + node + " with " + nm);
               
        boolean empty = nm.selectNode(node, RelationalOperators.DUMMY).equals(NodeMaker.EMPTY);
        logger.debug("result " + new Boolean(empty));
        if (!empty) {
          if (node.isURI())
            expression.push(vm.valueExpression(node.getURI()));
          else if (node.isLiteral())
            expression.push(vm.valueExpression(constant.value()));
          else
            conversionFailed(expr); // TODO blank nodes?
          return;
        } else {
          expression.push(Expression.FALSE);
          return;
        }
      } else {
        logger.warn("nm is not a TypedNodemaker");
      }
    } else if (e1 instanceof ConstantEx && e2 instanceof ConstantEx) {
      logger.debug("isEqual(" + e1 + ", " + e2 + ")");
      ConstantEx constant1 = (ConstantEx) e1;
      ConstantEx constant2 = (ConstantEx) e2;
      boolean equals = NodeFunctions.sameTerm(constant1.getNode(), constant2.getNode());
      logger.debug("constants same? " + new Boolean(equals));
      expression.push(equals ? Expression.TRUE : Expression.FALSE);
      return;
    } else if (e1 instanceof AttributeExprEx && e2 instanceof AttributeExprEx) {
      logger.debug("isEqual(" + e1 + ", " + e2 + ")");
      AttributeExprEx variable1 = (AttributeExprEx) e1;
      AttributeExprEx variable2 = (AttributeExprEx) e2;
     
      NodeMaker nm1 = variable1.getNodeMaker();
      NodeMaker nm2 = variable2.getNodeMaker();

      NodeSetConstraintBuilder nodeSet = new NodeSetConstraintBuilder();
      nm1.describeSelf(nodeSet);
      nm2.describeSelf(nodeSet);
     
      if (nodeSet.isEmpty()) {
        logger.debug("nodes " + nm1 + " " + nm2 + " incompatible");
        expression.push(Expression.FALSE);
        return;
View Full Code Here

    }
  }
 
  private void execute() {
    MutableRelation newRelation = new MutableRelation(downloadMap.getRelation());
    NodeMaker x = downloadMap.nodeMaker().selectNode(Node.createURI(uri), newRelation);
    // URI didn't fit the node maker
    if (x.equals(NodeMaker.EMPTY)) return;
    Set<ProjectionSpec> requiredProjections = new HashSet<ProjectionSpec>();
    requiredProjections.add(downloadMap.getContentDownloadColumn());
    requiredProjections.addAll(mediaTypeValueMaker.projectionSpecs());
    newRelation.project(requiredProjections);
    newRelation.limit(1);
View Full Code Here

        if (t.getObject().isVariable())
          names.add(t.getObject().getName());
 
        for (String name: names) {
          Var nameVar = Var.alloc(name);
          NodeMaker n = (NodeMaker) nodeSets.toMap().get(nameVar);
          if (n != null/* && n instanceof TypedNodeMaker*/) {

            AttributeSet attributes = AttributeSet.createFrom(n);
            /*
             * If we would set an alias to this table...
View Full Code Here

  }
 
  public void testCombineDifferentConditions() {
    Attribute id = SQL.parseAttribute("TABLE.ID");
    db.setNullable(id, false);
    NodeMaker x = new TypedNodeMaker(TypedNodeMaker.PLAIN_LITERAL, new Column(id), true);
    Map<Var,NodeMaker> map = Collections.singletonMap(Var.alloc("x"), x);
    BindingMaker bm = new BindingMaker(map, null);
    RelationBuilder b1 = new RelationBuilder(db);
    RelationBuilder b2 = new RelationBuilder(db);
    b1.addProjection(id);
View Full Code Here

  }
 
  public void testCombineConditionAndNoCondition() {
    Attribute id = SQL.parseAttribute("TABLE.ID");
    db.setNullable(id, false);
    NodeMaker x = new TypedNodeMaker(TypedNodeMaker.PLAIN_LITERAL, new Column(id), true);
    Map<Var,NodeMaker> map = Collections.singletonMap(Var.alloc("x"), x);
    BindingMaker bm = new BindingMaker(map, null);
    RelationBuilder b1 = new RelationBuilder(db);
    RelationBuilder b2 = new RelationBuilder(db);
    b1.addProjection(id);
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.nodes.NodeMaker

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.