我想使用Scala与Neo4j的连接来设置Neo4j查询中的参数列表。我可以像这样在Neo4j-admin中设置参数列表:
{
"nodes": [
{
"id": 193331567,
"lat": 40.7599983215332,
"lon": -73.98999786376953
},
{
"id": 107475182,
"lat": 41.88999938964844,
"lon": -87.62000274658203
}
}
如何在Scala中定义这样的一组参数? 我试图将其定义为嵌套地图,但出现这样的错误:
Unable to convert scala.collection.immutable.$colon$colon to Neo4j Value.
这是定义参数的方式:
val paramsList = Map("nodes" -> {
data map { seq =>
Map(
"lat" -> seq(1).toDouble.asInstanceOf[AnyRef],
"lon" -> seq(2).toDouble.asInstanceOf[AnyRef],
"id" -> seq(0).toInt.asInstanceOf[AnyRef]
)
}}.asInstanceOf[AnyRef])
val queryResults = neo4jSession.run(searchQuery, paramsList.asJava)