Gremlin:按地点名称以“美国”开头的人数统计

问题描述 投票:0回答:1

以下结果按位置名称计算人数:g.V()hasLabel('people')。out('people_location')。groupCount()。by('name')

我试过这个只过滤那些以US开头的地点列表:gV()hasLabel('people')。out('people_location')。groupCount()。by('name')。matches(“US * “)

和g.V()hasLabel('people')。out('people_location')。匹配(“US *”)。groupCount()。by('name')

但都没有工作。

orientdb gremlin
1个回答
0
投票

什么是matches()?这是OrientDB特定的步骤吗?现在,我只是假设这可能是这里的主要问题,因为我不知道matches步骤。这就是我要做的:

g.V().hasLabel('people').
  out('people_location').has('name', gte('US').and(lt('UT'))).
  groupCount().
    by('name')

或者,甚至更简单:

g.V().has('location', 'name', gte('US')).
  group().
    by('name').
    by(inE('people_location').count())
© www.soinside.com 2019 - 2024. All rights reserved.