本文整理汇总了Java中org.neo4j.cypher.javacompat.ExecutionResult.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionResult.iterator方法的具体用法?Java ExecutionResult.iterator怎么用?Java ExecutionResult.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neo4j.cypher.javacompat.ExecutionResult
的用法示例。
在下文中一共展示了ExecutionResult.iterator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runQueryComplexResult
import org.neo4j.cypher.javacompat.ExecutionResult; //导入方法依赖的package包/类
public Map<String,List<Object>> runQueryComplexResult(NeoProfiler parent, String query, String...columns) {
HashMap<String,List<Object>> all = new HashMap<String,List<Object>>();
ExecutionEngine engine = new ExecutionEngine(parent.getDB());
List<Object> retvals = new ArrayList<Object>();
try ( Transaction tx = parent.getDB().beginTx() ) {
// log.info(query);
ExecutionResult result = engine.execute(query);
ResourceIterator<Map<String,Object>> rows = result.iterator();
while(rows.hasNext()) {
Map<String,Object> row = rows.next();
for(String col : columns) {
if(!all.containsKey(col)) all.put(col, new ArrayList<Object>());
all.get(col).add(row.get(col));
}
}
rows.close();
} // End try
return all;
}
示例2: ExecutionResultIterator
import org.neo4j.cypher.javacompat.ExecutionResult; //导入方法依赖的package包/类
public ExecutionResultIterator(ExecutionResult results, GraphDatabaseService graphdb) {
//this.results = results;
//System.out.println("In iterator constructor");
this.delegate = results.iterator();
this.graphdb = graphdb;
//this.transaction = tx;
//System.out.println(delegate.hasNext());
//System.out.println("constructor next:"+delegate.next());
//System.out.println(results.dumpToString());
//System.out.println(delegate.next().size());
}
示例3: execute
import org.neo4j.cypher.javacompat.ExecutionResult; //导入方法依赖的package包/类
public Iterable<T> execute(String query, Map<String, Object> params, final String column) {
final ExecutionResult result = engine.execute(query, params);
return new IterableResult<T>() {
final Iterator<Map<String, Object>> resultIterator = result.iterator();
@Override
public Statistics getStatistics() {
return new Statistics(result.getQueryStatistics());
}
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
public boolean hasNext() {
return resultIterator.hasNext();
}
public T next() {
Map<String, Object> row = resultIterator.next();
Object value = row.get(column);
@SuppressWarnings("unchecked")
T relationshipValue = (T) value;
if (getFirst() == null) {
setFirst(relationshipValue);
}
return relationshipValue;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
}