[Neo4j] neo4j-scala improvements

Peter Neubauer peter.neubauer at neotechnology.com
Fri Sep 9 15:21:30 CEST 2011


Very cool Christopher!

We are testing to pull in some of the bindings for Neo4j into the
manual - would it be possible, when things stabilize, to pull in the
Scala bindings to the Neo4j repo. build them and start documenting
some test cases so we can put them into there, too?

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Fri, Sep 9, 2011 at 8:10 AM, Christopher Schmidt
<fakod666 at googlemail.com> wrote:
> 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
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


More information about the User mailing list