本文整理汇总了Java中com.hp.hpl.jena.sparql.algebra.op.OpFilter类的典型用法代码示例。如果您正苦于以下问题:Java OpFilter类的具体用法?Java OpFilter怎么用?Java OpFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OpFilter类属于com.hp.hpl.jena.sparql.algebra.op包,在下文中一共展示了OpFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的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);
}
}
示例2: createOpD2RQ
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的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;
}
示例3: compileElementOptional
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的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;
}
示例4: execute
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的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) ;
}
示例5: SparkFilter
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
public SparkFilter(OpFilter op, PrefixMapping prefixes) {
this.op = op;
expressions = new HashSet<>();
Iterator<Expr> iterator = op.getExprs().iterator();
while (iterator.hasNext()) {
Expr current = iterator.next();
ExprCompiler translator = new ExprCompiler(prefixes);
expressions.add(translator.translate(current));
}
}
示例6: transform
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
public Op transform(OpFilter opFilter, Op subOp) {
ExprList exprList = ExprList.splitConjunction(opFilter.getExprs());
ExprList cnfExprList = ExprList.splitConjunction(
TransformFilterCNF.translateFilterExpressionsToCNF(opFilter));
if (cnfExprList.size() > exprList.size()) {
return OpFilter.filter(cnfExprList, subOp);
}
return OpFilter.filter(exprList, subOp);
}
示例7: wrapInFilter
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
private void wrapInFilter(Op op, List<Expr> filters) {
if (filterExpr.isEmpty()) {
stack.push(op);
} else {
stack.push(OpFilter.filter(new ExprList(filters), op));
}
}
示例8: transform
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
@Override
public Op transform(OpFilter opFilter, Op subOp) {
if (!transformFilters || !(opFilter.getSubOp() instanceof OpBGP)) {
return super.transform(opFilter, subOp);
}
return createOpD2RQ((OpBGP) subOp, opFilter.getExprs());
}
示例9: transform
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
@Override
public Op transform(OpFilter opFilter, Op subOp) {
ExprList substitutedExprList = new ExprList();
for (Expr expr: opFilter.getExprs().getList()){
Map<String, Expr> substitutions = new HashMap<String, Expr>();
//for each expression see if it contains variables that are not mentioned within this clause
for (Var var: expr.getVarsMentioned()){
QueryVar mentionedQueryVar=this.mentionedVars.get(var);
if (mentionedQueryVar==null) {
//No mentioned variables so filter not relevant
return subOp;
}else
{
//Mentioned so add the new name to the substitutions set.
Var substitutedVar = Var.alloc(mentionedQueryVar.getLinkedName(this.queryClause.getDataset()));
substitutions.put(var.getName(), new ExprVar(substitutedVar));
}
}
//Only get here if all vars mentioned in expression are within clause
ExprTransformSubstitute exprTransformSubstitute = new ExprTransformSubstitute( substitutions );
Expr substitutedExpression = (Expr) ExprTransformer.transform(exprTransformSubstitute, expr);
substitutedExprList.add(substitutedExpression);
}
return OpFilter.filter(substitutedExprList, subOp);
}
示例10: visitFilter
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
@Override
protected void visitFilter(OpFilter op) {
if (op.getSubOp() != null)
op.getSubOp().visit(this);
op.visit(visitor);
}
示例11: visit
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
@Override
public void visit(OpFilter opFilter) {
executionQueue.add(new SparkFilter(opFilter, prefixes));
addExpressionsToBGP(opFilter.getExprs());
}
示例12: visit
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
@Override
public void visit(OpFilter opFilter) {
SqlOp subOp = stack.pop();
stack.push(new SqlFilter(opFilter, subOp, prefixes));
}
示例13: SqlFilter
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
public SqlFilter(OpFilter _opFilter, SqlOp _subOp,
PrefixMapping _prefixes) {
super(_subOp, _prefixes);
opFilter = _opFilter;
resultName = Tags.FILTER;
}
示例14: visit
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
public void visit(OpFilter opFilter) {
filter = opFilter.toString();
}
示例15: PigFilter
import com.hp.hpl.jena.sparql.algebra.op.OpFilter; //导入依赖的package包/类
public PigFilter(OpFilter _opFilter, PigOp _subOp, PrefixMapping _prefixes) {
super(_subOp, _prefixes);
opFilter = _opFilter;
resultName = Tags.FILTER;
}