Neo4j Scala (https://github.com/FaKod/neo4j-scala) has got some improvements
- Scala (non nested) Case Class de- serialization to or from a Neo4j Node
(see example)
- index convenience methods (see example)
- create and get Relation Objects, like val relation = start --> "foo" -->
end <;
It's still alpha, but worth to look at :-)
case class Test(s: String, i: Int, ji: java.lang.Integer, d: Double, l:
Long, b: Boolean)
object DeSerializingSpec extends Specification with Neo4jWrapper with
EmbeddedGraphDatabaseServiceProvider {
def neo4jStoreDir = "/tmp/temp-neo-test"
"Node" should {
"be serializable" in {
var o = Test("This is a String", 1, 2, 3.3, 10, true)
var node: Node = null
withTx {
implicit neo =>
node = createNode(o)
}
var oo = deSerialize[Test](node)
oo must beEqual(o)
}
}
}
object IndexTestSpec extends Specification with Neo4jWrapper with
EmbeddedGraphDatabaseServiceProvider with Neo4jIndexProvider {
def neo4jStoreDir = "/tmp/temp-neo-index-test"
override def NodeIndexConfig = ("MyTestIndex", Map("provider" -> "lucene",
"type" -> "fulltext")) :: Nil
"Neo4jIndexProvider" should {
"use the fulltext search index" in {
val nodeIndex = getNodeIndex("MyTestIndex").get
withSpatialTx {
implicit db =>
val theMatrix = createNode
val theMatrixReloaded = createNode
// add to index
nodeIndex += (theMatrix, "title", "The Matrix")
nodeIndex += (theMatrixReloaded, "title", "The Matrix Reloaded")
val found = nodeIndex.query("title", "reloAdEd")
found.size must beGreaterThanOrEqualTo(1)
// remove from index
nodeIndex -= theMatrix
nodeIndex -= theMatrixReloaded
}
}
}
}
--
Christopher
twitter: @fakod
blog: http://blog.fakod.eu
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user