本文整理汇总了Java中org.eclipse.rdf4j.query.BindingSet.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java BindingSet.iterator方法的具体用法?Java BindingSet.iterator怎么用?Java BindingSet.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.rdf4j.query.BindingSet
的用法示例。
在下文中一共展示了BindingSet.iterator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: select
import org.eclipse.rdf4j.query.BindingSet; //导入方法依赖的package包/类
@Override
public CloseableIteration<BindingSet, QueryEvaluationException> select(Service service, Set<String> projectionVars, BindingSet bindings, String baseUri) throws QueryEvaluationException {
RepositoryConnection conn = endpoint.getConn();
try {
TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL, service.getSelectQueryString(projectionVars), baseUri);
Iterator<Binding> bIter = bindings.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
if (service.getServiceVars().contains(b.getName()))
query.setBinding(b.getName(), b.getValue());
}
TupleQueryResult qRes = query.evaluate();
return new InsertBindingsIteration(qRes, bindings);
} catch(Throwable e) {
throw new QueryEvaluationException(e);
} finally {
conn.close();
}
}
示例2: ask
import org.eclipse.rdf4j.query.BindingSet; //导入方法依赖的package包/类
@Override
public boolean ask(Service service, BindingSet bindings, String baseUri) throws QueryEvaluationException {
RepositoryConnection conn = endpoint.getConn();
try {
BooleanQuery query = conn.prepareBooleanQuery(QueryLanguage.SPARQL, service.getAskQueryString(), baseUri);
Iterator<Binding> bIter = bindings.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
if (service.getServiceVars().contains(b.getName()))
query.setBinding(b.getName(), b.getValue());
}
return query.evaluate();
} catch(Throwable e) {
throw new QueryEvaluationException(e);
} finally {
conn.close();
}
}
示例3: convert
import org.eclipse.rdf4j.query.BindingSet; //导入方法依赖的package包/类
@Override
protected BindingSet convert(BindingSet bIn) {
int bIndex = -1;
Iterator<Binding> bIter = bIn.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
String name = b.getName();
bIndex = Integer.parseInt(name.substring(name.lastIndexOf("_")+1));
}
return bindings.get(bIndex);
}
示例4: convert
import org.eclipse.rdf4j.query.BindingSet; //导入方法依赖的package包/类
@Override
protected BindingSet convert(BindingSet bIn) throws QueryEvaluationException {
QueryBindingSet res = new QueryBindingSet();
int bIndex = Integer.parseInt(bIn.getBinding(INDEX_BINDING_NAME).getValue().stringValue());
Iterator<Binding> bIter = bIn.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
if (b.getName().equals(INDEX_BINDING_NAME))
continue;
res.addBinding(b);
}
for (Binding bs : bindings.get(bIndex))
res.setBinding(bs);
return res;
}
示例5: convert
import org.eclipse.rdf4j.query.BindingSet; //导入方法依赖的package包/类
@Override
protected BindingSet convert(BindingSet bIn) {
QueryBindingSet res = new QueryBindingSet();
int bIndex = -1;
Iterator<Binding> bIter = bIn.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
String name = b.getName();
bIndex = Integer.parseInt(name.substring(name.lastIndexOf("_")+1));
res.addBinding(name.substring(0, name.lastIndexOf("_")), b.getValue());
}
res.addAll( bindings.get(bIndex));
return res;
}