Roo プロジェクト

Neo4j Wiki から

目次

[edit] General

[edit] Goals

  • Functionally equivalent to JPA add-on
  • Integrates seamlessly with JPA add-on
  • Available by default
roo> install graph-persistence
roo> graph-persistence setup --provider neo4j ....

[edit] Open issues

  • How to handle bi-directionality
  • Explicit relationship type names
  • JTA / Spring transaction integration
  • API bundle
  • Maintenance going forward
  • Roo_Discussion

[edit] Where will the project live

The git repositories are

  • git://git.springsource.org/spring-data/data-commons.git
  • git://git.springsource.org/spring-data/datastore-graph.git
  • git://git.springsource.org/spring-data/datastore-cross-store.git
  • git://git.springsource.org/spring-data/datastore-graph-roo-addon.git

The POC code for cross store persistence is at

  • git://git.springsource.org/nosql/cross-store.git

[edit] Issue Tracking

JIRA issue tracking

[edit] Roo release dates

  • M2 end Jun
  • M3 end Jul
  • RC1 end Aug
  • RC2 end Sep
  • GA end Oct

[edit] What we want to achieve until 2010-06-04 lunch time

  • Platform transaction manager spike done
  • Roo add-on hacking (re)started
  • Initial batch of user stories defined
  • Polyglot persistence sample defined
  • Roo shell commands defined

[edit] JTA problems

[edit] Problems

  • Recovery scenario: how do we let the TransactionManager know how to recreate our XA resource

[edit] Goals

  • Branch1: Neo4j can participate in any JTA compliant TransactionManager
  • Branch2: Neo4j exposes its XA resources (f.ex. nioneo+lucene) as one resource so that a Spring tx manager (which uses 1PC) can be used. (Spring platform transaction manager)

[edit] Domain classes with Roo and Neo4j - IMDB

Starting at the developer:

  • What do I want to write to get Roo to interact with neo4j (and graphs in general).
  • ...in addition to that, what do I need to write to get it to work as I expect.

Let's use the IMDB example, where we have actors, movies and roles (actors which acts in movies). That model can be modeled in (at least) two ways: One where a role is represented by a relationship between an actor and a movie, and another where a role is a graph node itself in between actors and movies. Here we try to address both those models.

(A)--[STARS_AS]-->(R)--[ACTS_IN]-->(M)

[edit] What do I want to write?

class Actor { 
  String name;
  Collection<Role> roles;
}

class Movie { 
  String title;
  Date premiereDate; 
  Collection<Role> roles;
}

class Role { 
  String characterName; 
  Actor actor; 
  Movie movie;
}

[edit] What do I need to write to make it work as expected

@RooGraphEntity
@GraphEntity
class Actor

@RooGraphEntity
@GraphEntity
class Movie

@RooGraphEntity
@GraphEntity
class Role

Given the above code we would get a domain model (although not the one we intended). It would look something like:

(A)<-[ACTOR]---(R)--[MOVIE]-->(M)
  \            ^ \            ^ 
   --[ROLES]--/   --[ROLES]--/

To make it possible to infer relationship types we need to annotate either Role or Actor/Movie, like this:

@RooGraphEntity
@GraphEntity
class Actor {
  String name; 
  @Relationship(label="STARS_AS") 
  Collection<Role> roles;
}

@RooGraphEntity
@GraphEntity
class Movie {
  String title;
  Date premiereDate;
  @Relationship(label="ACTS_IN")
  Collection<Role> roles;
}

...or...

@RooGraphEntity
@GraphEntity
class Role {
  String characterName;
  @Relationship(label="STARS_AS", direction=INCOMING)
  Actor actor;
  @Relationship(label="ACTS_IN")
  Movie movie;
}

so that such information can be inferred elsewhere. It would be possible, but redundant, to annotate on both places.

[edit] The dense model

So how would the dense model be represented (the one where role is represented by the relationship between the actor and the movie)?

(A)--[ACTS_IN]-->(M)
@RooGraphEntity
@GraphEntity
class Actor {
  String name;
  Collection<Role> roles;
}

@RooGraphEntity
@GraphEntity
class Movie {
  String title;
  Date premiereDate;
  @Relationship(direction=INCOMING)
  Collection<Role> roles;
}

@RooGraphEntity
@GraphEntity(@Relationship(label="ACTS_IN"))
class Role {
  String characterName;
  Actor actor;
  Movie movie;
}
Neo4j のサイト
ツールボックス