简体   繁体   English

在Neo4J / Scala中防止延迟评估

[英]Preventing lazy evaluation in Neo4J / Scala

I've written a DAO that performs a traversal using GraphDatabaseService.traversalDescription(), and maps the results into a data structure of the form Map[X, Map[Y, Seq[X]] . 我编写了一个DAO,该DAO使用GraphDatabaseService.traversalDescription()进行遍历,并将结果映射到Map[X, Map[Y, Seq[X]]形式的数据结构中。

I'm getting a NotInTransactionException when trying to evaluate the data structure later on. NotInTransactionException尝试评估数据结构时,出现NotInTransactionException

I've tried to use the toList method to force any ResourceIterators to eagerly evaluate. 我试图使用toList方法来强制任何ResourceIterators进行急切的评估。 I now have problems with NodeProxy. 我现在有NodeProxy的问题。

Any suggestions? 有什么建议么?

In order to materialise the Neo4J lazy data structures: 为了实现Neo4J惰性数据结构:

  • Iterables / Seqs required a .toList Iterables / Seqs需要一个.toList
  • Maps (at all depths) required a .toList.toMap 地图(所有深度)都需要一个.toList.toMap

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM