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


Java OpBGP类代码示例

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


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

示例1: buildBGP

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
private void buildBGP(OpBGP op) {
final List<Triple> triples = op.getPattern().getList();
for (final Triple triple : triples) {
    final Node subjectNode = triple.getSubject();
    final Node predicateNode = triple.getPredicate();
    final Node objectNode = triple.getObject();

    final String subject = PrefixUtil.collapsePrefix(FmtUtils
	    .stringForNode(subjectNode, prefixes));
    final String object = PrefixUtil.collapsePrefix(FmtUtils
	    .stringForNode(objectNode, prefixes));
    final String predicate = PrefixUtil.collapsePrefix(FmtUtils
	    .stringForNode(predicateNode, prefixes));

    if (bgp == null) {
	bgp = new ArrayList<TriplePattern>();
    }
    bgp.add(new TriplePattern(subject, predicate, object));
}
   }
 
开发者ID:aschaetzle,项目名称:S2X,代码行数:21,代码来源:SparkBGP.java

示例2: visit

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
/**
 * Visitor for the property path
 * @author Simon Skilevic
 */
@Override
public void visit(OpPath opPath) {
	// Path subject
	Node subject = opPath.getTriplePath().getSubject();
	// Path object
	Node object = opPath.getTriplePath().getObject();
	// Property path 
	Path tPath = opPath.getTriplePath().getPath();
	
	String stringPath = tPath.toString();
	ArrayList<String> pathsStr = TransformerHelper.findAllPossiblePathes(stringPath);
	int id=0;
	for (String path:pathsStr){
		BasicPattern pt = TransformerHelper.transformPathToBasicPattern(subject, path, object);
		OpBGP opBGP = new OpBGP(pt);
    	stack.push(new SqlBGP(opBGP, prefixes));
		id++;
		if (id>1) {
			 SqlOp rightOp = stack.pop();
		     SqlOp leftOp = stack.pop();
		     stack.push(new SQLUnion(null, leftOp, rightOp, prefixes));
		}
	}
	
}
 
开发者ID:aschaetzle,项目名称:S2RDF,代码行数:30,代码来源:AlgebraTransformer.java

示例3: transform

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的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

示例4: transform

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的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

示例5: visit

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
@Override
public void visit(OpBGP opBGP) {
	switch (format) {
	case PROPERTYTABLE:
		stack.push(new ImpalaBgpPropertyTable(opBGP, prefixes));
		break;
	case COMPLEX_PROPERTY_TABLE:
		stack.push(new ImpalaBgpComplexPropertyTable(opBGP, prefixes));
		break;
	case COMPLEX_PROPERTY_TABLE_SPARK:
		stack.push(new SparkBgpComplexPropertyTable(opBGP, prefixes));
		break;
	case SINGLETABLE:
		stack.push(new ImpalaBgpExtVPSingleTable(opBGP, prefixes));
		break;
	case EXTVP:
		stack.push(new ImpalaBgpExtVPMultiTable(opBGP, prefixes));
		break;
	}
}
 
开发者ID:aschaetzle,项目名称:Sempala,代码行数:21,代码来源:AlgebraTransformer.java

示例6: transform

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的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

示例7: prepareBindings

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(GraphQuery q, Node[] variables) {   
	this.variables = variables;
	this.indexes = new HashMap<Node,Integer>();
	for (int i = 0; i < variables.length; i++) {
		indexes.put(variables[i], new Integer(i));
	}
	BasicPattern pattern = new BasicPattern();
	for (Triple t: q.getPattern()) {
		pattern.add(t);
	}
	Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
	final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
	return new BindingQueryPlan() {
		public ExtendedIterator<Domain> executeBindings() {
			return queryIterator;
		}
	};
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:19,代码来源:D2RQQueryHandler.java

示例8: createOpD2RQ

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的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: prepareBindings

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(Query q, Node[] variables) {   
	this.variables = variables;
	this.indexes = new HashMap<Node,Integer>();
	for (int i = 0; i < variables.length; i++) {
		indexes.put(variables[i], new Integer(i));
	}
	BasicPattern pattern = new BasicPattern();
	for (Triple t: q.getPattern()) {
		pattern.add(t);
	}
	Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
	final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
	return new BindingQueryPlan() {
		public ExtendedIterator<Domain> executeBindings() {
			return queryIterator;
		}
	};
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:19,代码来源:D2RQQueryHandler.java

示例10: transform

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的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

示例11: transform

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的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

示例12: mergeToBGP

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
private Op mergeToBGP(Op left, Op right) {
	BasicPattern bgp = new BasicPattern();
	if (OpBGP.isBGP(left)) {
		bgp.addAll(((OpBGP) left).getPattern());
	} else {
		if (!(left instanceof OpTable))
		Log.warn(this, "mergeToBGP left not valid BGP " + left.toString());
	}
	if (OpBGP.isBGP(right)) {
		bgp.addAll(((OpBGP) right).getPattern());
		;
	} else {
		if (!(right instanceof OpTable))
		Log.warn(this, "mergeToBGP right not valid BGP"+ right.toString());
	}
	return new OpBGP(bgp);
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:18,代码来源:Simplifier.java

示例13: execute

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
@Override
protected QueryIterator execute(OpFilter opFilter, QueryIterator input)
{
    if ( ! isForThisExecutor )
        return super.execute(opFilter, input) ;
    
    Op sub = opFilter.getSubOp() ;
    
    // (filter (bgp ...))
    if ( OpBGP.isBGP(sub) )
    {
        OpBGP opBGP = (OpBGP)sub ;
        return evaluateBlockFilter(execCxt.getActiveGraph(), opBGP.getPattern(), opFilter.getExprs(), input) ;
    }
    
    // (filter (quadpattern ...))
    if ( sub instanceof OpQuadPattern )
    {
        OpQuadPattern quadPattern = (OpQuadPattern)sub ;
        return evaluateBlockFilter(quadPattern.getGraphNode(), quadPattern.getBasicPattern(), opFilter.getExprs(), input) ;
    }
    
    // TODO OpTable.
    return super.execute(opFilter, input) ;
}
 
开发者ID:afs,项目名称:quack,代码行数:26,代码来源:OpExecutorBlockFilter.java

示例14: prepareBindings

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
/**
 * <p>Method that prepares the bindings for a query plan</p>
 * @param q - the input query
 * @param variables - the variables in the given query
 * @return a binding query plan
 * 
 * @see de.fuberlin.wiwiss.d2rq.D2RQQueryHandler#prepareBindings(Query, Node[])
 */
@SuppressWarnings("unchecked")
public BindingQueryPlan prepareBindings(Query q, Node[] variables) 
{   
	this.variables = variables;
	this.indexes = new HashMap();
	for (int i = 0; i < variables.length; i++) { indexes.put(variables[i], new Integer(i)); }
	BasicPattern pattern = new BasicPattern();
	Iterator it = q.getPattern().iterator();
	while (it.hasNext()) 
	{
		Triple t = (Triple) it.next();
		pattern.add(t);
	}
	Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
	final ExtendedIterator queryIterator = new Map1Iterator(new BindingToDomain(), plan.iterator());
	return new BindingQueryPlan() 
	{
		public ExtendedIterator executeBindings() { return queryIterator; }
	};
}
 
开发者ID:vaibhavkhadilkar,项目名称:D2RQ-Update,代码行数:29,代码来源:D2RQRWQueryHandler.java

示例15: visit

import com.hp.hpl.jena.sparql.algebra.op.OpBGP; //导入依赖的package包/类
@Override
   public void visit(OpBGP opBGP) {
SparkBGP bgp = new SparkBGP(opBGP, prefixes);
/*
 * Add it twice. The first run will match the BGP and the second run
 * will build the result. This is done for the exact time measuring and
 * could basically done with one object but then without exact time
 * measuring.
 */
executionQueue.add(bgp);
executionQueue.add(bgp);
   }
 
开发者ID:aschaetzle,项目名称:S2X,代码行数:13,代码来源:AlgebraTranslator.java


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