[ 
https://issues.apache.org/jira/browse/TINKERPOP-3274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18154333#comment-18154333
 ] 

ASF GitHub Bot commented on TINKERPOP-3274:
-------------------------------------------

Cole-Greer commented on code in PR #3762:
URL: https://github.com/apache/tinkerpop/pull/3762#discussion_r4776996619


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AbstractAddVertexStepPlaceholder.java:
##########
@@ -55,6 +55,13 @@ protected String getDefaultLabel() {
 
     @Override
     public void setLabel(Object label) {
+        // An explicit empty label collection means "no label provided": leave 
the label unset so vertex
+        // creation applies the graph's LabelCardinality default (no labels 
under ZERO_OR_MORE), matching the
+        // concrete step and graph.addVertex(). Flipping userProvidedLabel 
here would instead materialize the
+        // default label.
+        if (label instanceof Collection && ((Collection<?>) label).isEmpty()) {
+            return;
+        }

Review Comment:
   I'm not sure I agree with this logic. It's sort of assuming that 
`setLabel()` will only be called once. We shouldn't try and reason about how 
this method may be called. Who knows what provider strategies might want to do 
with these steps.
   
   If we want to treat empty collections as "no label provided", then that 
needs to overwrite any existing label state in the step.
   
   Can we add additional tests showing cases where `setLabel()` gets called 
multiple times, some where `[]` is passed first, and others where its passed 
second.





> Add T.labels as an analogue for labels()
> ----------------------------------------
>
>                 Key: TINKERPOP-3274
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3274
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 4.0.0
>            Reporter: Cole Greer
>            Priority: Major
>
> Following the introduction of optional multilabel vertices to the TinkerPop 
> data model, and the corresponding introduction of a `labels()` step to 
> replace the old `label()` step, we should also introduce a new `T.labels` 
> token for complete symmetry.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to