本文整理了Java中org.apache.jena.query.ResultSet.nextBinding
方法的一些代码示例,展示了ResultSet.nextBinding
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.nextBinding
方法的具体详情如下:
包路径:org.apache.jena.query.ResultSet
类名称:ResultSet
方法名:nextBinding
[英]Move to the next binding (low level)
[中]移动到下一个绑定(低级别)
代码示例来源:origin: Galigator/openllet
/**
* {@inheritDoc}
*/
@Override
public Binding nextBinding()
{
_row++;
return _results.nextBinding();
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public Binding next() {
Binding result = rs.nextBinding();
return result;
}
代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache
@Override
public Binding next() {
Binding result = rs.nextBinding();
return result;
}
代码示例来源:origin: apache/jena
@Override
public Binding nextBinding() {
check() ;
return other.nextBinding() ;
}
代码示例来源:origin: apache/jena
@Override
public Binding nextBinding() {
return get().nextBinding();
}
代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-algebra
public static Set<Node> getResultSetCol(ResultSet rs, Var v) {
Set<Node> result = new HashSet<Node>();
while(rs.hasNext()) {
Binding binding = rs.nextBinding();
Node node = binding.get(v);
if(node != null) {
result.add(node);
}
}
return result;
}
代码示例来源:origin: apache/jena
@Override
public Binding peekBinding() {
if (this.hasPeeked()) {
return this.peeked;
} else if (this.canPeek()) {
this.peeked = this.results.nextBinding();
return this.peeked;
} else {
throw new NoSuchElementException();
}
}
代码示例来源:origin: com.github.galigator.openllet/openllet-jena
public SortedResultSet(final ResultSet results, final List<SortCondition> sortConditions)
{
resultVars = results.getResultVars();
sortedRows = new ArrayList<>();
while (results.hasNext())
sortedRows.add(results.nextBinding());
final BindingComparator cmp = new BindingComparator(sortConditions);
Collections.sort(sortedRows, cmp);
iterator = sortedRows.iterator();
row = 0;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Integer resultSetToInt(ResultSet rs, Var v) {
Integer result = null;
if (rs.hasNext()) {
Binding binding = rs.nextBinding();
Node node = binding.get(v);
NodeValue nv = NodeValue.makeNode(node);
result = nv.getInteger().intValue();
// TODO Validate that the result actually is int.
//result = node.getLiteral().
}
return result;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static <T> T accumulate(Agg<T> agg, ResultSet rs) {
Acc<T> acc = agg.createAccumulator();
while(rs.hasNext()) {
Binding binding = rs.nextBinding();
acc.accumulate(binding);
}
T result = acc.getValue();
return result;
}
代码示例来源:origin: SmartDataAnalytics/Sparqlify
public static void sparqlIntoView(ModelSparqlEndpoint sparqlEndpoint, String queryString, ViewTable viewTable)
throws SQLException
{
ResultSet rs = sparqlEndpoint.createQueryExecution(queryString).execSelect();
while(rs.hasNext()) {
Binding binding = rs.nextBinding();
viewTable.insert(binding);
}
}
代码示例来源:origin: apache/jena
public static void writeResultSet(TProtocol protocol, ResultSet resultSet, boolean encodeValues) {
List<Var> vars = Var.varList(resultSet.getResultVars()) ;
try ( Binding2Thrift b2t = new Binding2Thrift(protocol, vars, encodeValues) ) {
for ( ; resultSet.hasNext() ; ) {
Binding b = resultSet.nextBinding() ;
b2t.output(b) ;
}
}
//Done by Binding2Thrift.close() -- LibThriftRDF.flush(protocol) ;
}
代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache
public static Table createTable(ResultSet rs) {
List<Var> vars = VarUtils.toList(rs.getResultVars());
Table result = TableFactory.create(vars);
while(rs.hasNext()) {
Binding binding = rs.nextBinding();
result.addBinding(binding);
}
return result;
}
代码示例来源:origin: apache/jena
private void parseCSV(String x) {
byte[] b = StrUtils.asUTF8bytes(x);
ByteArrayInputStream in = new ByteArrayInputStream(b);
ResultSet rs2 = CSVInput.fromCSV(in);
while (rs2.hasNext()) {
rs2.nextBinding();
}
}
代码示例来源:origin: apache/jena
private void parseTSV(String x) {
byte[] b = StrUtils.asUTF8bytes(x);
ByteArrayInputStream in = new ByteArrayInputStream(b);
ResultSet rs2 = ResultSetFactory.fromTSV(in);
while (rs2.hasNext()) {
rs2.nextBinding();
}
}
代码示例来源:origin: apache/jena
private void parseJSON(String input) {
byte[] b = StrUtils.asUTF8bytes(input);
ByteArrayInputStream in = new ByteArrayInputStream(b);
ResultSet rs = ResultSetFactory.fromJSON(in);
while (rs.hasNext()) {
rs.nextBinding();
}
}
代码示例来源:origin: apache/jena
public static int count(String queryStr, DatasetGraph dsg) {
int counter = 0 ;
Query query = QueryFactory.create(queryStr, Syntax.syntaxARQ) ;
try (QueryExecution qExec = QueryExecutionFactory.create(query, DatasetFactory.wrap(dsg))) {
ResultSet rs = qExec.execSelect() ;
for ( ; rs.hasNext() ; ) {
rs.nextBinding() ;
counter++ ;
}
return counter ;
}
}
代码示例来源:origin: org.apache.jena/jena-tdb
public static int count(String queryStr, DatasetGraph dsg) {
int counter = 0 ;
Query query = QueryFactory.create(queryStr, Syntax.syntaxARQ) ;
try (QueryExecution qExec = QueryExecutionFactory.create(query, DatasetFactory.wrap(dsg))) {
ResultSet rs = qExec.execSelect() ;
for ( ; rs.hasNext() ; ) {
rs.nextBinding() ;
counter++ ;
}
return counter ;
}
}
代码示例来源:origin: apache/jena
private void testErr(String qsAgg, DatasetGraph ds, Syntax syntax) {
Query query = buildGroupBy(qsAgg, syntax) ;
try ( QueryExecution qExec = QueryExecutionFactory.create(query, DatasetFactory.wrap(ds)) ) {
ResultSet rs = qExec.execSelect() ;
assertTrue(rs.getResultVars().contains("X")) ;
Binding b = rs.nextBinding() ;
assertFalse(b.contains(Var.alloc("X"))) ;
}
}
代码示例来源:origin: apache/jena
private void testEmptyNoGroupBy(String qsAgg, DatasetGraph ds, Syntax syntax) {
Query query = buildNoGroupBy(qsAgg, syntax) ;
try ( QueryExecution qExec = QueryExecutionFactory.create(query, DatasetFactory.wrap(ds)) ) {
ResultSet rs = qExec.execSelect() ;
assertTrue(rs.hasNext()) ;
assertTrue(rs.getResultVars().contains("X")) ;
Binding b = rs.nextBinding() ;
assertFalse(b.contains(Var.alloc("X"))) ;
}
}
内容来源于网络,如有侵权,请联系作者删除!