如何在Scala脚本中使用Gremlin?

时间:2017-11-22 22:30:06

标签: scala gremlin janusgraph

我正在尝试使用带有tinkerpop 3的scala脚本中的Janusgraph。我使用gremlin.scala库(https://github.com/mpollmeier/gremlin-scala)但是我收到有关HNil的错误(见下文)。如何在scala脚本和Janusgraph中使用gremlin?

import gremlin.scala._
import org.apache.commons.configuration.BaseConfiguration
import org.janusgraph.core.JanusGraphFactory
import org.apache.tinkerpop.gremlin.structure.Graph

object Janus {
  def main(args: Array[String]): Unit = {
    val conf = new BaseConfiguration()
    conf.setProperty("storage.backend","inmemory")
    val graph = JanusGraphFactory.open(conf)
    val v1 = graph.graph.addV("test")
  }
}

错误:(11,14)类路径中缺少符号'类型scala.ScalaObject'。 “trait shapeless.HNil”需要此符号。 确保在类路径中键入ScalaObject,并检查与-Ylog-classpath的冲突依赖项。 如果针对不兼容的scala版本编译'HNil.class',则完全重建可能会有所帮助。     val v1 = graph.graph.addV(“test”)

1 个答案:

答案 0 :(得分:0)

不确定scala脚本'的含义,但看起来你错过了许多(所有?)依赖项。你看过https://github.com/mpollmeier/gremlin-scala-examples/了吗?它包含janusgraph的示例设置。