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


Java Op类代码示例

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


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

示例1: transform

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
@Override
public Op transform(OpFilter opFilter, Op subOp) {
    if ( ! (subOp instanceof OpBGP) )
        return super.transform(opFilter, subOp);

    ExprList exprs = opFilter.getExprs();
    Op op = subOp;
    // Variables set
    Set<Var> patternVars = OpVars.visibleVars(op);

    // Any assignments must go inside filters so the filters see the assignments.
    ExprList exprs2 = new ExprList();

    for (  Expr e : exprs.getList() ) {
        Op op2 = processFilterWorker(e, op, patternVars);
        if ( op2 == null )
            exprs2.add(e);
        else
            op = op2;
    }

    // Place any filter expressions around the processed sub op.
    if ( exprs2.size() > 0 )
        op = OpFilter.filter(exprs2, op);
    return op;
}
 
开发者ID:aschaetzle,项目名称:S2RDF,代码行数:27,代码来源:TransformFilterVarEquality.java

示例2: transform

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
@Override
public Op transform(OpBGP opBGP) {
    // if there are no more than 2 Triples -> reordering is useless
    if (opBGP.getPattern().size() <= 2) {
        return opBGP;
    }

    // Reorder by Selectivity
    ReorderFixed optimizer1 = (ReorderFixed) ReorderLib.fixed();
    BasicPattern optimizedPattern1 = optimizer1.reorder(opBGP.getPattern());

    // Reorder to avoid cross products and reduce the number of joins, if possible
    ReorderNoCross optimizer2 = new ReorderNoCross();
    BasicPattern optimizedPattern2 = optimizer2.reorder(optimizedPattern1);

    OpBGP optimizedBGP = new OpBGP(optimizedPattern2);
    return optimizedBGP;

    /*
    Heuristic variableCountingUnbound = new VariableCountingUnbound();
    BasicPatternGraph graph = new BasicPatternGraph(opBGP.getPattern(), variableCountingUnbound);
    BasicPattern optimizedPattern2 = graph.optimize();
    OpBGP optimizedBGP2 = new OpBGP(optimizedPattern2);
    return optimizedBGP2;
     */
}
 
开发者ID:aschaetzle,项目名称:S2RDF,代码行数:27,代码来源:BGPOptimizerNoStats.java

示例3: transform

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
@Override
public Op transform(OpBGP opBGP) {
    // if there are no more than 2 Triples -> reordering is useless
    if (opBGP.getPattern().size() <= 2) {
        return opBGP;
    }

    // Reorder by Selectivity
    ReorderFixed optimizer1 = (ReorderFixed) ReorderLib.fixed();
    BasicPattern optimizedPattern1 = optimizer1.reorder(opBGP.getPattern());

    // Reorder to avoid cross products and reduce the number of joins, if possible -> Multijoins
    ReorderNoCross optimizer2 = new ReorderNoCross();
    BasicPattern optimizedPattern2 = optimizer2.reorder(optimizedPattern1);

    OpBGP optimizedBGP = new OpBGP(optimizedPattern2);
    return optimizedBGP;

    /*
    Heuristic variableCountingUnbound = new VariableCountingUnbound();
    BasicPatternGraph graph = new BasicPatternGraph(opBGP.getPattern(), variableCountingUnbound);
    BasicPattern optimizedPattern2 = graph.optimize();
    OpBGP optimizedBGP2 = new OpBGP(optimizedPattern2);
    return optimizedBGP2;
     */
}
 
开发者ID:aschaetzle,项目名称:PigSPARQL,代码行数:27,代码来源:BGPOptimizerNoStats.java

示例4: transform

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
@Override
public Op transform(OpFilter opFilter, Op subOp) {
	if ( ! (subOp instanceof OpBGP) )
		return super.transform(opFilter, subOp);

	ExprList exprs = opFilter.getExprs();
	Op op = subOp;
	// Variables set
	Set<Var> patternVars = OpVars.visibleVars(op);

	// Any assignments must go inside filters so the filters see the assignments.
	ExprList exprs2 = new ExprList();

	for (  Expr e : exprs.getList() ) {
		Op op2 = processFilterWorker(e, op, patternVars);
		if ( op2 == null )
			exprs2.add(e);
		else
			op = op2;
	}

	// Place any filter expressions around the processed sub op.
	if ( exprs2.size() > 0 )
		op = OpFilter.filter(exprs2, op);
	return op;
}
 
开发者ID:aschaetzle,项目名称:Sempala,代码行数:27,代码来源:TransformFilterVarEquality.java

示例5: transform

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
@Override
public Op transform(OpBGP opBGP) {
	// if there are no more than 2 Triples -> reordering is useless
	if (opBGP.getPattern().size() <= 2) {
		return opBGP;
	}

	// Reorder by Selectivity
	ReorderFixed optimizer1 = (ReorderFixed) ReorderLib.fixed();
	BasicPattern optimizedPattern1 = optimizer1.reorder(opBGP.getPattern());

	// Reorder to avoid cross products and reduce the number of joins, if possible
	ReorderNoCross optimizer2 = new ReorderNoCross();
	BasicPattern optimizedPattern2 = optimizer2.reorder(optimizedPattern1);

	OpBGP optimizedBGP = new OpBGP(optimizedPattern2);
	return optimizedBGP;

	/*
	Heuristic variableCountingUnbound = new VariableCountingUnbound();
	BasicPatternGraph graph = new BasicPatternGraph(opBGP.getPattern(), variableCountingUnbound);
	BasicPattern optimizedPattern2 = graph.optimize();
	OpBGP optimizedBGP2 = new OpBGP(optimizedPattern2);
	return optimizedBGP2;
	 */
}
 
开发者ID:aschaetzle,项目名称:Sempala,代码行数:27,代码来源:BGPOptimizerNoStats.java

示例6: visit

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
/**
 * When visiting an OpFilter, all its filterconditions are collected during
 * the top-down-stepping. During the bottom-up-stepping all filterconditions
 * which were moved down, are removed
 */
public void visit(final OpFilter opFilter) {
	filterExpr.addAll(opFilter.getExprs().getList());
	Op subOp = null;
	if (opFilter.getSubOp() != null) {
		opFilter.getSubOp().visit(this);
		subOp = stack.pop();
	}
	opFilter.getExprs().getList().removeAll(filterExpr);
	// remove the filter if it has no expressions
	if (opFilter.getExprs().isEmpty()) {
		stack.push(subOp);
	} else {
		stack.push(opFilter);
	}
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:21,代码来源:PushDownOpFilterVisitor.java

示例7: wrapInCurrentFilterAndRecurse

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
private void wrapInCurrentFilterAndRecurse(Op2 op2) {
	List<Expr> retainedFilterExpr = new ArrayList<Expr>(filterExpr);
	filterExpr.clear();
	Op left = null;
	if (op2.getLeft() != null) {
		op2.getLeft().visit(this);
		left = stack.pop();
	}
	Op right = null;
	if (op2.getRight() != null) {
		op2.getRight().visit(this);
		right = stack.pop();
	}
	wrapInFilter(op2.apply(copy, left, right), retainedFilterExpr);
	filterExpr = retainedFilterExpr;
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:17,代码来源:PushDownOpFilterVisitor.java

示例8: createOpD2RQ

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
public Op createOpD2RQ(OpBGP opBGP, ExprList filters) {
    List<NodeRelation> tables = new GraphPatternTranslator(
    		opBGP.getPattern().getList(), mapping.compiledPropertyBridges(), 
    		useAllOptimizations).translate();
    
    if (useAllOptimizations) {
    	log.debug("NodeRelations before applying filters: " + tables.size());
    	ExprList copy = new ExprList(filters);
    	for (Expr filter: copy) {
    		tables = applyFilter(tables, filter, filters);
    	}
    	if (log.isDebugEnabled()) {
    		log.debug("NodeRelations after applying filters: " + tables.size());
    	}
    }
    
    Op op = OpUnionTableSQL.create(tables);
    if (!filters.isEmpty()) {
        op = OpFilter.filter(filters, op);
    }
    return op;
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:23,代码来源:TransformOpBGP.java

示例9: translate

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
/**
 * Method for translating an operator-tree. Move filter conditions as far as
 * possible down in the tree. In the optimal way, the filter conditions is
 * the parent of an OpBGP.
 */
private Op translate(Op op) {
	if (log.isDebugEnabled()) {
		log.debug("Before translation:\n" + PrintUtils.toString(op));
	}
	// Shape filter expressions to maximize opportunities for pushing them
	// down
	op = Transformer.transform(new TransformFilterCNF(), op);
	// Try to move any filters as far down as possible
	op = PushDownOpFilterVisitor.transform(op);
	// Translate BGPs that have a filter immediately above them
	op = Transformer.transform(new TransformOpBGP(mapping, true), op);
	// Translate BGPs that don't have a filter
	op = Transformer.transform(new TransformOpBGP(mapping, false), op);

	if (log.isDebugEnabled()) {
		log.debug("After translation:\n" + PrintUtils.toString(op));
	}
	return op;
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:25,代码来源:QueryEngineD2RQ.java

示例10: executeQuery

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
public String executeQuery() {

		Query query = QueryFactory.create(this.getQuery(), Syntax.syntaxARQ);

		Op op = Algebra.compile(query);

		try {
			
			if(new String("internal").equals(this.service)) {
				this.results = jenaService.runLocalOp(op);
			} else if (new String("external").equals(this.service)) {
				this.results = jenaService.runExternalOp(op);
			}

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return ("success");
	}
 
开发者ID:christoff-buerger,项目名称:reneviz,代码行数:21,代码来源:SparqlController.java

示例11: visit

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
@Override
public void visit(OpService opService) {
	Table input = pop();
	if (!input.isEmpty()) {
		
    	TableFactory tableFactory = new TableFactory();
    	ArrayList<Var>  vars= new ArrayList<Var>( OpVars.mentionedVars(opService));
    	//Table inputVars = TableFactory.create(input,vars);
    	Table inputVars = new TableFiltered(input,vars);
		
		Op op1 = OpSequence.create(opService.getSubOp(),
				OpTable.create(inputVars));
		opService = new OpService(opService.getService(), op1,
				opService.getSilent());
	}
	QueryIterator qIter = Service.exec(opService, ARQ.getContext());
	Table table = TableFactory.create(qIter);
	push(table);
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:20,代码来源:EvaluatorDispatch.java

示例12: transform

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
public Op transform(RemediatorQuery remediatorQuery) {
	if (OpBGP.isBGP(remediatorQuery.getSimplifiedOperations())) {
		{
			DatasetQueryVarLinksets linksetOpServices;
			originalClause = BGPToClause((OpBGP) remediatorQuery.getSimplifiedOperations());
			rewriteBGP(originalClause);
			voidModel.InferVariableClasses(globalQueryVars);
			globalQueryVars.locateDatasetClauses(datasets);
			linksetOpServices=linksets.createLinksetQueryClauses(globalQueryVars);

			if (optimize && ! voidModel.getPartitionStatisticsAvailable()){
				Log.warn(this, "Statistics not queried nor read so optimization of query plan not avaiable. Heuristic will be used instead");
				this.optimize=false;
			}
			queryPlan = new QueryPlan(globalQueryVars, optimize);
			//datasets.createDatasetQueryClauses(remediatorQuery, globalQueryVars);
			return createOpSequence(linksetOpServices);
		}
	} else {
		Log.warn(this, "Can only transform BGPs " + remediatorQuery.getSimplifiedOperations().toString());
		return null;
	}
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:24,代码来源:RemediatorFederatedQuery.java

示例13: transform

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
@Override
public Op transform(OpBGP opBGP) {
	
	OpBGP substitutedOp = new OpBGP();
	for (Triple triple : opBGP.getPattern().getList()) {
		if (simplifiedTriples.containsKey(triple.hashCode())) {
			Term rewrittenTerm = queryClause.getRewrittenTriple(triple
					.hashCode());
			if (rewrittenTerm != null) {
				Triple rewrittenTriple = queryClause.getDataset()
						.termToTriple(queryVars, rewrittenTerm);
				substitutedOp.getPattern().add(rewrittenTriple);
			}
		}
	}
	if(substitutedOp.getPattern().size()==0){
		return OpLabel.create(PRUNED ,null);
	}else
	{
		return substitutedOp;
	}
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:23,代码来源:Substituter.java

示例14: compileElementOptional

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
protected Op compileElementOptional(ElementOptional eltOpt, Op current) {
    Element subElt = eltOpt.getOptionalElement();
    Op op = compileElement(subElt);
    
    ExprList exprs = null;
    if (op instanceof OpFilter) {
        OpFilter f = (OpFilter)op;
        //f = OpFilter.tidy(f) ;  // Collapse filter(filter(..))
        Op sub = f.getSubOp();
        if (sub instanceof OpFilter)
            broken("compile/Optional/nested filters - unfinished") ; 
        exprs = f.getExprs();
        op = sub;
    }
    current = OpLeftJoin.create(current, op, exprs);
    return current;
}
 
开发者ID:KMax,项目名称:cqels,代码行数:18,代码来源:LogicCompiler.java

示例15: compileElementGroup

import com.hp.hpl.jena.sparql.algebra.Op; //导入依赖的package包/类
protected Op compileElementGroup(ElementGroup groupElt) {
    Op current = OpTable.unit();
    // First: get all filters, merge adjacent BGPs. This includes BGP-FILTER-BGP
    // This is done in finalizeSyntax after which the new ElementGroup is in
    // the right order w.r.t. BGPs and filters. 
    // This is a delay from parsing time so a printed query
    // keeps filters where the query author put them.
    
    List<Element> groupElts = finalizeSyntax(groupElt);

    // Second: compile the consolidated group elements.
    // Assumes that filters moved to end.
    for (Iterator<Element> iter = groupElts.listIterator(); iter.hasNext(); ) {
        Element elt = iter.next();
        current = compileOneInGroup(elt, current);
    }
    return current;
}
 
开发者ID:KMax,项目名称:cqels,代码行数:19,代码来源:LogicCompiler.java


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