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

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

spmallette commented on code in PR #3483:
URL: https://github.com/apache/tinkerpop/pull/3483#discussion_r3553190675


##########
docs/src/upgrade/release-4.x.x.asciidoc:
##########
@@ -800,6 +887,37 @@ Kryo's default `Map` serializer because it extended 
`HashMap`, whereas in 4.x it
 serializer. As a result, Gryo-serialized `Tree` data written by 3.x cannot be 
read by 4.x and vice versa. The
 Gryo type registration id (`61`) is unchanged and 4.x-to-4.x Gryo round-trips 
correctly; this Gryo break is
 expected for the 4.0.0 major release.
+===== Multi-Label Support
+
+Providers declare their supported label cardinality via 
`Graph.Features.getLabelCardinality()`, which defaults to
+`LabelCardinality.ONE` (single label, immutable, the 3.x behavior). To support 
multi-label, return `ONE_OR_MORE` or
+`ZERO_OR_MORE` from this method.
+
+The `LabelCardinality` enum exposes `min()`, `max()`, and `supportsMutation()` 
for programmatic introspection of
+constraints. Constraint enforcement is handled by the 
`LabelCardinalityValidator` utility class, which providers may
+use directly or replace with their own validation logic tailored to their 
storage backend.
+
+Providers implementing multi-label must:
+
+- Store and return a `Set<String>` from `Element.labels()`
+- Implement `Element.addLabel(String, String...)` and 
`Element.dropLabel(String, String...)`
+- Ensure `hasLabel("a", "b")` uses OR semantics (matches vertices with label 
"a" or "b")
+- Serialize/deserialize the label set via the V4 GraphBinary format (which 
sends labels as a list)
+
+The default `elementMap()` and `valueMap()` implementations determine label 
output format solely from the
+`with("multilabel")` source option, not from the graph's `LabelCardinality`. 
This means a multi-label graph still
+returns a single label string from these steps unless `with("multilabel")` is 
explicitly configured. The intent is
+to eventually deprecate the single-string path entirely and always return 
labels as a set, aligning `elementMap()`
+and `valueMap()` with `labels()`. Until then, `with("singlelabel")` allows 
users to override a source-level
+`with("multilabel")` back to single-string output.
+
+Providers who want `elementMap()`/`valueMap()` to return the full label set by 
default (without requiring users to
+set `with("multilabel")`) should override `PropertyMapStep` and 
`ElementMapStep` to tie label output to their
+server-side label cardinality configuration. In that case, 
`with("singlelabel")` should still be respected as an
+explicit user override back to single-string output.
+
+Older serialization formats (GraphSON V1/V2/V3, Gryo) only support a single 
label and will silently use the value

Review Comment:
   More references to old serialization formats and the single label thing....





> 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)

Reply via email to