Package de.fuberlin.wiwiss.d2rq.algebra

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


        } else if (bridge.selectTriple(new Triple(Node.ANY, FOAF.name.asNode(), Node.ANY)) != null) {
          inventoryBridges.add(bridge);         
        }
      }
      if (inventoryBridges.isEmpty()) {
        Relation relation = (Relation) this.mapping.classMap(classMapResource).relation();
        NodeMaker typeNodeMaker = new FixedNodeMaker(
            RDF.type.asNode(), false);
        NodeMaker resourceNodeMaker = new FixedNodeMaker(RDFS.Resource.asNode(), false);
        inventoryBridges.add(new TripleRelation(relation,
            resourceMaker, typeNodeMaker, resourceNodeMaker));
View Full Code Here


  private TripleRelation withURIPatternSubjectAndURIColumnObject;
  private URIMakerRuleChecker employeeChecker;
  private URIMakerRuleChecker foobarChecker;

  public void setUp() {
    Relation base = new RelationImpl(null, AliasMap.NO_ALIASES,
        Expression.TRUE, Expression.TRUE,
        Collections.<Join>emptySet(), Collections.<ProjectionSpec>emptySet(),
        false, OrderSpec.NONE, Relation.NO_LIMIT, Relation.NO_LIMIT);
    this.withURIPatternSubject = new TripleRelation(base,
        new TypedNodeMaker(TypedNodeMaker.URI,
View Full Code Here

    Set<ProjectionSpec> requiredProjections = new HashSet<ProjectionSpec>();
    requiredProjections.add(downloadMap.getContentDownloadColumn());
    requiredProjections.addAll(mediaTypeValueMaker.projectionSpecs());
    newRelation.project(requiredProjections);
    newRelation.limit(1);
    Relation filteredRelation = newRelation.immutableSnapshot();
    SelectStatementBuilder builder = new SelectStatementBuilder(filteredRelation);
    String sql = builder.getSQLStatement();
    int contentColumn = builder.getColumnSpecs().indexOf(downloadMap.getContentDownloadColumn()) + 1;
      db = filteredRelation.database();
    Connection conn = db.connection();
    try {
      statement = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      log.debug(sql);
View Full Code Here

    assertNull(translate1("ex:res1 rdf:type foaf:Project", "engine/type-bridge.n3"));
  }

  public void testAskMatch() {
    NodeRelation nodeRel = translate1("ex:res1 rdf:type ex:Class1", "engine/type-bridge.n3");
    Relation r = nodeRel.baseRelation();
    assertEquals(Collections.singleton(table1), r.tables());
    assertEquals(Collections.EMPTY_SET, r.projections());
    assertEquals(Equality.createAttributeValue(table1id, "1"), r.condition());
    assertEquals(AliasMap.NO_ALIASES, r.aliases());
    assertEquals(Collections.EMPTY_SET, nodeRel.variables());
  }
View Full Code Here

    assertNull(translate1("ex:res1 ex:foo ?foo", "engine/type-bridge.n3"));
  }
 
  public void testFindFixedMatch() {
    NodeRelation nodeRel = translate1("ex:res1 rdf:type ?type", "engine/type-bridge.n3");
    Relation r = nodeRel.baseRelation();
    assertEquals(Collections.singleton(table1), r.tables());
    assertEquals(Collections.EMPTY_SET, r.projections());
    assertEquals(Equality.createAttributeValue(table1id, "1"), r.condition());
    assertEquals(AliasMap.NO_ALIASES, r.aliases());
    assertEquals(Collections.singleton(type), nodeRel.variables());
    assertEquals("Fixed(<http://example.org/Class1>)",
        nodeRel.nodeMaker(type).toString());
  }
View Full Code Here

        nodeRel.nodeMaker(type).toString());
  }
 
  public void testFindMatch() {
    NodeRelation nodeRel = translate1("?x rdf:type ex:Class1", "engine/type-bridge.n3");
    Relation r = nodeRel.baseRelation();
    assertEquals(Collections.singleton(table1), r.tables());
    assertEquals(Collections.singleton(table1id), r.projections());
    assertEquals(Expression.TRUE, r.condition());
    assertEquals(AliasMap.NO_ALIASES, r.aliases());
    assertEquals(Collections.singleton(x), nodeRel.variables());
    assertEquals("URI(Pattern(http://example.org/res@@table1.id@@))",
        nodeRel.nodeMaker(x).toString());
  }
View Full Code Here

    assertNull(translate1("?x rdf:type ?x", "engine/type-bridge.n3"));
  }
 
  public void testConstraintInTripleMatch() {
    NodeRelation nodeRel = translate1("?x rdf:type ?x", "engine/object-uricolumn.n3");
    Relation r = nodeRel.baseRelation();
    assertEquals(Collections.singleton(table1), r.tables());
    assertTrue(r.condition() instanceof Equality)// Too lazy to check both sides
    assertEquals(AliasMap.NO_ALIASES, r.aliases());
    assertEquals(Collections.singleton(x), nodeRel.variables());
  }
View Full Code Here

  public void testMatchOneOfTwoPropertyBridges() {
    NodeRelation nodeRel = translate1(
        "ex:res1 rdf:type ex:Class1",
        "engine/simple.n3");
    Relation r = nodeRel.baseRelation();
    assertEquals(Collections.EMPTY_SET, r.projections());
    assertEquals(Equality.createAttributeValue(table1id, "1"), r.condition());
  }
View Full Code Here

    NodeRelation nodeRel = translate1(
        "ex:res1 rdf:type ex:Class1 . ex:res1 ex:foo ?foo",
        "engine/simple.n3");
    assertEquals(Collections.singleton(foo), nodeRel.variables());
    assertEquals("Literal(Column(T2_table1.foo))", nodeRel.nodeMaker(foo).toString());
    Relation r = nodeRel.baseRelation();
    assertEquals("Conjunction(" +
        "Equality(" +
            "AttributeExpr(@@T1_table1.id@@), " +
            "Constant(1@T1_table1.id)), " +
        "Equality(" +
            "AttributeExpr(@@T2_table1.id@@), " +
            "Constant(1@T2_table1.id)))",
        r.condition().toString());
  }
View Full Code Here

    assertEquals(2, nodeRel.variables().size());
    assertEquals("Literal(Column(T2_table1.foo))",
        nodeRel.nodeMaker(foo).toString());
    assertEquals("URI(Pattern(http://example.org/res@@T1_table1.id@@))",
        nodeRel.nodeMaker(x).toString());
    Relation r = nodeRel.baseRelation();
    assertEquals(Equality.createAttributeEquality(t1table1id, t2table1id),
        r.condition());
  }
View Full Code Here

TOP

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

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.