首页 > 解决方案 > Gremlin:提供的遍历器未映射到值

问题描述

g.V()
    .has('atom', '_value', 'red').fold()
    .coalesce(unfold(), addV('atom').property('_value', 'red')).as('atom')
    .out('view').has('view', '_name', 'color').fold()
    .coalesce(unfold(), addE('view').from('atom').to(addV('view').property('_name', 'color')))

给我一个错误:

The provided traverser does not map to a value: []->[SelectOneStep(last,atom)] (597)

这是什么意思?

标签: databasecassandragremlinjanusgraphscylla

解决方案


所以看起来 whenas()后面跟着fold()它删除了as()步骤中设置的变量。我aggregate()改为使用如下:

g.V()
    .has('atom', '_value', 'red')
    .fold().coalesce(
        unfold(), 
        addV('atom').property('_value', 'red')
    )
    .aggregate('atom')
    .out('view').has('view', '_name', 'color')
    .fold().coalesce(
        unfold(), 
        addE('view')
            .from(select('atom').unfold())
            .to(addV('view').property('_name', 'color'))
            .inV()
    )

推荐阅读