本文整理汇总了Java中com.hp.hpl.jena.sparql.algebra.OpVars类的典型用法代码示例。如果您正苦于以下问题:Java OpVars类的具体用法?Java OpVars怎么用?Java OpVars使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpVars类属于com.hp.hpl.jena.sparql.algebra包,在下文中一共展示了OpVars类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: transform
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的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.OpVars; //导入依赖的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
示例3: visit
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的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
示例4: processFilterWorker
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的package包/类
private Op processFilterWorker(Expr e, Op subOp, Set<Var> patternVars) {
if ( patternVars == null )
patternVars = OpVars.visibleVars(subOp);
// Rewrites:
// FILTER ( ?x = ?y )
if ( !(e instanceof E_Equals) )
return null;
// Corner case: sameTerm is false for string/plain literal,
// but true in the graph for graphs with
ExprFunction2 eq = (ExprFunction2)e;
Expr left = eq.getArg1();
Expr right = eq.getArg2();
if ( left.isVariable() && right.isVariable() ) {
// Both must be used or else.
if ( patternVars.contains(left.asVar()) &&
patternVars.contains(right.asVar()) ) {
if (visitor.projectVars != null && !visitor.projectVars.contains(right.asVar()))
return subst(subOp, left.getExprVar(), right.getExprVar());
if (visitor.projectVars != null && !visitor.projectVars.contains(left.asVar()))
return subst(subOp, right.getExprVar(), left.getExprVar());
}
}
return null;
}
开发者ID:aschaetzle,项目名称:S2RDF,代码行数:30,代码来源:TransformFilterVarEquality.java
示例5: processFilterWorker
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的package包/类
private Op processFilterWorker(Expr e, Op subOp, Set<Var> patternVars) {
if ( patternVars == null )
patternVars = OpVars.visibleVars(subOp);
// Rewrites:
// FILTER ( ?x = ?y )
if ( !(e instanceof E_Equals) )
return null;
// Corner case: sameTerm is false for string/plain literal,
// but true in the graph for graphs with
ExprFunction2 eq = (ExprFunction2)e;
Expr left = eq.getArg1();
Expr right = eq.getArg2();
if ( left.isVariable() && right.isVariable() ) {
// Both must be used or else.
if ( patternVars.contains(left.asVar()) &&
patternVars.contains(right.asVar()) ) {
if (visitor.projectVars != null && !visitor.projectVars.contains(right.asVar()))
return subst(subOp, left.getExprVar(), right.getExprVar());
if (visitor.projectVars != null && !visitor.projectVars.contains(left.asVar()))
return subst(subOp, right.getExprVar(), left.getExprVar());
}
}
return null;
}
开发者ID:aschaetzle,项目名称:Sempala,代码行数:30,代码来源:TransformFilterVarEquality.java
示例6: BGPToTerm
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的package包/类
private Term BGPToTerm(OpBGP opBGP) {
new OpVars();
Set<Var> variables = OpVars.visibleVars(opBGP);
Term[] vAtom = new Term[variables.size()];
int index = 0;
for (Var variable : variables) {
vAtom[index] = termFactory.getVariable(globalQueryVars.indexOf(variable));
index++;
}
return termFactory.getFunctionalTerm(FUNCTIONALTERM_PREFIX, vAtom);
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:12,代码来源:RemediatorFederatedQuery.java
示例7: RemediatorQuery
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的package包/类
public RemediatorQuery(String queryString) {
super();
this.queryString = queryString;
this.originalQuery = QueryFactory.create(this.queryString);
this.originalOperations = Algebra.compile(this.originalQuery);
queryVars = new QueryVars(
OpVars.mentionedVars(this.originalOperations));
Simplifier simplifier = new Simplifier();
this.simplifiedOperations = Transformer.transform(simplifier, this.originalOperations);
//Create lookup for simplified operations
for(Triple triple:((OpBGP)this.simplifiedOperations).getPattern().getList()){
//TODO Should only put in relevant operations for this dataset.
simplifiedTriples.put(triple.hashCode(), triple);
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:16,代码来源:RemediatorQuery.java
示例8: runPlan
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的package包/类
private static void runPlan(Plan plan) {
//QueryExecUtils.execute(op, dsg)
List<String> vars = null ;
ResultsFormat outputFormat = ResultsFormat.FMT_TEXT ;
Op op = plan.getOp();
if ( op instanceof OpProject )
vars = Var.varNames(((OpProject)op).getVars()) ;
else
vars = Var.varNames(OpVars.visibleVars(op)) ;
ResultSet results = ResultSetFactory.create(plan.iterator(), vars) ;
QueryExecUtils.outputResultSet(results, null, outputFormat) ;
}
开发者ID:afs,项目名称:quack,代码行数:15,代码来源:RefactorQueryExecution.java
示例9: exec
import com.hp.hpl.jena.sparql.algebra.OpVars; //导入依赖的package包/类
private ResultSetRewindable exec(DatasetGraph ds, Op op) {
QueryIterator qIter = Algebra.exec(op, ds) ;
List<String> vars = Var.varNames(OpVars.visibleVars(op)) ;
ResultSetRewindable rs = ResultSetFactory.makeRewindable(new ResultSetStream(vars, null, qIter)) ;
return rs ;
}
开发者ID:afs,项目名称:quack,代码行数:7,代码来源:TestEngine.java
注:本文中的com.hp.hpl.jena.sparql.algebra.OpVars类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论