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

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

vkagamlyk commented on code in PR #1843:
URL: https://github.com/apache/tinkerpop/pull/1843#discussion_r1114680661


##########
gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js:
##########
@@ -131,17 +131,30 @@ Given(/^using the parameter (.+) defined as "(.+)"$/, 
function (paramName, strin
   });
 });
 
+var removeProperties = function(p) {
+  if (p === undefined) {   
+  } else if (p instanceof graphModule.Vertex || p instanceof graphModule.Edge) 
{
+    p.properties = undefined;
+  } else if (p instanceof Array) {
+    p.forEach(removeProperties)
+  } else if (p instanceof Map) {
+    removeProperties(Array.from(p.keys()))
+    removeProperties(Array.from(p.values()))
+  } else if (p instanceof graphModule.Path) {
+    removeProperties(p.objects)
+  }
+
+  return p
+}
+
 When('iterated to list', function () {
-  return this.traversal.toList().then(list => this.result = list).catch(err => 
this.result = err);
+  return this.traversal.toList().then(list => this.result = 
removeProperties(list)).catch(err => this.result = err);

Review Comment:
   This issue is related to the internal representation of the data in JS 
client.
   
   When data comes in GraphSON, when properties is stored as Object where key 
is property name and value are array of properties, like described in GraphSON 
specification. To get property used code `age = vertex.properties.age[0]`.
   
   For GraphBinary used simple array `property[]`. To get same property `age = 
vertex.properties[1]`





> Properties on Elements
> ----------------------
>
>                 Key: TINKERPOP-2824
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2824
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: dotnet, driver, go, javascript, process, python
>    Affects Versions: 3.5.4
>            Reporter: Valentyn Kahamlyk
>            Assignee: Valentyn Kahamlyk
>            Priority: Major
>
> Problem: When a user writes `g.V()` they get back a Vertex object. The 
> problem is that depending on the execution context of the traversal, the 
> result could be quite different, with or without properties.
> Solution: Implement new finalization strategy DetachStrategy(detachMode, 
> properties) where mode is one of ALL, NONE or CUSTOM. `properties` is list of 
> properties name, are taken into account only for CUSTOM mode.
> Discussion thread in dev list: [Proposal to handle properties on response 
> Elements-Apache Mail 
> Archives|https://lists.apache.org/thread/l8rw7ydj7kym8vhtwk50nhbp45ng9986]
> Stephen's thread in dev list: [The Issue of Detachment-Apache Mail 
> Archives|https://lists.apache.org/thread/xltcon4zxnwq4fyw2r2126syyrqm8spy]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to