[ https://issues.apache.org/jira/browse/TINKERPOP-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
stephen mallette closed TINKERPOP-2228. --------------------------------------- Resolution: Not A Problem Gremlin Server only returns "references" to graph elements. A "reference" is the id and label. There are a number of reasons for this, but the one I tend to think is most important is that it protects against fat vertices. If you have a vertex with multi-properties and there are a million properties on that vertex and that vertex gets returned it's a problem. By not returning properties it forces users to be explicit in defining the data that they want in the form that they want it (like as a {{Map}} with {{valueMap('name','age')}}). http://tinkerpop.apache.org/docs/current/reference/#connecting-gremlin-server-limitations We realize that this is different that from console behavior (and a pure JVM based solution) and have taken some steps towards making it all consistent across languages and envirionments. We experimentally added {{ReferenceElementStrategy}} (which will "detach" elements and thus strip the properties) to 3.4.0 as optional and defaulted it into the packaged Gremlin Server artifact, but stopped short of pushing it in as a default to all graph providers. We may yet set that happen in newer versions. > by(valueMap(true)) drops all properties during query > ---------------------------------------------------- > > Key: TINKERPOP-2228 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2228 > Project: TinkerPop > Issue Type: Bug > Components: javascript > Affects Versions: 3.4.1 > Environment: MacOS Mojave 10.14.4 > Reporter: Byron Bailey > Priority: Major > > When using the by(valueMap(true)) step when using the gremlin javascript > plugin, a result set is returned but the properties are all missing. The > same query works from the console. Additionally, the same query without > by(valueMap(true)) returns a valid result set. > > Below is the sample code with the output, along with the same query against > the same graph using the console. The test case is a simple server > architecture with a "host" node having three edges connecting it to 2 "vm" > nodes and a chassis node. I have also tried the identical query using > client.submit() and receive failed results. > > {code:java} > const g = traversal().withRemote(new > DriverRemoteConnection('ws://localhost:8182/gremlin'));{{}} > const __ = gremlin.process.statics; > > function getNeighbors(label, uuid){ > console.log("> getNeighbors "+label+"["+uuid+"]"); > > return g.V() > .has(label,"uuid",uuid) > .bothE() > .otherV() > .path() > .by(__.valueMap(true)) > .toList() > } > getNeighbors("host", "host1") > .then(results => {{{ }} > console.log("Sending results..."+JSON.stringify(results)); > }); > {code} > OUTPUT: > {code:java} > > getNeighbors host[host1] > Sending > results...[{"labels":[[],[],[]],"objects":[{},{},{}]},{"labels":[[],[],[]],"objects":[{},{},{}]},{"labels":[[],[],[]],"objects":[{},{},{}]}] > {code} > > Same query from console: > {code:java} > gremlin> > g.V().has("host","uuid","host1").bothE().otherV().path().by(valueMap(true)).toList() > ==>path[ > {id=1, label=host, model=[D-host], manufacturer=[Dell], name=[host1], > uuid=[host1]}, {id=0, label=MOUNTED_IN, > uuid=6ca30477-80e2-4df6-9e00-10adddc0c04f, name=host1 to chassis1, slots=1}, > {id=0, label=chassis, model=[D-chassis], manufacturer=[Dell], > name=[chassis1], uuid=[chassis1]}] > ==>path[{id=1, label=host, model=[D-host], manufacturer=[Dell], name=[host1], > uuid=[host1]} > , {id=20, label=MOUNTED_IN, uuid=ea0b7e49-9738-4624-86e7-ba57de873120, > name=vm1 to host1}, > {id=22, label=vm, name=[vm1], uuid=[vm1]} > ] > ==>path[ > {id=1, label=host, model=[D-host], manufacturer=[Dell], name=[host1], > uuid=[host1]} > , {id=16, label=MOUNTED_IN, uuid=966ad71a-ad09-4877-93b2-14779edf3ba9, > name=vm2 to host1}, > {id=21, label=vm, name=[vm2], uuid=[vm2]} > ] > {code} > > If I remove the .by(__.valueMap(true)) from the javascript query, I receive > the following valid output: > > {code:java} > > getNeighbors host[host1] > Sending results...[{"labels":[[],[],[]],"objects":[ > {"id":1,"label":"host"} > ,{"id":0,"label":"MOUNTED_IN","outV":1,"inV":0,"properties":{}},{"id":0,"label":"chassis"}]},{"labels":[[],[],[]],"objects":[ > {"id":1,"label":"host"} > ,{"id":20,"label":"MOUNTED_IN","outV":22,"inV":1,"properties":{}},{"id":22,"label":"vm"}]},{"labels":[[],[],[]],"objects":[ > {"id":1,"label":"host"} > ,{"id":16,"label":"MOUNTED_IN","outV":21,"inV":1,"properties":{}},{"id":21,"label":"vm"}]}] > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)