本文整理汇总了Java中de.fuberlin.wiwiss.d2rq.parser.RelationBuilder类的典型用法代码示例。如果您正苦于以下问题:Java RelationBuilder类的具体用法?Java RelationBuilder怎么用?Java RelationBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RelationBuilder类属于de.fuberlin.wiwiss.d2rq.parser包,在下文中一共展示了RelationBuilder类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: relationBuilder
import de.fuberlin.wiwiss.d2rq.parser.RelationBuilder; //导入依赖的package包/类
public RelationBuilder relationBuilder(ConnectedDB database) {
RelationBuilder result = new RelationBuilder(database);
for (Join join: SQL.parseJoins(joins)) {
result.addJoinCondition(join);
}
for (String condition: conditions) {
result.addCondition(condition);
}
result.addAliases(aliases());
for (ProjectionSpec projection: nodeMaker().projectionSpecs()) {
result.addProjection(projection);
}
if (!containsDuplicates) {
result.setIsUnique(true);
}
return result;
}
示例2: buildRelation
import de.fuberlin.wiwiss.d2rq.parser.RelationBuilder; //导入依赖的package包/类
protected Relation buildRelation() {
ConnectedDB database = belongsToClassMap.database().connectedDB();
RelationBuilder builder = belongsToClassMap.relationBuilder(database);
builder.addOther(relationBuilder(database));
if (this.refersToClassMap != null) {
builder.addAliased(this.refersToClassMap.relationBuilder(database));
}
for (String pattern: dynamicPropertyPatterns) {
builder.addOther(new PropertyMap(pattern, belongsToClassMap.database()).relationBuilder(database));
}
if (this.limit!=null) {
builder.setLimit(this.limit.intValue());
}
if (this.limitInverse!=null) {
builder.setLimitInverse(this.limitInverse.intValue());
}
if (this.order!=null) {
builder.setOrderSpecs(Collections.singletonList(
new OrderSpec(new AttributeExpr(SQL.parseAttribute(this.order)), this.orderDesc.booleanValue())));
}
return builder.buildRelation();
}
示例3: buildRelation
import de.fuberlin.wiwiss.d2rq.parser.RelationBuilder; //导入依赖的package包/类
@Override
protected Relation buildRelation() {
Database db = belongsToClassMap == null ? database : belongsToClassMap.database();
RelationBuilder builder = relationBuilder(db.connectedDB());
builder.addProjection(contentDownloadColumn);
for (ProjectionSpec projection: getMediaTypeValueMaker().projectionSpecs()) {
builder.addProjection(projection);
}
if (belongsToClassMap != null) {
builder.addOther(belongsToClassMap.relationBuilder(db.connectedDB()));
}
return builder.buildRelation();
}
示例4: testCombineDifferentConditions
import de.fuberlin.wiwiss.d2rq.parser.RelationBuilder; //导入依赖的package包/类
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);
b2.addProjection(id);
b1.addCondition("TABLE.VALUE=1");
b2.addCondition("TABLE.VALUE=2");
CompatibleRelationGroup group = new CompatibleRelationGroup();
Relation r1 = b1.buildRelation();
Relation r2 = b2.buildRelation();
group.addBindingMaker(r1, bm);
assertTrue(group.isCompatible(r2));
group.addBindingMaker(r2, bm);
assertEquals(2, group.bindingMakers().size());
assertTrue(group.baseRelation().projections().contains(new ExpressionProjectionSpec(r1.condition())));
assertTrue(group.baseRelation().projections().contains(new ExpressionProjectionSpec(r2.condition())));
assertEquals(3, group.baseRelation().projections().size());
assertEquals(r1.condition().or(r2.condition()), group.baseRelation().condition());
assertEquals(group.bindingMakers().iterator().next().nodeMaker(Var.alloc("x")), x);
assertNotNull(group.bindingMakers().iterator().next().condition());
}
示例5: testCombineConditionAndNoCondition
import de.fuberlin.wiwiss.d2rq.parser.RelationBuilder; //导入依赖的package包/类
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);
b2.addProjection(id);
b1.addCondition("TABLE.VALUE=1");
CompatibleRelationGroup group = new CompatibleRelationGroup();
Relation r1 = b1.buildRelation();
Relation r2 = b2.buildRelation();
group.addBindingMaker(r1, bm);
assertTrue(group.isCompatible(r2));
group.addBindingMaker(r2, bm);
assertEquals(2, group.bindingMakers().size());
assertTrue(group.baseRelation().projections().contains(new ExpressionProjectionSpec(r1.condition())));
assertEquals(2, group.baseRelation().projections().size());
assertEquals(Expression.TRUE, group.baseRelation().condition());
Iterator<BindingMaker> it = group.bindingMakers().iterator();
BindingMaker bm3 = it.next();
BindingMaker bm4 = it.next();
assertTrue((bm3.condition() == null && bm4.condition() != null)
|| (bm3.condition() != null && bm4.condition() == null));
}