親愛的 Spring 社群,
我們很高興地宣佈,支援 Neo4j 的 Spring Data Graph 專案的第二個版本 (1.1.0.RELEASE) 現已釋出!
Spring Data Graph 於 2011 年 4 月首次公開發布後,我們主要專注於使用者反饋。
透過改進的工具相關文件和升級的 AspectJ 版本,我們解決了使用者報告的許多 AspectJ 問題。藉助最新的 STS 和 Eclipse,以及有望與 Idea11 相容,開發 Spring Data Graph 應用可以避免惱人的紅色波浪線。為了進一步簡化開發,我們還提供了 ant/ivy 的示例構建指令碼和 gradle 外掛。
當然,我們與 Neo4j 的開發保持同步,目前使用的是 Neo4j (1.4.1) 的最新穩定版本。
在 Neo4j 的過去幾個月開發中,改進的查詢支援(Cypher、Gremlin)是重要的方面之一。因此,我們努力在所有層面支援它。現在,可以從 Spring Data Graph Repositories、從 Neo4j-Template 執行 Cypher 查詢,也可以作為動態欄位註解的一部分以及透過引入的實體方法執行。Gremlin 指令碼也是如此。這種新的表達能力可以實現什麼?讓我們來看看。
例如,在一個倉庫中
public interface PersonRepository extends GraphRepository, NamedIndexRepository {
@Query("start team=(%team) match (team)-[:persons]->(member) return member")
Iterable findAllTeamMembers(@Param("team") Group team);
@Query(value = "g.v(team).out('persons')", type = QueryType.Gremlin)
Iterable findAllTeamMembersGremlin(@Param("team") Group team);
}
Neo4j Template API 進行了徹底的改進,使得方法更少,更專注。高階查詢結果處理能力(型別轉換、對映、單結果、處理器等)現在使用更流暢的 API 實現。這個新 API 適用於所有型別的查詢,無論是索引查詢、圖遍歷、Cypher 查詢還是 Gremlin 指令碼。
template.query("start n=(0) match n-->m return m", null).to(Node.class);
template.execute("g.v(0).out", null).to(Node.class);
template.lookup("relationship", "name", "rel1").to(String.class, new PropertyContainerNameConverter()).single();
template.traverse(referenceNode, traversalDescription).handle(new Handler<Path>() {
public void handle(Path value) {
final String name = (String) value.endNode().getProperty("name", "");
resultSet.add(name…