Hi!

This stuff looks awesome to me!

I added a Scala page in the wiki:
http://wiki.neo4j.org/content/Scala

Some of you may have to reload the page to get the syntax highlighting 
for the code snippet.

/anders

Martin Kleppmann wrote:
> On 14 Jun 2009, at 19:29, Emil Eifrem wrote:
>   
>>  b) Martin Kleppmann is writing a Scala wrapper that'll include a
>> JSON REST API. Plan is to release "soon" on github as per
>> http://twitter.com/martinkl/status/2123376390.
>>     
>
> I've pushed it out now :-) It comes in two parts:
>
> Template for new project, with examples of use:
> http://github.com/ept/neo4j-scala-template/tree/master
>
> Underlying Scala library for Neo4j:
> http://github.com/ept/neo4j-resources/tree/master
>
>   
>> I think adding a REST API to Neo4j is important for debugging, for
>> introspection and for tooling. But in a real application scenario, you
>> want to have a service layer that exposes domain oriented abstractions
>> rather than underlying representations on the wire. The only thing
>> that makes sense then is to roll your own REST layer (which speaks
>> "Persons" or "Orders" or "Companies" rather than Nodes and
>> Relationships). Your domain-oriented REST layer in turn interacts with
>> a domain layer that is implemented as usual by delegating to Neo4j.
>>     
>
> That's the approach I'm taking too. There are some simple cases where  
> an automatic mapping of Neo4j structures to REST is possible (e.g. a  
> node corresponds to an entity in a resource, with that node's  
> properties represented as fields in a JSON object, and special  
> structures for representing relationships). My library makes that  
> simple case really easy (3 lines of code, I think).
>
> More important are the cases where you want to do something more  
> complex -- twiddle a few relationships, run a traverser, pull the  
> results together in a form which makes sense in your application  
> domain, and make that available via a RESTful resource. The  
> application-specific parts obviously need to be wired up by you.  
> However, there is plenty of space for wrapper libraries to provide  
> tools and helpers which avoid you having to write too much boring and  
> hard to maintain boilerplate code.
>
> As a little taster, my Scala library includes a simplified way of  
> creating new relationships. For instance, instead of writing (in Java):
>
> RelationshipType knows = DynamicRelationshipType.withName("KNOWS");
> start.createRelationshipTo(intermediary, knows);
> intermediary.createRelationshipTo(end, knows);
>
> You can write (in Scala):
>
> start --| "KNOWS" --> intermediary --| "KNOWS" --> end
>
> (And it's statically typesafe, too.) That's just a taster. Take a look  
> and enjoy :)
>
> Martin
>
> _______________________________________________
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>   

_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to