FlorianHockmann commented on code in PR #2205:
URL: https://github.com/apache/tinkerpop/pull/2205#discussion_r1310135322


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ToUpperStep.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Reference implementation for toLower() step, a mid-traversal step which 
returns an upper case string representation

Review Comment:
   ```suggestion
    * Reference implementation for toUpper() step, a mid-traversal step which 
returns an upper case string representation
   ```



##########
docs/src/upgrade/release-3.7.x.asciidoc:
##########
@@ -29,7 +29,68 @@ complete list of all the modifications that are part of this 
release.
 
 === Upgrading for Users
 
+==== String Manipulation Steps
+Additional String manipulation steps have been added to this version: 
`asString()`, `length()`, `toLower()`, `toUpper()`.
 
+The following example demonstrates the use of a closure to perform the above 
functions:
+[source,text]
+----
+gremlin> g.V().hasLabel("person").values("age").map{it.get().toString()}
+==>29
+==>27
+==>32
+==>35
+gremlin> g.V().values("name").map{it.get().length()}
+==>5
+==>5
+==>3
+==>4
+==>6
+==>5
+gremlin> g.inject("TO", "LoWeR", "cAsE").map{it.get().toLowerCase()}
+==>to
+==>lower
+==>case
+gremlin> g.V().values("name").map{it.get().toUpperCase()}
+==>MARKO
+==>VADAS
+==>LOP
+==>JOSH
+==>RIPPLE
+==>PETER
+----
+With these additional steps this operation can be performed with standard 
Gremlin syntax:
+[source,text]
+----
+gremlin> g.V().hasLabel("person").values("age").asString()
+==>29
+==>27
+==>32
+==>35
+gremlin> g.V().values("name").length()
+==>5
+==>5
+==>3
+==>4
+==>6
+==>5
+gremlin> g.inject("TO", "LoWeR", "cAsE").toLower()
+==>to
+==>lower
+==>case
+gremlin> g.V().values("name").toUpper()
+==>MARKO
+==>VADAS
+==>LOP
+==>JOSH
+==>RIPPLE
+==>PETER
+----
+See: 
link:https://tinkerpop.apache.org/docs/x.y.z/reference/#asString-step[reference]

Review Comment:
   (nitpick) Maybe use different text for these links than just `reference` for 
every step? Like this, it only shows 4 links with the text "reference". How 
about "asString()-step" and so on?
   That's how it was done for `mergeV()` and `mergeE()`: 
https://github.com/apache/tinkerpop/blob/8eb1cf99d3393c35ad73c5516e6ac15697dcf973/docs/src/upgrade/release-3.6.x.asciidoc#mergev-and-mergee



##########
gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs:
##########
@@ -1932,6 +1950,24 @@ private GraphTraversal(ICollection<ITraversalStrategy> 
traversalStrategies, Byte
             Bytecode.AddStep("toE", args.ToArray());
             return Wrap<TStart, Edge>(this);
         }
+        
+        /// <summary>
+        ///     Adds the toLower step to this <see cref="GraphTraversal{SType, 
EType}" />.
+        /// </summary>
+        public GraphTraversal<TStart, string> ToLower ()
+        {
+            Bytecode.AddStep("toLower");
+            return Wrap<TStart, string>(this);
+        }
+        
+        /// <summary>
+        ///     Adds the toUpper step to this <see cref="GraphTraversal{SType, 
EType}" />.
+        /// </summary>
+        public GraphTraversal<TStart, string> ToUpper ()

Review Comment:
   and here:
   ```suggestion
           public GraphTraversal<TStart, string?> ToUpper ()
   ```



##########
docs/src/reference/the-traversal.asciidoc:
##########
@@ -4243,6 +4278,39 @@ 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gre
 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#toV-org.apache.tinkerpop.gremlin.structure.Direction-++[`toV(Direction)`],
 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/structure/Direction.html++[`Direction`]
 
+[[toLower-step]]
+=== ToLower Step
+
+The `toLower()`-step (*map*) returns the lower representation of incoming 
string traverser. Null values are not processed and remain as null when 
returned.
+If the incoming traverser is a non-String value then an 
`IllegalArgumentException` will be thrown.
+
+[gremlin-groovy,modern]
+----
+g.inject("HELLO", "wORlD", null).toLower()
+----
+
+*Additional References*
+
+link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#toLower--++[`toLower()`]
+
+[[toUpper-step]]
+=== ToUpper Step
+
+The `toUpper()`-step (*map*) returns the upper representation of incoming 
string traverser. Null values are not processed and remain as null when 
returned.
+If the incoming traverser is a non-String value then an 
`IllegalArgumentException` will be thrown.
+
+[gremlin-groovy,modern]
+----
+g.inject("hello", "wORlD", null).toUpper()
+g.V().values("name").toUpper() <1>
+----
+
+<1> Returns the upper case representation of all vertex names.
+
+*Additional References*
+
+link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#toLower--++[`toUpper()`]

Review Comment:
   ```suggestion
   
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#toUpper--++[`toUpper()`]
   ```



##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java:
##########
@@ -1437,6 +1441,57 @@ public default GraphTraversal<S, String> concat(final 
String... concatStrings) {
         return this.asAdmin().addStep(new ConcatStep<>(this.asAdmin(), 
concatStrings));
     }
 
+    /**
+     * Returns the value of incoming traverser as strings. Null values are 
returned as a string value "null".
+     *
+     * @return the traversal with an appended {@link AsStringStep}.
+     * @see <a 
href="http://tinkerpop.apache.org/docs/${project.version}/reference/#concat-step";
 target="_blank">Reference Documentation - Concat Step</a>

Review Comment:
   (nitpick) I think these links should not point to the reference docs of the 
_concat_ step, right?



##########
gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs:
##########
@@ -1932,6 +1950,24 @@ private GraphTraversal(ICollection<ITraversalStrategy> 
traversalStrategies, Byte
             Bytecode.AddStep("toE", args.ToArray());
             return Wrap<TStart, Edge>(this);
         }
+        
+        /// <summary>
+        ///     Adds the toLower step to this <see cref="GraphTraversal{SType, 
EType}" />.
+        /// </summary>
+        public GraphTraversal<TStart, string> ToLower ()

Review Comment:
   Same here:
   ```suggestion
           public GraphTraversal<TStart, string?> ToLower ()
   ```



##########
gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs:
##########
@@ -1115,6 +1124,15 @@ private GraphTraversal(ICollection<ITraversalStrategy> 
traversalStrategies, Byte
             Bytecode.AddStep("label");
             return Wrap<TStart, string>(this);
         }
+        
+        /// <summary>
+        ///     Adds the length step to this <see cref="GraphTraversal{SType, 
EType}" />.
+        /// </summary>
+        public GraphTraversal<TStart, int> Length ()

Review Comment:
   Sorry, but I didn't notice this during my first review of this PR: Since 
`length()` returns `null` as `null`, this should return `int?` instead of 
`int`. This communicates that this step can return either an `int` or `null`. 
(This of course also applies to `__.Length()`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to