[
https://issues.apache.org/jira/browse/TINKERPOP-3261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18092436#comment-18092436
]
ASF GitHub Bot commented on TINKERPOP-3261:
-------------------------------------------
spmallette commented on code in PR #3483:
URL: https://github.com/apache/tinkerpop/pull/3483#discussion_r3494528962
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java:
##########
@@ -3463,6 +3505,72 @@ public default GraphTraversal<S, E> drop() {
return this.asAdmin().addStep(new DropStep<>(this.asAdmin()));
}
+ /**
+ * Adds one or more labels to the current element. This is a side-effect
step that passes the
+ * element through unchanged.
+ *
+ * @param label the first label to add
+ * @param moreLabels additional labels to add
+ * @return the traversal with an appended {@link AddLabelStep}
+ * @since 4.0.0
+ */
+ public default GraphTraversal<S, E> addLabel(final String label, final
String... moreLabels) {
+ this.asAdmin().getGremlinLang().addStep(Symbols.addLabel, label,
moreLabels);
+ return this.asAdmin().addStep((AddLabelStep) new
AddLabelStep<>(this.asAdmin(), label, moreLabels));
+ }
+
+ /**
+ * Adds dynamically computed labels to the current element. This is a
side-effect step that passes the
+ * element through unchanged.
+ *
+ * @param labelTraversal the traversal that produces labels to add
Review Comment:
> the traversal that produces labels to add
labels plural? I assume it's not the case that we are going to iterate out
all the Strings this traversal produces right? it's just pulling the first one,
no? if not, i think that's an issue because that would cut against the `by`
rule. i'm not sure what that means though because then we have nothing
analogous to `addLabel(final String label, final String... moreLabels)` - not
quite as nice to do multiple `addLabel(Traversal)` which may get ugly if you're
trying to pick apart a list of labels. i dunno...not sure what we want to do
here.
> Enable multiple label support on vertex with configurable label cardinality
> ---------------------------------------------------------------------------
>
> Key: TINKERPOP-3261
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3261
> Project: TinkerPop
> Issue Type: Task
> Affects Versions: 4.0.0
> Reporter: Yang Xia
> Priority: Major
>
> Vertices are currently limited to a single immutable label assigned at
> creation. This prevents modeling common real-world scenarios where entities
> naturally belong to multiple categories (e.g., a person who is both an
> employee and a manager).
>
> Introduce a configurable LabelCardinality that controls how many labels a
> vertex may have and whether they can be mutated after creation. Three
> proposed modes: ONE (current behavior, default), ONE_OR_MORE (mutable,
> minimum one), ZERO_OR_MORE (fully flexible).
>
> New steps:
>
> - labels() — flatMap step emitting each label as a traverser
> - addLabel(String, String...) — add labels to a vertex
> - dropLabel(String, String...) — remove specific labels
> - dropLabels() — remove all labels
> Edge labels remain at cardinality ONE. The infrastructure would support
> future edge multi-label enablement without wire format changes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)