当前位置: 首页>>代码示例>>Java>>正文


Java ExecutionResult.iterator方法代码示例

本文整理汇总了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;
}
 
开发者ID:moxious,项目名称:neoprofiler,代码行数:27,代码来源:QueryRunner.java

示例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());
}
 
开发者ID:semr,项目名称:neo4jena,代码行数:14,代码来源:ExecutionResultIterator.java

示例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();
                }

            };

        }

    };

}
 
开发者ID:technige,项目名称:zerograph,代码行数:47,代码来源:IterableExecutor.java


注:本文中的org.neo4j.cypher.javacompat.ExecutionResult.iterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。