microsoft / spring-data-gremlin

We are in the process of deprecating Spring Data Gremlin. -- Provide generic annotation oriented programming form based on gremlin for graph database
Other
128 stars 76 forks source link

Getting Ids of connected edges #239

Closed haris-zynka closed 3 years ago

haris-zynka commented 4 years ago

Is it possible somehow, in domain models, to get parent ID inside of the child object by using edge and domain models. Example of full capability I wish was possible:

A { 
    String id;
   @FetchIdFromEdge(HasParent::parentId)
    String parentId; 
} 

B { 
    String id; 
   @FetchIdsFromEdge(HasParent::childId)
    List<String> children; 
} 

@Edge
HasParent { 
   @FromId
    String childId; 
   @EdgeFrom
    A child; 
   @ToId
    String parentId; 
   @EdgeTo
    B parent;
}

Hope this is clear enough by code.

If not, I'll try to explain here: when fetching Vertex which should always have some edge connecting it to parent object, it would be useful to have some form of automation where repository automatically fetches required edge and extracts just the ID of the other end. Same for the parent node, it would be nice to have list of child vertexes IDs. Possible way of doing it would be, I guess, to extend repository methods then manually write in on how to fetch the data and map it.

I guess this probably isn't possible with annotation but could you provide this feature? If there's a simple way around it by using Repository and having some custom made query it would be nice if someone could give an example.

superrdean commented 4 years ago

Thanks for your feedback, We will consider it, and give you a response later.

haris-zynka commented 4 years ago

Thanks for your feedback, We will consider it, and give you a response later.

Thanks, I tried to clear up question a bit. After I read it, it sounded confusing. Hope it's bit better now.

chenrujun commented 3 years ago

Closing this issue. Because it's not active for a long time. If anyone have similar issue, please create issue in new repo: https://github.com/Azure/azure-sdk-for-java/issues