[
https://issues.apache.org/jira/browse/TINKERPOP-2226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17821895#comment-17821895
]
Cole Greer commented on TINKERPOP-2226:
---------------------------------------
Hi Waldemar, I'm glad you've brought this up. Adding proper multi-label support
in TinkerPop is something which has been on my mind for a while, although I
haven't quite found the time to fully develop any ideas yet. Multiple labels
are supported by several graph vendors (both TP and non-TP graphs), I would
like to see that extension added to the TP data model.
There are a few challenges involved with rolling out an update such as this
though. The first of which is that some level of backwards compatibility must
be maintained, this must be an optional feature for graph providers. Some
providers will likely prefer to stick with the current single label model.
There are quite a few areas which would need to be touched by this change. As
you mentioned already the Element class will need an update, but without
breaking the existing `label()` method for single-label users. Some
consideration may be needed for how `label()` should behave for a
multi-labelled, perhaps it returns the first label, or perhaps it should return
a concatenation of all labels. There is also an equivalent element class in all
of the gremlin language variants
(https://github.com/apache/tinkerpop/blob/a8f90ea959b0eb11a699f39d64ae274eb01e513d/gremlin-dotnet/src/Gremlin.Net/Structure/Element.cs,
https://github.com/apache/tinkerpop/blob/a8f90ea959b0eb11a699f39d64ae274eb01e513d/gremlin-go/driver/graph.go,
https://github.com/apache/tinkerpop/blob/a8f90ea959b0eb11a699f39d64ae274eb01e513d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js,
https://github.com/apache/tinkerpop/blob/a8f90ea959b0eb11a699f39d64ae274eb01e513d/gremlin-python/src/main/python/gremlin_python/structure/graph.py).
In addition to the element updates, there is the query language considerations
(how does a user interact with a multi-labelled graph through gremlin). For
this, I imagine that Neptune's existing multi-label gremlin extension
(https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html#feature-gremlin-differences-labels)
is a good starting point, but perhaps other choices should be considered as
well. For example should we prefer g.addV('person::employee') or
g.addV('person', 'employee')? We will also need to update both the label() and
hasLabel() steps accordingly
(https://github.com/apache/tinkerpop/blob/a8f90ea959b0eb11a699f39d64ae274eb01e513d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LabelStep.java).
TinkerGraph, as our reference implementation, should also be extended to handle
multiple labels. TinkerGraph support may be as simple as extending
TinkerElement
(https://github.com/apache/tinkerpop/blob/a8f90ea959b0eb11a699f39d64ae274eb01e513d/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerElement.java)
with the 'labels()' method and changing the label to be a Set, although there
may be additional considerations around things such as indices which I'm not
aware of currently.
In summary there are a lot of pieces which would need to be touched to complete
this change and it is a fairly large scope for a first time contributor,
however I think it would be a valuable addition to TinkerPop and I would be
happy to answer and questions and give guidance wherever possible.
If you are willing to push ahead with this, as there are several design
decisions required to proceed, the next step is to open a [DISCUSS] thread on
our developer maillist [email protected] (archive of past discussions:
https://lists.apache.org/[email protected]). The goal there
would be to initiate discussion on the broad design decisions (changes to the
Element interface, new behaviors of addV(), addE(), label(), hasLabel()
steps...) and build community consensus.
Let me know if you have any other questions and if you are still interested in
working on this.
Thanks,
Cole
> addLabel() and removeLabel() method of Java API is not exposed for Gremlin
> Language
> -----------------------------------------------------------------------------------
>
> Key: TINKERPOP-2226
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2226
> Project: TinkerPop
> Issue Type: Improvement
> Components: neo4j, python
> Affects Versions: 3.3.6
> Reporter: Ravindra Gupta
> Assignee: Cole Greer
> Priority: Major
>
> *labels(), addLabel(), and removeLabel() *methods of Neo4jVertex of Java API
> is not exposed or available for gremlin-server language. This method should
> be exposed to gremlin-server language.
> Thank you.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)