Tinkerpop Neo4j 密码查询不起作用
Tinkerpop Neo4j cypher queries not working
我有一个 neo4j 图(使用 gremlin 创建),我也想使用 Gremlin 使用它,但是,图上的密码查询似乎不起作用:
import org.apache.tinkerpop.gremlin
import gremlin.neo4j.structure.Neo4jGraph
import gremlin.tinkergraph.structure.TinkerGraph
import gremlin.hadoop.structure.HadoopGraph
import org.apache.commons.configuration.Configuration
trait Graph[G] {
def create(location: String, args: Configuration = null): G
}
object Grapher {
implicit val createNeo4j = new Graph[Neo4jGraph] {
def create(location: String, args: Configuration = null) =
if (args != null) Neo4jGraph.open(args) else Neo4jGraph.open(location)
}
implicit val createTinkerGraph = new Graph[TinkerGraph] {
def create(location: String, args: Configuration = null) =
if (args != null) TinkerGraph.open(args) else TinkerGraph.open()
}
implicit val createHadoopGraph = new Graph[HadoopGraph] {
def create(location: String, args: Configuration = null) =
if (args != null) HadoopGraph.open(args) else HadoopGraph.open(location)
}
}
object GraphSyntax {
def createGraph[G](location: String, args: Configuration = null)(implicit graph: Graph[G]) = graph.create(location, args)
}
这是我尝试执行查询的方式:
import Grapher._
import GraphSyntax._
val graph = createGraph[Neo4jGraph](fileName)
// org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph = neo4jgraph[community single [/media/ixaxaar/Source/src/telperion/core/neo4j.db]]
graph.cypher("match (n) return n limit 10").toList
// java.util.List[Nothing] = []
如果我将图表加载到 Neo4j 服务器中,相同的查询将在 neo4j 网络控制台上运行。
match (n) return n limit 10
我正在使用以下库:
final val Gremlin = "3.2.1"
final val Neo4jTinkerpop = "0.4-3.0.3"
val gremlinCore = "org.apache.tinkerpop" % "gremlin-core" % Version.Gremlin
val gremlinGiraph = "org.apache.tinkerpop" % "giraph-gremlin" % Version.Gremlin
val gremlinNeo4j = "org.apache.tinkerpop" % "neo4j-gremlin" % Version.Gremlin
val hadoopGremlin = "org.apache.tinkerpop" % "hadoop-gremlin" % Version.Gremlin
val tinkergraphGremlin = "org.apache.tinkerpop" % "tinkergraph-gremlin" % Version.Gremlin
val neo4jTinkerpop = "org.neo4j" % "neo4j-tinkerpop-api-impl" % Version.Neo4jTinkerpop
对此非常抱歉,结果我打开了一个新图表(fileName
不正确)。
scala> graph.cypher("match (n) return n limit 10").toList
res3: java.util.List[Nothing] = [{n=v[0]}, {n=v[1]}, {n=v[2]}, {n=v[3]}, {n=v[4]}, {n=v[5]}, {n=v[6]}, {n=v[7]}, {n=v[8]}, {n=v[9]}]
我有一个 neo4j 图(使用 gremlin 创建),我也想使用 Gremlin 使用它,但是,图上的密码查询似乎不起作用:
import org.apache.tinkerpop.gremlin
import gremlin.neo4j.structure.Neo4jGraph
import gremlin.tinkergraph.structure.TinkerGraph
import gremlin.hadoop.structure.HadoopGraph
import org.apache.commons.configuration.Configuration
trait Graph[G] {
def create(location: String, args: Configuration = null): G
}
object Grapher {
implicit val createNeo4j = new Graph[Neo4jGraph] {
def create(location: String, args: Configuration = null) =
if (args != null) Neo4jGraph.open(args) else Neo4jGraph.open(location)
}
implicit val createTinkerGraph = new Graph[TinkerGraph] {
def create(location: String, args: Configuration = null) =
if (args != null) TinkerGraph.open(args) else TinkerGraph.open()
}
implicit val createHadoopGraph = new Graph[HadoopGraph] {
def create(location: String, args: Configuration = null) =
if (args != null) HadoopGraph.open(args) else HadoopGraph.open(location)
}
}
object GraphSyntax {
def createGraph[G](location: String, args: Configuration = null)(implicit graph: Graph[G]) = graph.create(location, args)
}
这是我尝试执行查询的方式:
import Grapher._
import GraphSyntax._
val graph = createGraph[Neo4jGraph](fileName)
// org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph = neo4jgraph[community single [/media/ixaxaar/Source/src/telperion/core/neo4j.db]]
graph.cypher("match (n) return n limit 10").toList
// java.util.List[Nothing] = []
如果我将图表加载到 Neo4j 服务器中,相同的查询将在 neo4j 网络控制台上运行。
match (n) return n limit 10
我正在使用以下库:
final val Gremlin = "3.2.1"
final val Neo4jTinkerpop = "0.4-3.0.3"
val gremlinCore = "org.apache.tinkerpop" % "gremlin-core" % Version.Gremlin
val gremlinGiraph = "org.apache.tinkerpop" % "giraph-gremlin" % Version.Gremlin
val gremlinNeo4j = "org.apache.tinkerpop" % "neo4j-gremlin" % Version.Gremlin
val hadoopGremlin = "org.apache.tinkerpop" % "hadoop-gremlin" % Version.Gremlin
val tinkergraphGremlin = "org.apache.tinkerpop" % "tinkergraph-gremlin" % Version.Gremlin
val neo4jTinkerpop = "org.neo4j" % "neo4j-tinkerpop-api-impl" % Version.Neo4jTinkerpop
对此非常抱歉,结果我打开了一个新图表(fileName
不正确)。
scala> graph.cypher("match (n) return n limit 10").toList
res3: java.util.List[Nothing] = [{n=v[0]}, {n=v[1]}, {n=v[2]}, {n=v[3]}, {n=v[4]}, {n=v[5]}, {n=v[6]}, {n=v[7]}, {n=v[8]}, {n=v[9]}]