當前位置: 首頁>>代碼示例>>Java>>正文


Java Expression.isTrue方法代碼示例

本文整理匯總了Java中de.fuberlin.wiwiss.d2rq.expr.Expression.isTrue方法的典型用法代碼示例。如果您正苦於以下問題:Java Expression.isTrue方法的具體用法?Java Expression.isTrue怎麽用?Java Expression.isTrue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在de.fuberlin.wiwiss.d2rq.expr.Expression的用法示例。


在下文中一共展示了Expression.isTrue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: applyFilter

import de.fuberlin.wiwiss.d2rq.expr.Expression; //導入方法依賴的package包/類
private List<NodeRelation> applyFilter(
		List<NodeRelation> nodeRelations, Expr filter, ExprList allFilters) {
    List<NodeRelation> result = new ArrayList<NodeRelation>();
    boolean convertable = true;
    for (NodeRelation nodeRelation: nodeRelations) {
    	// TODO: The transformation from Expr to Expression should happen in NodeRelation.select()
        Expression expression = TransformExprToSQLApplyer.convert(filter, nodeRelation);
        if (expression == null) {
        	// the expression cannot be transformed to SQL
            convertable = false;
        } else if (expression.isTrue()) {
        	// keep as is
        } else if (expression.isFalse()) {
            continue;	// skip
        } else {
        	nodeRelation = nodeRelation.select(expression);
        	if (nodeRelation.baseRelation().condition().isFalse()) continue;
        }
        result.add(nodeRelation);
    }
    if (convertable) {
    	log.debug("Removing converted filter: " + filter);
        allFilters.getList().remove(filter);
    } else {
    	log.debug("Filter could not be fully converted and is kept: " + filter);
    }
    return result;
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:29,代碼來源:TransformOpBGP.java

示例2: select

import de.fuberlin.wiwiss.d2rq.expr.Expression; //導入方法依賴的package包/類
public Relation select(Expression condition) {
	if (condition.isFalse()) return Relation.EMPTY;
	if (condition.isTrue()) return Relation.TRUE;
	// FIXME This is broken; we need to evaluate the expression, but we don't
	// have a ConnectedDB available here so we can't really do it
	return Relation.TRUE;
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:8,代碼來源:Relation.java

示例3: select

import de.fuberlin.wiwiss.d2rq.expr.Expression; //導入方法依賴的package包/類
public Relation select(Expression selectCondition) {
	if (selectCondition.isTrue()) {
		return this;
	}
	if (selectCondition.isFalse()) {
		return Relation.EMPTY;
	}
	return new RelationImpl(database, aliases, 
			condition.and(selectCondition), softCondition, joinConditions, 
			projections, isUnique, orderSpecs, limit, limitInverse);
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:12,代碼來源:RelationImpl.java

示例4: selectWithVariables

import de.fuberlin.wiwiss.d2rq.expr.Expression; //導入方法依賴的package包/類
/**
 * Creates a {@link NodeRelation} by applying a triple pattern
 * to the TripleRelation. If the triple contains variables, then
 * the variables will be bound to the corresponding values
 * in the resulting NodeRelation. {@link Node#ANY} will be
 * converted to a variable "subject", "predicate", "object"
 * depending on its position in the triple pattern.
 * 
 * For example, selecting (?x :name ?name) would produce a
 * NodeRelation with ?x bound to the subjects and ?name bound to the
 * objects of this TripleRelation.
 * 
 * TODO This is never called at the moment. Why!?
 * 
 * @param t A triple pattern involving variables
 * @return A NodeRelation over the variables occurring in the triple pattern 
 */
public TripleRelation selectWithVariables(Triple t) {
	// Select non-variable parts of the triple
	TripleRelation selected = selectTriple(t);
	
	// Replace Node.ANY with "subject", "predicate", "object"
	Node s = t.getSubject() == Node.ANY ? SUBJECT : t.getSubject();
	Node p = t.getPredicate() == Node.ANY ? PREDICATE : t.getPredicate();
	Node o = t.getObject() == Node.ANY ? OBJECT : t.getObject();
	
	// Collect variable names and their bound node makers 
	VariableConstraints nodeMakers = new VariableConstraints();
	nodeMakers.addIfVariable(s, nodeMaker(SUBJECT), baseRelation().aliases());
	nodeMakers.addIfVariable(p, nodeMaker(PREDICATE), baseRelation().aliases());
	nodeMakers.addIfVariable(o, nodeMaker(OBJECT), baseRelation().aliases());

	// Did the same variable occur more than once in the pattern, rendering it unsatisfiable?
	if (!nodeMakers.satisfiable()) {
		return TripleRelation.EMPTY;
	}
	
	MutableRelation mutator = new MutableRelation(selected.baseRelation());

	Expression constraint = nodeMakers.constraint();
	if (!constraint.isTrue()) {
		// Same variable occured more than once, so we add a constraint to the base relation 
		mutator.select(constraint);
	}
	
	mutator.project(nodeMakers.allProjections());
	return fromNodeRelation(new NodeRelation(
			mutator.immutableSnapshot(), nodeMakers.toMap()));
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:50,代碼來源:TripleRelation.java


注:本文中的de.fuberlin.wiwiss.d2rq.expr.Expression.isTrue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。