Getting Started - Spring Data Neo4J vs. Neo4J API

412 views
Skip to first unread message

GraphGuru

unread,
Nov 14, 2012, 1:13:27 PM11/14/12
to ne...@googlegroups.com
I'm new to Neo4J and I want to work with it using Java.  I want to be able to create/update/delete Nodes, Relationships programmatically and to dynamically add/remove properties and relationships from nodes.

Three questions
  1. Is Spring Data Neo4J the way to go, or should I stick with the native Neo4J API?
  2. Is graph traversal via the traversal API recommended or is CYPHER replacing that API?
  3. Where can I get an up to date end-to-end Java tutorial? Seems like a lot of tutorials are outdated.




Michael Hunger

unread,
Nov 14, 2012, 4:40:35 PM11/14/12
to ne...@googlegroups.com
Depends, if you have an object domain model which you want to map to a graph or if a more procedural approach of doing the mapping would suit you better.
The core-api is better suited for really dynamic properties and relationships. in SDN you would use different domain types that you can project the nodes/rels to.

The tutorial in the manual is always up to date: http://docs.neo4j.org/chunked/milestone/tutorials-java-embedded.html (Or which tutorials did you mean with outdated?)

You can also stick to cypher which now has update functionality.

Usually we nowadays recommend cypher and see the Java API as a performance optimization.

Cheers

Michael

--
 
 

GraphGuru

unread,
Nov 25, 2012, 8:05:50 AM11/25/12
to ne...@googlegroups.com
Thank you.

I'll use Spring Data Neo4J because I have a domain model.  I'm having a hard time finding a complete example that can help me do the following:
  1. I'm running Neo4J as a Server instead of as an embedded server.
  2. I want to connect to the Neo4J server using Spring Data Neo4J and perform CRUD operations.  I've found out about SpringRestGraphDatabase but I can't find any example of how to configure/use it.

Is there a complete step-by-step tutorial available that shows full Java code and configuration details for connecting to a Neo4J server using Spring Data Neo4J SpringRestGraphDatabase?

Abdul Azeez Shaik

unread,
Nov 25, 2012, 9:56:04 AM11/25/12
to ne...@googlegroups.com
Hi,

You can find the documentations for configuration in 21st chapter of 'Good Relationships' doc, here is the link for the same, http://static.springsource.org/spring-data/data-neo4j/docs/2.1.0.RELEASE/reference/html/

Also, please find below the sample configuration,

<context:annotation-config />

<context:spring-configured />

    <!-- Neo4j configuration (creates Neo4jTemplate) -->

    <neo4j:config graphDatabaseService="graphDatabaseService"/>

    

    <!-- REST Connection to Neo4j server -->

    <bean class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase" id="graphDatabaseService">

<constructor-arg index="0" value="#{systemEnvironment['NEO4J_REST_URL']}"/>

<constructor-arg index="1" value="#{systemEnvironment['NEO4J_LOGIN']}"/>

<constructor-arg index="2" value="#{systemEnvironment['NEO4J_PASSWORD']}"/>

<!--<constructor-arg index="0" value="http://localhost:7474/db/data" />-->

    </bean>

    

<!-- Package w/ automatic repositories -->

<neo4j:repositories base-package="org.netvogue.server.neo4japi.repository" />

<context:component-scan base-package="org.netvogue.server.neo4japi"/>

<context:property-placeholder location="classpath*:*.properties"/>


Thanks,
Abdul

On Sun, Nov 25, 2012 at 6:35 PM, GraphGuru <unittes...@gmail.com> wrote:
I

GraphGuru

unread,
Dec 1, 2012, 1:10:34 PM12/1/12
to ne...@googlegroups.com
What is the name of the file and it's location where this configuration information should go?

Abdul Azeez Shaik

unread,
Dec 2, 2012, 5:23:28 AM12/2/12
to ne...@googlegroups.com
Hi,

You can add this part of applicationcontext.xml file or you can have separate configuration file specific to Neo4j like neo4j-applicationcontext.xml file and load this.

~Abdul


--
 
 

Reply all
Reply to author
Forward
0 new messages