Syncleus / Ferma

An ORM / OGM for the TinkerPop graph stack.
http://syncleus.com/Ferma
Apache License 2.0
136 stars 26 forks source link

Ability to add labels on Vertex #57

Open killje opened 5 years ago

killje commented 5 years ago

Labels are a integral part of tinkerpop graphs, with the option to add vertexes with g.addV(label).

With this issue I am asking on input on ways to make it a more integral part in this project. In the text below I go over why it is that I would like to see it added. The current way of doing it and some possible solutions to implement it.

Labels are used to distinguish between vertexes. While it is not needed for Ferma as you can use the class structure to distinguish between vertexes, it would be nice to have a easy way to set them so that programs that rely on the graph output can use these.

Currently you have to do it with framedGraph.addFramedVertex(new DefaultClassInitializer<>(className), T.label, labelName); and the recetlly added (#56) framedGraph.addFramedVertex(className, T.label, labelName);

I have made an attempt to have a better way to add these with annotations on the vertex class as labels are generally used to distinguish between types of nodes. This one is visible in a pull request on my own repo. But I am not yet convinced that this is the way to go. (this implementation is just a proof of concept and still needs a bit of work. Like checking if no label is given as argument when adding the vertex)

Some other ways that i have thought of was to add the function framedGraph.addV(className, labelName); To more closely mirror the Tinkerpop implementation.

The last options would be a breaking change that would split the current @GraphElement into two separate annotations, one being @GraphVertex and the other @GraphEdge, where GraphVertex has a optional label.

I would love to hear thoughts on this subject as I have to use labels in a project that I am currently working on. I therefore also have some time to spare to implement this into this library.

freemo commented 5 years ago

I'm not ignoring this. Just been getting surgery from which im recovering now. I will get to this soon I promise.

killje commented 5 years ago

No problem. Get well soon.

darius-sas commented 4 years ago

Hi, are there any updates on this? I am also interested in this :)

freemo commented 4 years ago

Hi, are there any updates on this? I am also interested in this :)

Sorry this went by the wayside. Let me review. I'd be willing to consider PR suggestions