• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ExecutionContext类代码示例

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

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



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

示例1: exec

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
@Override
public QueryIterator exec(Binding binding, PropFuncArg argSubject,
		Node predicate, PropFuncArg argObject, ExecutionContext execCxt) {

	argSubject = Substitute.substitute(argSubject, binding);
	argObject = Substitute.substitute(argObject, binding);
	
	if(!argObject.getArg().isVariable()) {
		throw new ExprEvalException("Right hand side of tosh:targetContains must be a variable");
	}
	
	Node targetNode = argSubject.getArgList().get(0);
	Node shapesGraphNode = argSubject.getArgList().get(1);
	
	Model currentModel = ModelFactory.createModelForGraph(execCxt.getActiveGraph());
	Dataset dataset = new DatasetWithDifferentDefaultModel(currentModel, DatasetImpl.wrap(execCxt.getDataset()));

	Model model = dataset.getNamedModel(shapesGraphNode.getURI());
	Resource target = (Resource) model.asRDFNode(targetNode);

	Set<Node> focusNodes = new HashSet<Node>();
	SHACLUtil.addNodesInTarget(target, dataset, focusNodes);
	return new QueryIterExtendByVar(binding, (Var) argObject.getArg(), focusNodes.iterator(), execCxt);
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:25,代码来源:TargetContainsPFunction.java


示例2: execEvaluated

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
@Override
public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt) {
    Table table = getTable(predicate) ;
    if ( table == null ) {
        Log.warn(this,  "No table for "+SSE.str(predicate));
        return IterLib.noResults(execCxt) ;
    }
    
    if ( subject.isVariable() ) {
        if ( object.isVariable() )
            return execVarVar(binding, table, subject, object, execCxt) ;
        else
            return execVarTerm(binding, table, subject, object, execCxt) ;
    } else {
        if ( object.isVariable() )
            return execTermVar(binding, table, subject, object, execCxt) ;
        else
            return execTermTerm(binding, table, subject, object, execCxt) ;
    }
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:21,代码来源:PFbyTable.java


示例3: plainExecute

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
/** Execute without modification of the op - does <b>not</b> apply special graph name translations */
private static QueryIterator plainExecute(Op op, QueryIterator input, ExecutionContext execCxt)
{
    // -- Execute
    // Switch to a non-reordering executor
    // The Op may be a sequence due to TransformFilterPlacement
    // so we need to do a full execution step, not go straight to the SolverLib.

    ExecutionContext ec2 = new ExecutionContext(execCxt) ;
    ec2.setExecutor(plainFactory) ;

    // Solve without going through this executor again.
    // There would be issues of nested patterns but this is only a
    // (filter (bgp...)) or (filter (quadpattern ...)) or sequences of these.
    // so there are no nested patterns to reorder.
    return QC.execute(op, input, ec2) ;
}
 
开发者ID:LinkedDataFragments,项目名称:Client.Java,代码行数:18,代码来源:OpExecutorLDF.java


示例4: buildSyntax

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
private QueryIterator buildSyntax(QueryIterator input, Node nodeVar, String pattern, ExecutionContext execCxt)
{
    Var var2 = createNewVar() ; 
    // Triple patterns for   ?x rdfs:label ?hiddenVar
    ElementTriplesBlock elementBGP = new ElementTriplesBlock();
    Triple t = new Triple(nodeVar, RDFS.label.asNode(), var2) ;
    elementBGP.addTriple(t) ;
    
    // Regular expression for  regex(?hiddenVar, "pattern", "i") 
    Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
    
    ElementGroup elementGroup = new ElementGroup() ;
    elementGroup.addElement(elementBGP) ;
    elementGroup.addElement(new ElementFilter(regex)) ;
    // Compile it.
    // The better design is to build the Op structure programmatically,
    Op op = Algebra.compile(elementGroup) ;
    op = Algebra.optimize(op, execCxt.getContext()) ;
    return QC.execute(op, input, execCxt) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:21,代码来源:labelSearch.java


示例5: execFixedSubject

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
private QueryIterator execFixedSubject(Node nodeURI, Node nodeLocalname, Binding binding, ExecutionContext execCxt)
{
    if ( ! nodeURI.isURI() )
        // Subject bound but not a URI
        return QueryIterNullIterator.create(execCxt) ;

    // Subject is bound and a URI - get the localname as a Node 
    Node localname = NodeFactory.createLiteral(nodeURI.getLocalName()) ;
    
    // Object - unbound variable or a value? 
    if ( ! nodeLocalname.isVariable() )
    {
        // Object bound or a query constant.  Is it the same as the calculated value?
        if ( nodeLocalname.equals(localname) )
            // Same
            return QueryIterSingleton.create(binding, execCxt) ;
        // No - different - no match.
        return QueryIterNullIterator.create(execCxt) ;
    }
    
    // Object unbound variable - assign the localname to it.
    return QueryIterSingleton.create(binding, Var.alloc(nodeLocalname), localname, execCxt) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:24,代码来源:localname.java


示例6: execAllNodes

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
private QueryIterator execAllNodes(Var subjVar, Node nodeLocalname,  Binding input, ExecutionContext execCxt)
{
    if ( ! nodeLocalname.isVariable() )
    {
        if ( ! nodeLocalname.isLiteral() )
            // Not a variable, not a literal=> can't match
            return QueryIterNullIterator.create(execCxt) ;
    
        if( ! NodeUtils.isSimpleString(nodeLocalname) )
            return QueryIterNullIterator.create(execCxt) ;
    }
    
    //Set bindings = new HashSet() ;    // Use a Set if you want unique results. 
    List<Binding> bindings = new ArrayList<Binding>() ;   // Use a list if you want counting results. 
    Graph graph = execCxt.getActiveGraph() ;
    
    ExtendedIterator<Triple>iter = graph.find(Node.ANY, Node.ANY, Node.ANY) ;
    for ( ; iter.hasNext() ; )
    {
        Triple t = iter.next() ;
        slot(bindings, input, t.getSubject(),   subjVar, nodeLocalname) ;
        slot(bindings, input, t.getPredicate(), subjVar, nodeLocalname) ;
        slot(bindings, input, t.getObject(),    subjVar, nodeLocalname) ;
    }
    return new QueryIterPlainWrapper(bindings.iterator(), execCxt) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:27,代码来源:localname.java


示例7: execute

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
@Override
public QueryIterator execute(BasicPattern pattern, 
                             QueryIterator input,
                             ExecutionContext execCxt)
{
    // Just want to pick out some BGPs (e.g. on a particualr graph)
    // Test ::  execCxt.getActiveGraph() 
    if ( ! ( execCxt.getActiveGraph() instanceof GraphBase ) )
        // Example: pass on up to the original StageGenerator if
        // not based on GraphBase (which most Graph implementations are). 
        return other.execute(pattern, input, execCxt) ;
    
    System.err.println("MyStageGenerator.compile:: triple patterns = "+pattern.size()) ;

    // Stream the triple matches together, one triple matcher at a time. 
    QueryIterator qIter = input ;
    for (Triple triple : pattern.getList())
        qIter = new QueryIterTriplePattern(qIter, triple, execCxt) ;
    return qIter ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:21,代码来源:StageGeneratorAlt.java


示例8: eval1

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
/** One round of rule evaluation */
private static void eval1(Graph source, StreamTriple out, Rule rule) {
    BasicPattern pattern = BasicPattern.wrap(rule.getBody()) ;
    ExecutionContext execContext = new ExecutionContext(ARQ.getContext(), source, null, null) ; 
    // Create a chain of triple iterators.
    QueryIterator iter = match(source, pattern) ;
    iter.forEachRemaining(b->{
        Triple t = Substitute.substitute(rule.getHead(), b) ;
        if ( t.isConcrete() && ! source.contains(t) )
            out.triple(t);
    }) ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:13,代码来源:Forwards.java


示例9: match

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
/** Evaluate a BGP : encapsulate for a better/different version */  
private static QueryIterator match(Graph source, BasicPattern pattern) {
    ExecutionContext execContext = new ExecutionContext(ARQ.getContext(), source, null, null) ; 
    // Create a chain of triple iterators.
    QueryIterator chain = QueryIterSingleton.create(BindingFactory.root(), execContext) ; 
    for (Triple triple : pattern)
        chain = new QueryIterTriplePattern(chain, triple, execContext) ;
    return chain ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:10,代码来源:Forwards.java


示例10: QueryIterExtendByVar2

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
public QueryIterExtendByVar2(Binding binding, Var var1, Var var2, Iterator<Entry<Node,Node>> entries, ExecutionContext execCxt) {
    super(execCxt);
    if ( true ) { // Assume not too costly.
        if ( binding.contains(var1) )
            throw new ARQInternalErrorException("Var " + var1 + " already set in " + binding);
        if ( binding.contains(var2) )
            throw new ARQInternalErrorException("Var " + var2 + " already set in " + binding);
    }
    this.binding = binding;
    this.var1 = var1 ;
    this.var2 = var2 ;
    this.entries = entries;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:14,代码来源:PFbyTable.java


示例11: executeBGP

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
/** Execute a BGP (and filters) on a LDF graph, which may be in default storage or it may be a named graph */
private static QueryIterator executeBGP(LinkedDataFragmentGraph graph, OpBGP opBGP, QueryIterator input, ExprList exprs,
                                        ExecutionContext execCxt)
{
    // Execute a BGP on the real default graph
    return optimizeExecuteTriples(graph, input, opBGP.getPattern(), exprs, execCxt) ;
}
 
开发者ID:LinkedDataFragments,项目名称:Client.Java,代码行数:8,代码来源:OpExecutorLDF.java


示例12: execEvaluated

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
@Override
public QueryIterator execEvaluated(Binding binding, Node nodeURI, Node predicate, Node nodeLocalname, ExecutionContext execCxt)
{
    if ( ! nodeURI.isVariable() )
        return execFixedSubject(nodeURI, nodeLocalname, binding, execCxt) ;
    else
        return execAllNodes(Var.alloc(nodeURI), nodeLocalname, binding, execCxt) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:9,代码来源:localname.java


示例13: iterator

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
@Override
public QueryIterator iterator(ExecutionContext ctxt) {
	// QueryIteratorPlainWrapper doesn't close wrapped 
	// ClosableIterators, so we do that ourselves.
	final ClosableIterator<Binding> wrapped = rows();
	return new QueryIterPlainWrapper(wrapped, ctxt) {
		@Override
		protected void closeIterator() {
			super.closeIterator();
			wrapped.close();
		}
	};
}
 
开发者ID:tarql,项目名称:tarql,代码行数:14,代码来源:CSVTable.java


示例14: execute

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
@Override
         public QueryIterator execute(BasicPattern pattern, QueryIterator input,
		ExecutionContext execCxt) {
	return QueryIterBlockTriples.create(input, pattern, execCxt);
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:6,代码来源:CurrentThreadFunctionRegistry.java


示例15: exec

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
@Override
public QueryIterator exec(Binding binding, PropFuncArg argSubject,
		Node predicate, PropFuncArg argObject, ExecutionContext execCxt) {

	argSubject = Substitute.substitute(argSubject, binding);
	argObject = Substitute.substitute(argObject, binding);
	
	if(!argObject.getArg().isVariable()) {
		throw new ExprEvalException("Right hand side of tosh:exprEval must be a variable");
	}
	
	Node exprNode = argSubject.getArgList().get(0);
	Node focusNode = argSubject.getArgList().get(1);
	
	Model model = ModelFactory.createModelForGraph(execCxt.getActiveGraph());
	Dataset dataset = ARQFactory.get().getDataset(model);
	URI shapesGraphURI = URI.create("urn:x-topbraid:dummyShapesGraph");
	dataset.addNamedModel(shapesGraphURI.toString(), model);
	
	ShapesGraph[] shapesGraph = new ShapesGraph[1];
	
	NodeExpression n = NodeExpressionFactory.get().create(model.asRDFNode(exprNode));
	List<RDFNode> results = n.eval(model.asRDFNode(focusNode), new NodeExpressionContext() {
		
		@Override
		public URI getShapesGraphURI() {
			return shapesGraphURI;
		}
		
		@Override
		public ShapesGraph getShapesGraph() {
			if(shapesGraph[0] == null) {
				shapesGraph[0] = new ShapesGraph(model);
			}
			return shapesGraph[0];
		}
		
		@Override
		public Dataset getDataset() {
			return dataset;
		}
	});
	
	List<Node> nodes = new LinkedList<>();
	for(RDFNode rdfNode : results) {
		nodes.add(rdfNode.asNode());
	}

	return new QueryIterExtendByVar(binding, (Var) argObject.getArg(), nodes.iterator(), execCxt);
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:51,代码来源:EvalExprPFunction.java


示例16: BooleanQueryIterator

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
public BooleanQueryIterator(QueryIterator input, ExecutionContext ctx, Boolean answer) {
	super(input, ctx);
	this.answer = answer;
}
 
开发者ID:marklogic,项目名称:marklogic-jena,代码行数:5,代码来源:MarkLogicQueryEngine.java


示例17: TripleQueryIterator

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
public TripleQueryIterator(QueryIterator input, ExecutionContext execCxt, Iterator<Triple> triples) {
	super(input, execCxt);
	this.triples = triples;
}
 
开发者ID:marklogic,项目名称:marklogic-jena,代码行数:5,代码来源:MarkLogicQueryEngine.java


示例18: execVarVar

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
private QueryIterator execVarVar(Binding binding, Table table, Node subject, Node object,ExecutionContext execCxt) {
    Iterator<Entry<Node,Node>> iter = table.subj2obj.entries().iterator() ;
    return new QueryIterExtendByVar2(binding, Var.alloc(subject), Var.alloc(object), iter, execCxt) ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:5,代码来源:PFbyTable.java


示例19: execVarTerm

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
private QueryIterator execVarTerm(Binding binding, Table table, Node subject, Node object,ExecutionContext execCxt) {
    Collection<Node> x = table.obj2subj.get(object) ;
    return new QueryIterExtendByVar(binding, Var.alloc(subject), x.iterator(), execCxt) ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:5,代码来源:PFbyTable.java


示例20: execTermVar

import org.apache.jena.sparql.engine.ExecutionContext; //导入依赖的package包/类
private QueryIterator execTermVar(Binding binding, Table table, Node subject, Node object,ExecutionContext execCxt) {
    Collection<Node> x = table.subj2obj.get(subject) ;
    return new QueryIterExtendByVar(binding, Var.alloc(object), x.iterator(), execCxt) ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:5,代码来源:PFbyTable.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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