Gremlin:按活动位置和不活动用户的计数位置生成列表 [英] Gremlin: Generate a list by location of counts for active versus inactive users

查看:124
本文介绍了Gremlin:按活动位置和不活动用户的计数位置生成列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有顶点的人,用户类型和位置.人们具有出众的边缘people_location和people_usertype.人员具有属性名称",用户类型具有属性"activationStatus",位置具有属性名称".

I have vertices people, usertype, and location. People has outgoing edges people_location and people_usertype. People has property 'name', usertype has property 'activationStatus', and location has property 'name'.

我想创建一个看起来像这样的列表:

I want to create a list that looks like this:

[[1]: https://i.stack.imgur.com/lKzZL .png]

我希望按位置统计激活状态为活动"和不活动"的人员数量,其中位置中包含美国".

I want the count of people, by location, for activationStatus "active" and "inactive" where the location has "US" in it.

这仅是我想用来按位置(名称)以美国开头的地理位置来计算人数的信息:

This is all I have only for count of people by location where the location 'name' begins with US:

g.V()hasLabel('people').out('people_publicisofficelocation')
.filter(has('name',between('US','UT')))
.groupCount().by('name')

它正在运行,但没有产生结果.

It is running but not yielding results.

推荐答案

这对我有用!

g.V().hasLabel('Location').filter(has('name',between('US','UT'))) .project('Name','Active', 'Inactive', 'Total')  .by('name')  .by(__.both('people_location').out('people_usertype') .where(values('activationStatus').is(eq('Active'))).count())  .by(__.both('people_location').out('people_usertype') .where(values('activationStatus').is(eq('Inactive'))).count())  .by(__.both('people_location').out('people_usertype').count())

g.V().hasLabel('Location').filter(has('name',between('US','UT'))) .project('Name','Active', 'Inactive', 'Total')  .by('name')  .by(__.both('people_location').out('people_usertype') .where(values('activationStatus').is(eq('Active'))).count())  .by(__.both('people_location').out('people_usertype') .where(values('activationStatus').is(eq('Inactive'))).count())  .by(__.both('people_location').out('people_usertype').count())

这篇关于Gremlin:按活动位置和不活动用户的计数位置生成列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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