admin管理员组文章数量:1426468
I am using es6 on nodejs, and am trying to execute the project() step in a gremlin query.
As part of the projection, I want to extract the properties.
Using gremlin console I would use valueMap() to get the properties.
However, when I attempt this from javascript, I get the expected error "valueMap is not a function".
Question 1: where do I import this function from?
Question 2: where can I read about all of the various gremlin objects available for importing in javascript?
===========================
I am using Gremlin 3.3 connecting to an AWS Neptune instance.
Here is my gremlin code:
g.V('test-id')
.bothE()
.limit(10)
.project('id', 'properties', 'out', 'in')
.by(id)
.by(valueMap())
.by(outV().id())
.by(inV().id())
I am using es6 on nodejs, and am trying to execute the project() step in a gremlin query.
As part of the projection, I want to extract the properties.
Using gremlin console I would use valueMap() to get the properties.
However, when I attempt this from javascript, I get the expected error "valueMap is not a function".
Question 1: where do I import this function from?
Question 2: where can I read about all of the various gremlin objects available for importing in javascript?
===========================
I am using Gremlin 3.3 connecting to an AWS Neptune instance.
Here is my gremlin code:
g.V('test-id')
.bothE()
.limit(10)
.project('id', 'properties', 'out', 'in')
.by(id)
.by(valueMap())
.by(outV().id())
.by(inV().id())
Share
Improve this question
edited Dec 17, 2018 at 23:30
user10796762
asked Oct 12, 2018 at 13:30
Joel StevickJoel Stevick
2,0783 gold badges21 silver badges25 bronze badges
3
- 1 Which gremlin package are you using? And can you post the code, you are trying to execute? – Glennie Helles Sindholt Commented Oct 12, 2018 at 14:03
- I have updated my question with the code – Joel Stevick Commented Oct 12, 2018 at 14:53
- 1 For your second question - there is a file in the GitHub repo that pretty much gives you a summary of the structure. Take a look at : github./apache/tinkerpop/blob/master/gremlin-javascript/src/… – Kelvin Lawrence Commented Oct 14, 2018 at 22:49
1 Answer
Reset to default 9valueMap()
, outV()
and similar traversals are spawned anonymously from a double underscore class - __
- so your code could be re-written as:
const gremlin = require('gremlin');
const __ = gremlin.process.statics;
g.V('test-id')
.bothE()
.limit(10)
.project('id', 'properties', 'out', 'in')
.by(id)
.by(__.valueMap())
.by(__.outV().id())
.by(__.inV().id())
本文标签: nodejsGremlinjavascript where is the function quotvalueMap()quot imported fromStack Overflow
版权声明:本文标题:node.js - Gremlin, javascript: where is the function "valueMap()" imported from? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745428895a2658239.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论