本文整理汇总了Java中com.hp.hpl.jena.sparql.expr.ExprList类的典型用法代码示例。如果您正苦于以下问题:Java ExprList类的具体用法?Java ExprList怎么用?Java ExprList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExprList类属于com.hp.hpl.jena.sparql.expr包,在下文中一共展示了ExprList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transform
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的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;
}
示例2: transform
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的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;
}
示例3: createOpD2RQ
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的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;
}
示例4: parseTemplate
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
public static E_StrConcatPermissive parseTemplate(String str) {
ExprList args = new ExprList();
while (!str.isEmpty()) {
if (str.contains("{") && str.contains("}")) {
int openIdx = str.indexOf('{');
int closeIdx = str.indexOf('}');
int strLen = str.length();
if (openIdx > 0) {
args.add(NodeValue.makeString(str.substring(0, openIdx)));
}
String varName = str.substring(openIdx+1, closeIdx);
args.add(new ExprVar(Var.alloc(varName)));
str = str.substring(closeIdx+1, strLen);
} else {
args.add(NodeValue.makeString(str));
str = "";
}
}
return new E_StrConcatPermissive(args);
}
示例5: filter
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
@Override
public Table filter(ExprList expressions, Table table)
{
if ( debug )
{
Log.debug(this,"Restriction") ;
Log.debug(this,expressions.toString()) ;
dump(table) ;
}
QueryIterator iter = table.iterator(execCxt) ;
List<Binding> output = new ArrayList<Binding>() ;
for ( ; iter.hasNext() ; )
{
Binding b = iter.nextBinding() ;
if ( expressions.isSatisfied(b, execCxt) )
output.add(b) ;
}
return new TableN(new QueryIterPlainWrapper(output.iterator(), execCxt)) ;
}
示例6: joinWorker
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
private Table joinWorker(Table tableLeft, Table tableRight, boolean leftJoin, ExprList conditions)
{
// Conditional LeftJoin is (left, Filter(expr, Join(left, right)))
// This is done in matchRightLeft
// Have an iterator that yields one-by-one.
QueryIterator left = tableLeft.iterator(execCxt) ;
QueryIterConcat output = new QueryIterConcat(execCxt) ;
for ( ; left.hasNext() ; )
{
Binding b = left.nextBinding() ;
QueryIterator x = tableRight.matchRightLeft(b, leftJoin, conditions, execCxt) ;
if ( x == null )
continue ;
output.add(x) ;
}
tableLeft.close() ;
tableRight.close() ;
return new TableN(output) ;
}
示例7: compileElementOptional
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的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;
}
示例8: IRIrefOrFunction
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
final public Expr IRIrefOrFunction() throws ParseException {
String iri ; ExprList a = null ;
ExprList params = null ;
boolean distinct = false ;
iri = IRIref();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LPAREN:
case NIL:
a = ArgList();
break;
default:
jj_la1[163] = jj_gen;
;
}
if ( a == null )
{if (true) return asExpr(createNode(iri)) ;}
{if (true) return new E_Function(iri, a) ;}
throw new Error("Missing return statement in function");
}
示例9: VarOrFunction
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
final public Expr VarOrFunction() throws ParseException {
Var v ; ExprList a = null ;
v = Var();
Expr ev = new ExprVar(v) ;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LPAREN:
case NIL:
a = ExpressionList();
break;
default:
jj_la1[164] = jj_gen;
;
}
if ( a == null ) {if (true) return ev ;}
{if (true) return new E_FunctionDynamic(ev, a) ;}
throw new Error("Missing return statement in function");
}
示例10: evaluateBlockFilter
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
@Override
protected QueryIterator evaluateBlockFilter(Node graphNode, BasicPattern bgp, ExprList exprs, QueryIterator input) {
// XXX Do as quads.
Graph graph ;
// chooseGraph
if ( graphNode == null )
graph = dataset.getDefaultGraph() ;
else if ( Var.isVar(graphNode) )
throw new NotImplemented("OpExecutorMain.executeBlockFilter[Variable]") ;
else if ( graphNode == Node.ANY )
throw new NotImplemented("OpExecutorMain.executeBlockFilter[Node.ANY]") ;
else
graph = dataset.getGraph(graphNode) ;
return evaluateBlockFilter(graph, bgp, exprs, input);
}
示例11: evaluateBlockFilterSub
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
/** Execute for one input binding */
protected QueryIterator evaluateBlockFilterSub(DatasetGraphTDB dsgtdb, Node graphNode, BasicPattern bgp, ExprList exprs, Binding input1) {
Explain2.explain(Quack.quackExec, "%s, BGP =\n%s", graphNode, bgp) ;
PhysicalPlan<NodeId> plan = new PhysicalPlan<>() ;
bgp = Substitute.substitute(bgp, input1) ;
if ( exprs != null ) {
Op op ;
if ( graphNode == null )
op = TransformFilterPlacement.transform(exprs, bgp) ;
else
op = TransformFilterPlacement.transform(exprs, graphNode, bgp) ;
accumulatePlan(plan, graphNode, op);
} else {
accumulatePlan(plan, graphNode, bgp) ;
}
return executePlan$(plan, input1) ;
}
示例12: transform
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的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);
}
示例13: wrapInFilter
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
private void wrapInFilter(Op op, List<Expr> filters) {
if (filterExpr.isEmpty()) {
stack.push(op);
} else {
stack.push(OpFilter.filter(new ExprList(filters), op));
}
}
示例14: transform
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
@Override
public Op transform(OpBGP opBGP) {
if (transformFilters) {
return opBGP;
}
return createOpD2RQ(opBGP, new ExprList());
}
示例15: applyFilter
import com.hp.hpl.jena.sparql.expr.ExprList; //导入依赖的package包/类
private List<NodeRelation> applyFilter(
List<NodeRelation> nodeRelations, Expr filter, ExprList allFilters) {
List<NodeRelation> result = new ArrayList<NodeRelation>();
boolean convertable = true;
for (NodeRelation nodeRelation: nodeRelations) {
// TODO: The transformation from Expr to Expression should happen in NodeRelation.select()
Expression expression = TransformExprToSQLApplyer.convert(filter, nodeRelation);
if (expression == null) {
// the expression cannot be transformed to SQL
convertable = false;
} else if (expression.isTrue()) {
// keep as is
} else if (expression.isFalse()) {
continue; // skip
} else {
nodeRelation = nodeRelation.select(expression);
if (nodeRelation.baseRelation().condition().isFalse()) continue;
}
result.add(nodeRelation);
}
if (convertable) {
log.debug("Removing converted filter: " + filter);
allFilters.getList().remove(filter);
} else {
log.debug("Filter could not be fully converted and is kept: " + filter);
}
return result;
}