请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Union类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: meet

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
@Override
public void meet(Union union) {
    union.getLeftArg().visit(this);

    if (condition)
        union.getRightArg().visit(this);
}
 
开发者ID:semagrow,项目名称:semagrow,代码行数:8,代码来源:BindJoinGenerator.java


示例17: meet

import org.eclipse.rdf4j.query.algebra.Union; //导入依赖的package包/类
@Override
public void meet(Union union) {
	hasUnion = true;
	super.meet(union);
}
 
开发者ID:dice-group,项目名称:CostFed,代码行数:6,代码来源:GenericInfoOptimizer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UpdateManager类代码示例发布时间:2022-05-16
下一篇:
Java EAPMD5Authenticator类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap