本文整理汇总了Java中org.openrdf.query.algebra.StatementPattern.getBindingNames方法的典型用法代码示例。如果您正苦于以下问题:Java StatementPattern.getBindingNames方法的具体用法?Java StatementPattern.getBindingNames怎么用?Java StatementPattern.getBindingNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.query.algebra.StatementPattern
的用法示例。
在下文中一共展示了StatementPattern.getBindingNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBindingNames
import org.openrdf.query.algebra.StatementPattern; //导入方法依赖的package包/类
public Set<String> getBindingNames() {
Set<String> bindingNames = Sets.newHashSet();
for(final StatementPattern sp: nodes) {
if(bindingNames.size() == 0) {
bindingNames = sp.getBindingNames();
} else {
bindingNames = Sets.union(bindingNames, sp.getBindingNames());
}
}
return bindingNames;
}
示例2: isValidStarQuery
import org.openrdf.query.algebra.StatementPattern; //导入方法依赖的package包/类
public static boolean isValidStarQuery(final Collection<StatementPattern> nodes) {
Set<String> bindings = null;
boolean contextSet = false;
Var context = null;
if(nodes.size() < 2) {
return false;
}
for(final StatementPattern sp: nodes) {
final Var tempContext = sp.getContextVar();
final Var predVar = sp.getPredicateVar();
//does not support variable context
if(tempContext != null && !tempContext.isConstant()) {
return false;
}
if(!contextSet) {
context = tempContext;
contextSet = true;
} else {
if(context == null && tempContext != null) {
return false;
} else if (context != null && !context.equals(tempContext)) {
return false;
}
}
if(!predVar.isConstant()) {
return false;
}
if(bindings == null ) {
bindings = sp.getBindingNames();
if(bindings.size() == 0) {
return false;
}
} else {
bindings = Sets.intersection(bindings, sp.getBindingNames());
if(bindings.size() == 0) {
return false;
}
}
}
return isBindingsetValid(bindings);
}