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


Java Union类代码示例

本文整理汇总了Java中org.eclipse.rdf4j.query.algebra.Union的典型用法代码示例。如果您正苦于以下问题:Java Union类的具体用法?Java Union怎么用?Java Union使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Union类属于org.eclipse.rdf4j.query.algebra包,在下文中一共展示了Union类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectQueryStringBoundCheck

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
/**
 * Construct a SELECT query for a grouped bound check.
 * 
 * Pattern:
 * 
 * SELECT DISTINCT ?o_1 .. ?o_N WHERE { { s1 p1 ?o_1 FILTER ?o_1=o1 } UNION ... UNION { sN pN ?o_N FILTER ?o_N=oN }}
 * 
 * @param stmt
 * @param unionBindings
 * @return
 */
public static TupleExpr selectQueryStringBoundCheck(StatementPattern stmt, List<BindingSet> unionBindings) {
	
	Set<String> varNames = new HashSet<String>();
	
	Union union = new Union();
	union.setLeftArg(constructStatementCheckId(stmt, 0, varNames, unionBindings.get(0)) );
	Union tmp = union;
	int idx;
	for (idx=1; idx<unionBindings.size()-1; idx++) {
		Union _u = new Union();
		_u.setLeftArg( constructStatementCheckId(stmt, idx, varNames, unionBindings.get(idx)) );
		tmp.setRightArg(_u);
		tmp = _u;
	}
	tmp.setRightArg( constructStatementCheckId(stmt, idx, varNames, unionBindings.get(idx) ));
	
	ProjectionElemList projList = new ProjectionElemList();
	for (String var : varNames)
		projList.addElement( new ProjectionElem(var));
	
	Projection proj = new Projection(union, projList);

	return proj;
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:36,代码来源:QueryAlgebraUtil.java

示例2: constructInnerUnion

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
protected static Union constructInnerUnion(StatementPattern stmt, int outerID, Set<String> varNames, List<BindingSet> bindings) {
	
	Union union = new Union();
	union.setLeftArg(constructStatementId(stmt, outerID + "_0", varNames, bindings.get(0)) );
	Union tmp = union;
	int idx;
	for (idx=1; idx<bindings.size()-1; idx++) {
		Union _u = new Union();
		_u.setLeftArg( constructStatementId(stmt, outerID + "_" + idx, varNames, bindings.get(idx)) );
		tmp.setRightArg(_u);
		tmp = _u;
	}
	tmp.setRightArg( constructStatementId(stmt, outerID + "_" + idx, varNames, bindings.get(idx)));
	
	return union;
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:17,代码来源:QueryAlgebraUtil.java

示例3: meetNode

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
@Override
protected void meetNode(QueryModelNode node) {
	if (node instanceof StatementPattern) {
		meet((StatementPattern)node);
	} else if (node instanceof Filter) {
		meet((Filter)node);
	} else if (node instanceof Union) {
		meet((Union)node);
	} else if (node instanceof ExclusiveGroup) {
		meet((ExclusiveGroup)node);
	} else if (node instanceof NJoin) {
		meet((NJoin)node);
	} else {
		super.meetNode(node);
	}
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:17,代码来源:JoinOrderOptimizer.java

示例4: evaluateBinaryTupleOperator

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
/**
 * Evaluate {@link BinaryTupleOperator} query model nodes
 * @param parent
 * @param expr
 * @param bindings
 */
private void evaluateBinaryTupleOperator(BindingSetPipe parent, BinaryTupleOperator expr, BindingSet bindings) {
    if (expr instanceof Join) {
        evaluateJoin(parent, (Join) expr, bindings);
    } else if (expr instanceof LeftJoin) {
        evaluateLeftJoin(parent, (LeftJoin) expr, bindings);
    } else if (expr instanceof Union) {
        evaluateUnion(parent, (Union) expr, bindings);
    } else if (expr instanceof Intersection) {
        evaluateIntersection(parent, (Intersection) expr, bindings);
    } else if (expr instanceof Difference) {
        evaluateDifference(parent, (Difference) expr, bindings);
    } else if (expr == null) {
        parent.handleException(new IllegalArgumentException("expr must not be null"));
    } else {
        parent.handleException(new QueryEvaluationException("Unsupported binary tuple operator type: " + expr.getClass()));
    }
}
 
开发者ID:Merck,项目名称:Halyard,代码行数:24,代码来源:HalyardTupleExprEvaluation.java

示例5: evaluateUnion

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
/**
 * Evaluate {@link Union} query model nodes.
 * @param parent
 * @param union
 * @param bindings
 */
private void evaluateUnion(BindingSetPipe parent, Union union, BindingSet bindings) {
    BindingSetPipe pipe = new BindingSetPipe(parent) {
        AtomicInteger args = new AtomicInteger(2);
        @Override
        public boolean push(BindingSet bs) throws InterruptedException {
            if (bs == null) {
                if (args.decrementAndGet() == 0) {
                    return parent.push(null);
                } else {
                    return false;
                }
            } else {
                return parent.push(bs);
            }
        }
    };
    evaluateTupleExpr(pipe, union.getLeftArg(), bindings);
    evaluateTupleExpr(pipe, union.getRightArg(), bindings);
}
 
开发者ID:Merck,项目名称:Halyard,代码行数:26,代码来源:HalyardTupleExprEvaluation.java

示例6: meet

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
public void meet(Union theOp)
        throws Exception
{
    ctxOpen(theOp);

    String aLeft = renderTupleExpr(theOp.getLeftArg());
    if (aLeft.endsWith("\n")) {
        aLeft = aLeft.substring(0, aLeft.length() - 1);
    }

    String aRight = renderTupleExpr(theOp.getRightArg());
    if (aRight.endsWith("\n")) {
        aRight = aRight.substring(0, aRight.length() - 1);
    }

    mJoinBuffer.append(indent()).append("{\n").append(aLeft).append("\n").append(indent()).append("}\n").append(
            indent()).append("union\n").append(indent()).append("{\n").append(aRight).append("\n").append(
            indent()).append("}.\n");

    ctxClose(theOp);
}
 
开发者ID:semagrow,项目名称:semagrow,代码行数:26,代码来源:SPARQLTupleExprRenderer.java

示例7: getUnionPlan

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
public Collection<Plan> getUnionPlan(CompilerContext context, Collection<Plan> p1, Collection<Plan> p2) {

        if (p1.isEmpty())
            return p2;

        if (p2.isEmpty())
            return p1;

        //FIXME: try also ordered union merge
        //FIXME: check that pp1 and pp2 is in the same site or need shipping

        RequestedPlanProperties props = new RequestedPlanProperties();
        props.setSite(LocalSite.getInstance());

        return context.enforceProps(p1, props).stream().flatMap(pp1 ->
                context.enforceProps(p2, props).stream().flatMap(pp2 ->
                        Stream.of(context.asPlan(new Union(pp1, pp2)))
                )
        ).collect(Collectors.toList());
    }
 
开发者ID:semagrow,项目名称:semagrow,代码行数:21,代码来源:UnionBlock.java

示例8: meetNode

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
@Override
protected void meetNode(QueryModelNode node)
{
	if (node instanceof StatementTupleExpr) {
		nTriples++;
	} else if (node instanceof StatementPattern) {
		nTriples++;
	} else if (node instanceof Filter) {
		simple=false;
	} else if (node instanceof Union){
		simple=false;
	}
		
	super.meetNode(node);
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:16,代码来源:FedXService.java

示例9: selectQueryBoundUnion

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
/**
 * Construct a SELECT query expression for a bound union.
 * 
 * Pattern:
 * 
 * SELECT ?v_1 ?v_2 ?v_N WHERE { { ?v_1 p o } UNION { ?v_2 p o } UNION ... } 
 * 
 * Note that the filterExpr is not evaluated at the moment.
 * 
 * @param stmt
 * @param unionBindings
 * @param filterExpr
 * @param evaluated
 * 			parameter can be used outside this method to check whether FILTER has been evaluated, false in beginning
 * 
 * @return
 */
public static TupleExpr selectQueryBoundUnion( StatementPattern stmt, List<BindingSet> unionBindings, FilterValueExpr filterExpr, Boolean evaluated) {
	
	// TODO add FILTER expressions
	
	Set<String> varNames = new HashSet<String>();
	
	Union union = new Union();
	union.setLeftArg(constructStatementId(stmt, Integer.toString(0), varNames, unionBindings.get(0)) );
	Union tmp = union;
	int idx;
	for (idx=1; idx<unionBindings.size()-1; idx++) {
		Union _u = new Union();
		_u.setLeftArg( constructStatementId(stmt, Integer.toString(idx), varNames, unionBindings.get(idx)) );
		tmp.setRightArg(_u);
		tmp = _u;
	}
	tmp.setRightArg( constructStatementId(stmt, Integer.toString(idx), varNames, unionBindings.get(idx) ));
			
	ProjectionElemList projList = new ProjectionElemList();
	for (String var : varNames)
		projList.addElement( new ProjectionElem(var));
	
	Projection proj = new Projection(union, projList);

	return proj;
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:44,代码来源:QueryAlgebraUtil.java

示例10: meet

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
@Override
public void meet(Union union) {
	
	// retrieve the union arguments, also those of nested unions
	List<TupleExpr> args = new ArrayList<TupleExpr>();
	handleUnionArgs(union, args);
	
	// remove any tuple expressions that do not produce any result
	List<TupleExpr> filtered = new ArrayList<TupleExpr>(args.size());
	for (TupleExpr arg : args) {
		if (arg instanceof EmptyResult)
			continue;
		filtered.add(arg);
	}
	
	// create a NUnion having the arguments in one layer
	// however, check if we only have zero or one argument first
	if (filtered.size()==0) {
		union.replaceWith(new EmptyNUnion(args, queryInfo));
	}
	
	else if (filtered.size()==1) {
		union.replaceWith(filtered.get(0));
	}
	
	else {
		union.replaceWith( new NUnion(filtered, queryInfo) );			
	}
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:30,代码来源:UnionOptimizer.java

示例11: handleUnionArgs

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
/**
 * Add the union arguments to the args list, includes a recursion 
 * step for nested unions.
 * 
 * @param union
 * @param args
 */
protected void handleUnionArgs(Union union, List<TupleExpr> args) {
	
	if (union.getLeftArg() instanceof Union) {
		handleUnionArgs((Union)union.getLeftArg(), args);
	} else {
		args.add(union.getLeftArg());
	}
	
	if (union.getRightArg() instanceof Union) {
		handleUnionArgs((Union)union.getRightArg(), args);
	} else {
		args.add(union.getRightArg());
	}
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:22,代码来源:UnionOptimizer.java

示例12: meet

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
@Override
public void meet(Union union) {
	union.getLeftArg().visit(this);
	NodeDescriptor temp = current;
	reset();
	union.getRightArg().visit(this);
	if (temp.card == Long.MAX_VALUE || current.card == Long.MAX_VALUE) {
		current.card = Long.MAX_VALUE;
	} else {
		current.card += temp.card;
	}
	current.sel = Math.min(current.sel, temp.sel);
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:14,代码来源:JoinOrderOptimizer.java

示例13: meet

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
public void meet(Union theOp)
        throws Exception
{
    binaryOpMeet(theOp, theOp.getLeftArg(), theOp.getRightArg());
}
 
开发者ID:semagrow,项目名称:semagrow,代码行数:10,代码来源:ContextCollector.java

示例14: evaluateReactorInternal

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
public Flux<BindingSet> evaluateReactorInternal(TupleExpr expr, List<BindingSet> bindingList)
        throws QueryEvaluationException
{
    if (expr instanceof Plan)
        return evaluateReactorInternal(((Plan) expr).getArg(), bindingList);
    else if (expr instanceof Union)
        return evaluateReactorInternal((Union) expr, bindingList);
    else if (expr instanceof SourceQuery)
        return evaluateReactorInternal((SourceQuery) expr, bindingList);
    else
        return evaluateReactiveDefault(expr, bindingList);
}
 
开发者ID:semagrow,项目名称:semagrow,代码行数:13,代码来源:FederatedEvaluationStrategyImpl.java

示例15: union

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
private Collection<Plan> union(CompilerContext context, Plan p1, Plan p2)
{
    RequestedPlanProperties props = new RequestedPlanProperties();

    props.setSite(LocalSite.getInstance());

    Collection<Plan> pc1 = context.enforceProps(p1, props);
    Collection<Plan> pc2 = context.enforceProps(p2, props);

    return pc1.stream()
            .flatMap( s1 -> pc2.stream().map( s2 ->
                        context.asPlan(new Union(s1, s2))
            )).collect(Collectors.toList());
}
 
开发者ID:semagrow,项目名称:semagrow,代码行数:15,代码来源:PatternBlock.java


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