On 17 Jun 2009, at 01:07, djo mos wrote: > Impressive indeed :) Thanks! :)
> - why the --| and |-- ? I've played a bit with this on my part, and > finished > with something that looks like : > > an --> "manager" --> pn --> "stories" --> sn > pn <-- "managedBy" <-- an > > which in my taste is more readable :) It's simply a hack, I have to admit. Scala defines infix operator precedence on the basis of the first character of the operator (so that the syntax tree is unambiguous at parse time, where type information is not yet available). If you just use arrows as you have above, the first line works fine, but the second line is read as: pn <-- ("managedBy" <-- an) Which will not typecheck, because String does not have a <-- method. It also causes problems if you want to chain relationships. However, the pipe character has a lower precedence than the angle brackets, and thus parses in the desired way: (pn <-- "managedBy") |-- an And --| is defined simply to be symmetric with |--. > I think it's better (shortens and simplifies the code) to only keep > the methods with a RelationshipType parameter and define an implicit > conversion from a String to RelationshipType : > > implicit def stringToRelType(s : String) = > DynamicRelationshipType.withName(s) Sounds reasonable. Feel free to fork the repo, make the change and send me a pull request via GitHub. > - I've also added a wrapper around Node that simplifies reading/ > writing > properties : > > val pn: Node = n4j.createNode > pn("name")="djo" > pn("age") = 27 > println(pn("country")) > > (a simple matter of defining apply and update methods on the wrapper) Nice :) > - added a transactional block which statrts a transaction, and > depending on > the outcome of the body marks it as successful or failed: Actually I already have a way of doing this, which also avoids you having to directly access the EmbeddedNeo instance: NeoServer.exec { neo => val an = neo.createNode an("name") = "foo" an } Startup and shutdown happen automatically, and the path to the database is configured in neo4j.properties. Cheers Martin _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user