Spring Data Rest project, how to create relationships

36 views
Skip to first unread message

Joel Spriggs

unread,
Aug 4, 2016, 2:21:56 AM8/4/16
to Neo4j
I'm building a little test app as a way to learn Angular and refresh myself on a lot of the Spring stack.  I have some minor experience with Neo4J, but the app idea has ground with a graph db like Neo4j.  

The idea is pretty simple, a ui to create characters and stories, and relate the characters to the stories and each other, map their individual versions of a story and create some graphs that show the character interactions to help write the overall narrative.

I've got nodes for the characters and stories easily enough and the Spring stack is great for giving me rest easy to use rest endpoints for the nodes themselves.  But I can't find any concrete examples of creating and maintaining the relationships between those nodes.  

For instance, in Cypher, I can relate a character to a story and tell that being's involvement to the story as a relationship property with:
match(p:Being ),(s:Story ) where id(p) = 7 and id(s) = 16 
create (p)-[r:TOOK_PART_IN{perspective:"I did not know Mr. Grey better than an acquaintance, though I knew others whom did.  
They were not made better because of their relationship with him."}]->(s) return r

Then with the mapping in Spring, the data I get back from the REST endpoint gives me my character and I can follow a link to get the stories that character is a part of.  I don't see a way though to post or put to add or remove the character from stories. 

I'm also only finding concrete examples in docs from Spring regarding nodes, not really with edges/relationships.  Can anyone supply anything like that?

I am fully aware that Neo4J has it's own REST interface, and that is basically what Spring is consuming as well.  The main purpose of this exercise is learning some new technology (Angular2/typescript) and refreshing my knowledge of the Spring stack, I'll be hunting through the Spring groups as well, but thought the Neo4j group may be able to shed some light on this.

Thanks!

Reply all
Reply to author
Forward
0 new messages