本文整理汇总了Java中org.openrdf.query.algebra.TupleExpr.getBindingNames方法的典型用法代码示例。如果您正苦于以下问题:Java TupleExpr.getBindingNames方法的具体用法?Java TupleExpr.getBindingNames怎么用?Java TupleExpr.getBindingNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.query.algebra.TupleExpr
的用法示例。
在下文中一共展示了TupleExpr.getBindingNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVars
import org.openrdf.query.algebra.TupleExpr; //导入方法依赖的package包/类
/**
* Get the non-constant variables from a {@link TupleExpr}.
*
* @param node - The node to inspect for variables. (not null)
* @return The non-constant variables that were part of the node.
*/
private Set<String> getVars(final TupleExpr node) {
checkNotNull(node);
final Set<String> vars = Sets.newHashSet();
for(final String bindingName : node.getBindingNames()) {
if(!bindingName.startsWith("-const-")) {
vars.add(bindingName);
}
}
return vars;
}
示例2: getNonAggregationVariables
import org.openrdf.query.algebra.TupleExpr; //导入方法依赖的package包/类
public Set<String> getNonAggregationVariables(final String sparql) throws MalformedQueryException {
final TupleExpr te = new SPARQLParser().parseQuery(sparql, null).getTupleExpr();
bindingNames = te.getBindingNames();
te.visit(this);
return bindingNames;
}
示例3: evaluate
import org.openrdf.query.algebra.TupleExpr; //导入方法依赖的package包/类
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(
HashJoin join, BindingSet bindings) throws QueryEvaluationException {
// eval query if all sub operators are applied on same source
// TODO optimize with caching
Set<Graph> sources = new SourceCollector().getSources(join);
if (COLLECT_BGP_PATTERNS && sources.size() == 1)
return sendSparqlQuery(join, sources, bindings);
// assert join.getNumberOfArguments() > 0;
// TODO: support different join strategies
Set<String> resultVars = null;
CloseableIteration<BindingSet, QueryEvaluationException> joinCursor = null;
TupleExpr[] joinArgs = {join.getLeftArg(), join.getRightArg()};
for (TupleExpr joinArg : joinArgs) {
CloseableIteration<BindingSet, QueryEvaluationException> argCursor;
// if (MULTI_THREADED) {
// argCursor = fetchArgResults(joinArg, bindings);
// } else {
argCursor = evaluate(joinArg, bindings);
// }
// init binding names if this is the first argument for the join
if (joinCursor == null) {
joinCursor = argCursor;
resultVars = joinArg.getBindingNames();
// TODO: can constants vars be removed here?
if (LOGGER.isTraceEnabled())
LOGGER.trace("pattern bindings: " + resultVars);
continue;
}
// else create hash join (with left and right cursor and join vars)
Set<String> joinVars = new HashSet<String>(resultVars);
joinVars.retainAll(joinArg.getBindingNames());
// check for B-Node joins
for (String varName : joinVars) {
if (varName.startsWith("-anon"))
throw new UnsupportedOperationException("blank node joins are not supported");
}
// if (joinVars.size() == 0) {
// for (TupleExpr arg : join.getArgs()) {
// LOGGER.info("cross-prod ARG: " + OperatorTreePrinter.print(arg));
// }
// }
//
joinCursor = new HashJoinCursor(joinCursor, argCursor, joinVars);
resultVars.addAll(joinArg.getBindingNames());
// TODO: can constants vars be removed here?
if (LOGGER.isTraceEnabled())
LOGGER.trace("argument bindings: " + joinVars + "; join bindings: " + resultVars);
}
return joinCursor;
}