Gremlin,javascript:函数"valueMap()"在哪里?从进口? [英] Gremlin, javascript: where is the function "valueMap()" imported from?

查看:64
本文介绍了Gremlin,javascript:函数"valueMap()"在哪里?从进口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在nodejs上使用es6,并试图在gremlin查询中执行project()步骤.

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.

使用gremlin控制台,我将使用valueMap()来获取属性.

Using gremlin console I would use valueMap() to get the properties.

但是,当我尝试使用javascript进行此操作时,出现了预期的错误"valueMap不是函数".

However, when I attempt this from javascript, I get the expected error "valueMap is not a function".

问题1:我从哪里导入此功能?

Question 1: where do I import this function from?

问题2:在哪里可以阅读所有可用于导入javascript的gremlin对象?

Question 2: where can I read about all of the various gremlin objects available for importing in javascript?

==========================

===========================

我正在使用Gremlin 3.3连接到AWS Neptune实例.

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

推荐答案

valueMap() outV()和类似的遍历都产生于匿名/current/reference/#_ static_enums_and_methods_3"rel =" noreferrer>双下划线类- __ -这样您的代码可以重写为:

valueMap(), 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()) 

这篇关于Gremlin,javascript:函数"valueMap()"在哪里?从进口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆