ArangoDB 3.0:未知函数"TRAVERSAL()"的使用(解析时) [英] ArangoDB 3.0: Usage of unknown function 'TRAVERSAL()' (while parsing)

查看:118
本文介绍了ArangoDB 3.0:未知函数"TRAVERSAL()"的使用(解析时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过Homebrew新安装了ArangoDB 3.0.2

当我通过此链接 https://docs.arangodb.com/3.0/cookbook/Graph/FindingLeafNodesAql.html#using-the-visitor-from-an-aql-query

发生此错误:

Query: usage of unknown function 'TRAVERSAL()' (while parsing)

有人可以解释为什么我得到这个错误吗? 提前非常感谢您.

仅供参考:我确实在ArangoDB 2.8中成功运行了该查询.

解决方案

所有与图相关的功能都是已从3.0中的AQL 中删除.
可以使用更快,更灵活的 AQL图形遍历. >

有可用的迁移配方,请参见例如 https://docs.arangodb.com/3.0/cookbook/AQL/MigratingEdgeFunctionsTo3.html

不是所有食谱的食谱都是最新的,您尝试的食谱是为2.x编写的,并且在3.x中不再起作用. @dothebart刚刚从食谱中删除了过时的图形配方,它们将在下一次构建后消失,以免混淆用户.

以下查询应为示例数据(所有叶子节点仅=大写),但不需要用户定义的AQL函数:

FOR v IN 0..10 INBOUND "v/world" e
    // leaf node = no inbound edges.
    // We can use LIMIT 1 to optimize the traversal (we don't care how many edges)
    FILTER LENGTH(FOR vv IN INBOUND v e LIMIT 1 RETURN 1) == 0
    RETURN CONCAT(v.name, " (", v.type, ")")

I freshly installed ArangoDB 3.0.2 via Homebrew

When I ran a query following this link https://docs.arangodb.com/3.0/cookbook/Graph/FindingLeafNodesAql.html#using-the-visitor-from-an-aql-query

This error occurred:

Query: usage of unknown function 'TRAVERSAL()' (while parsing)

Could somebody please explain why I got this error? Thank you very much in advance.

FYI: I did run that query successfully in ArangoDB 2.8.

解决方案

All graph-related functions were removed from AQL in 3.0.
The faster and more flexible AQL graph traversal can be used instead.

There are migration recipes available, see e.g. https://docs.arangodb.com/3.0/cookbook/AQL/MigratingEdgeFunctionsTo3.html

Not all cookbook recipes are up-to-date, the one you tried was written for 2.x and does not work anymore in 3.x. @dothebart just removed the obsolete graph recipes from the cookbook, they will be gone after the next build to stop confusing users.

The following query should give you the same result for the example data (all leaf nodes = capitals only), but without the need for a user-defined AQL function:

FOR v IN 0..10 INBOUND "v/world" e
    // leaf node = no inbound edges.
    // We can use LIMIT 1 to optimize the traversal (we don't care how many edges)
    FILTER LENGTH(FOR vv IN INBOUND v e LIMIT 1 RETURN 1) == 0
    RETURN CONCAT(v.name, " (", v.type, ")")

这篇关于ArangoDB 3.0:未知函数"TRAVERSAL()"的使用(解析时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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