gjrwebber / spring-data-gremlin

Spring data gremlin makes it easier to implement Graph based repositories. This module extends Spring Data to allow support for potentially any Graph database that implements the Tinkerpop Blueprints 2.x API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create repository for RelationshipEntity Objects

gjrwebber opened this issue · comments

We should be able to save, update, remove, query, etc on RelationshipEntity Objects.

This may already work, but requires some investigation to find out and add some test cases.

Hi Gjrwebber,
Saving for RelationshipEntity Objects, only save cascade when saving any NodeEntity Objects, which has properties as RelationshipEntity. I do not want to save cascade or load cascade, So should be create RelationshipRepository as in Spring Data Neo4j, or you can create OrientDBTemplate to do this task.

Hi Gjrwebber,
You can support me, implement for this issue. I need it to save a Link(Edge) independent as Vertex.

Hi Huy, I had a look at this, and I cannot see a way to create Edges without also linking them to vertices. The Tinkerpop API does not allow it and neither does OrientDB as far as I can see.

Not to mention it doesn't really make sense to have an edge without it linking to anything. It sounds like you should be using vertices instead. But I am no expert on Graph DBs, so take that with a grain of salt.

Maybe if you give me a use case I can understand why this is needed?

Example:
Vertex: A.
Edge: C (From A To A), C is not property of A.

If C is a property of A, then you can create , update, delete, query via A.
But at here I don't want C is a property of A. When I want to load, create, delete C must be via From A and To A. So should be Relationship Repository.

Ok, so you don't want the have C on it's own in the database, you just want to be able to CRUD without going through A. Is that correct?

That right.

I have created a branch feature/Issue_21 which I have added a simple test for finding all Located edges in the OrientDB test harness (85055b4).

When you run it you can see that the SimpleGremlinRepository is very Vertex centric. If you want to have a go at coming up with a GremlinRepository that handles Edges that would be great. You can find out from The GremlinSchema if it is a Vertex or Edge class by gremlinSchema.getSchemaType().

Thank you very much. Sorry for this inconvenience.

No worries mate. I appreciate your help and enthusiasm!

I still concert on this. I think should be add the feature for your source.
A example: if User(vertex) object has relationship is Friend(edge). if you do not separate the user vertex and the friend edge independence. when you get the user by Id you will get all friends (if friends list with amount are trillion, it is so large, I think difficultly to handle data). Addition you are very hard to update, delete, query Friends for User.

In above example if relationship Friend is not property of User, you can not create a Friend relationship to database.

@buiminhhuy would #27 solve this?

May be solve. But not optimize. Thanks