当前位置: 首页>>代码示例>>Java>>正文


Java RelationBuilder.addCondition方法代码示例

本文整理汇总了Java中de.fuberlin.wiwiss.d2rq.parser.RelationBuilder.addCondition方法的典型用法代码示例。如果您正苦于以下问题:Java RelationBuilder.addCondition方法的具体用法?Java RelationBuilder.addCondition怎么用?Java RelationBuilder.addCondition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.fuberlin.wiwiss.d2rq.parser.RelationBuilder的用法示例。


在下文中一共展示了RelationBuilder.addCondition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:18,代码来源:ResourceMap.java

示例2: 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());
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:29,代码来源:CompatibleRelationGroupTest.java

示例3: 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));
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:30,代码来源:CompatibleRelationGroupTest.java


注:本文中的de.fuberlin.wiwiss.d2rq.parser.RelationBuilder.addCondition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。