0

The below results in a group count of people by location name: g.V()hasLabel('people').out('people_location').groupCount().by('name')

I tried this to filter the list of locations by only those that begin with US: g.V()hasLabel('people').out('people_location').groupCount().by('name').matches("US*")

and g.V()hasLabel('people').out('people_location').matches("US*").groupCount().by('name')

but neither work.

Veronica
  • 145
  • 12

1 Answers1

0

What is matches()? Is that an OrientDB-specific step? For now, I'll just assume that this might be the main problem here, as I'm not aware of matches step. This is what I would do:

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

or, even simpler:

g.V().has('location', 'name', gte('US')).
  group().
    by('name').
    by(inE('people_location').count())
Daniel Kuppitz
  • 10,846
  • 1
  • 25
  • 34
  • Hi Daniel, I tried this but gte('US') is returning all labels and not filtering by just the ones that begin with US. is there another option? – Veronica Mar 21 '19 at 18:24
  • Sorry, should have been `gte('US').and(lt('UT'))`. I updated the answer. – Daniel Kuppitz Mar 21 '19 at 18:43
  • Hi Daniel. This isn't working either :( I have added an updated version of this question since there are additional fields I want to try and get. Maybe you can help : https://stackoverflow.com/questions/55302510/gremlin-generate-a-list-by-location-of-counts-for-active-versus-inactive-users – Veronica Mar 22 '19 at 15:05
  • what version of Gremlin are you using and what version of OrientDB? – stephen mallette Mar 22 '19 at 15:11
  • Is this issue not a duplicate of your other issue Veronica? https://stackoverflow.com/questions/55302510/gremlin-generate-a-list-by-location-of-counts-for-active-versus-inactive-users – Kelvin Lawrence Mar 25 '19 at 19:03