Package de.fuberlin.wiwiss.d2rq.algebra

Examples of de.fuberlin.wiwiss.d2rq.algebra.Attribute


    this.out.println(propertyBridgeIRITurtle(linkTableName, "link") + " a d2rq:PropertyBridge;");
    this.out.println("\td2rq:belongsToClassMap " + classMapIRITurtle(table1) + ";");
    this.out.println("\td2rq:property " + vocabularyIRITurtle(linkTableName) + ";");
    this.out.println("\td2rq:refersToClassMap " + classMapIRITurtle(table2) + ";");
    for (Attribute column: join1.attributes1()) {
      Attribute otherColumn = join1.equalAttribute(column);
      this.out.println("\td2rq:join \"" + column.qualifiedName() + " " + Join.joinOperators[join1.joinDirection()] + " " + otherColumn.qualifiedName() + "\";");
    }
    AliasMap alias = AliasMap.NO_ALIASES;
    if (isSelfJoin) {
      RelationName aliasName = new RelationName(
          null, table2.tableName() + "_" + linkTableName.tableName() + "__alias");
      alias = AliasMap.create1(table2, aliasName);
      this.out.println("\td2rq:alias \"" + table2.qualifiedName() +
          " AS " + aliasName.qualifiedName() + "\";");
    }
    for (Attribute column: join2.attributes1()) {
      Attribute otherColumn = join2.equalAttribute(column);
      this.out.println("\td2rq:join \"" + column.qualifiedName() + " " + Join.joinOperators[join2.joinDirection()] + " " + alias.applyTo(otherColumn).qualifiedName() + "\";");
    }
    this.out.println("\t.");
    this.out.println();
    createLinkProperty(linkTableName, table1, table2);
View Full Code Here


    if (!match.matches()) {
      return Expression.FALSE;
    }
    Collection<Expression> expressions = new ArrayList<Expression>(columns.size());
    for (int i = 0; i < this.columns.size(); i++) {
      Attribute attribute = columns.get(i);
      ColumnFunction function = columnFunctions.get(i);
      String attributeValue = function.decode(match.group(i + 1));
      if (attributeValue == null) {
        return Expression.FALSE;
      }
View Full Code Here

   */
  public String makeValue(ResultRow row) {
    int index = 0;
    StringBuffer result = new StringBuffer(this.firstLiteralPart);
    while (index < this.columns.size()) {
      Attribute column = columns.get(index);
      ColumnFunction function = columnFunctions.get(index);
      String value = row.get(column);
      if (value == null) {
        return null;
      }
View Full Code Here

 
  public ValueMaker renameAttributes(ColumnRenamer renames) {
    int index = 0;
    StringBuffer newPattern = new StringBuffer(this.firstLiteralPart);
    while (index < this.columns.size()) {
      Attribute column = columns.get(index);
      ColumnFunction function = columnFunctions.get(index);
      newPattern.append(DELIMITER);
      newPattern.append(renames.applyTo(column).qualifiedName());
      if (function.name() != null) {
        newPattern.append("|");
View Full Code Here

    List<Attribute> result = new ArrayList<Attribute>();
    try {
      ResultSet rs = this.schema.getColumns(
          null, schemaName(tableName), tableName(tableName), null);
      while (rs.next()) {
        result.add(new Attribute(tableName, rs.getString("COLUMN_NAME")));
      }
      rs.close();
      return result;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
View Full Code Here

    List<Attribute> result = new ArrayList<Attribute>();
    try {
      ResultSet rs = this.schema.getPrimaryKeys(
          null, schemaName(tableName), tableName(tableName));
      while (rs.next()) {
        result.add(new Attribute(tableName, rs.getString("COLUMN_NAME")));
      }
      rs.close();
      return result;
    } catch (SQLException ex) {
      throw new D2RQException("Database exception", ex, D2RQException.D2RQ_SQLEXCEPTION);
View Full Code Here

          ? this.schema.getImportedKeys(null, schemaName(tableName), tableName(tableName))
          : this.schema.getExportedKeys(null, schemaName(tableName), tableName(tableName)));
      while (rs.next()) {
        RelationName pkTable = toRelationName(
            rs.getString("PKTABLE_SCHEM"), rs.getString("PKTABLE_NAME"));
        Attribute primaryColumn = new Attribute(pkTable, rs.getString("PKCOLUMN_NAME"));
        RelationName fkTable = toRelationName(
            rs.getString("FKTABLE_SCHEM"), rs.getString("FKTABLE_NAME"));
        Attribute foreignColumn = new Attribute(fkTable, rs.getString("FKCOLUMN_NAME"));
        String fkName = rs.getString("FK_NAME");
        if (!fks.containsKey(fkName)) {
          fks.put(fkName, new ForeignKey());
        }
        int keySeq = rs.getInt("KEY_SEQ") - 1;
View Full Code Here

        new FixedNodeMaker(FOAF.knows.asNode(), false),
        new TypedNodeMaker(TypedNodeMaker.URI,
            new Pattern("http://test/person@@employees.manager@@"), true));
    this.withURIColumnSubject = new TripleRelation(base,
        new TypedNodeMaker(TypedNodeMaker.URI,
            new Column(new Attribute(null, "employees", "homepage")), false),
        new FixedNodeMaker(RDF.type.asNode(), false),
        new FixedNodeMaker(FOAF.Document.asNode(), false));
    this.withURIPatternSubjectAndURIColumnObject = new TripleRelation(base,
        new TypedNodeMaker(TypedNodeMaker.URI,
            new Pattern("http://test/person@@employees.ID@@"), true),
        new FixedNodeMaker(FOAF.homepage.asNode(), false),
        new TypedNodeMaker(TypedNodeMaker.URI,
            new Column(new Attribute(null, "employees", "homepage")), false));
    this.employeeChecker = new URIMakerRule().createRuleChecker(
        Node.createURI("http://test/person1"));
    this.foobarChecker = new URIMakerRule().createRuleChecker(
        Node.createURI("http://test/foobar"));
  }
View Full Code Here

  }
 
  private List<Expression> matchBlankNodeIDs(BlankNodeID id1, BlankNodeID id2) {
    List<Expression> results = new ArrayList<Expression>(id1.attributes().size());
    for (int i = 0; i < id1.attributes().size(); i++) {
      Attribute col1 = id1.attributes().get(i);
      Attribute col2 = id2.attributes().get(i);
      results.add(Equality.createAttributeEquality(col1, col2));
    }
    return results;
  }
View Full Code Here

      return Expression.FALSE;
    }
    List<Expression> translated = new ArrayList<Expression>();
    if (attributes.size() >= 2) {
      Iterator<Attribute> it = attributes.iterator();
      Attribute first = it.next();
      while (it.hasNext()) {
        translated.add(Equality.createAttributeEquality(first, it.next()));
      }
    }
    if (patterns.size() >= 2) {
      Iterator<Pattern> it = patterns.iterator();
      Pattern first = it.next();
      while (it.hasNext()) {
        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()) {
        Pattern first = patterns.iterator().next();
        translated.add(Equality.create(expression, first.toExpression()));
        checkUsesColumnFunctions(first);
      }
    } else if (!patterns.isEmpty() && !blankNodeIDs.isEmpty()) {
      Pattern firstPattern = patterns.iterator().next();
      BlankNodeID firstBNodeID = blankNodeIDs.iterator().next();
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.algebra.Attribute

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.