Contact queries

How many contacts per type?

g.V().hasLabel('contact')
     .groupCount().by('type')

How many workers per company?

g.V().hasLabel('contact').has('type', 'CONTACT_COMPANY')
     .project('Name', 'Workers').by('name').by(in('works').count())

How many workers per company, ordered from most to least?

g.V().hasLabel('contact').has('type', 'CONTACT_COMPANY')
     .project('Name', 'Workers').by('name').by(in('works').count())
     .dedup().fold().order(local).by(select('Workers'), desc)

How many students per learning center?

g.V().hasLabel('contact').has('type', 'CONTACT_LEARNINGCENTER')
     .project('Name', 'Students').by('name').by(in('studies').count())

How many docents per learning center?

g.V().hasLabel('contact').has('type', 'CONTACT_LEARNINGCENTER')
     .project('Name', 'Docents').by('name').by(in('teaches').count())

Contact's name and type

g.V().hasLabel('contact').valueMap().select('name', 'type')

Contacts' outgoing relations

g.V().hasLabel('contact').outE().inV().path().by('name').by(label)

How these two contacts are related, using business, dossiers and convocations?

g.V().hasLabel('contact').has('name','Contact 1')
     .repeat(both('participates','works','organizes','invites').simplePath())
       .until(and(
         hasLabel('contact').has('name','Contact 2'),
         loops().is(lte(10))
       ))
     .limit(20)
     .path().by('name')

Finding contact's matchings

g.V().hasLabel('contact').has('name','Contact name')
     .repeat(both('participates','works','organizes','invites','parent'))
       .until(and(hasLabel('contact').has('type','CONTACT_USER'),not(cyclicPath())))
     .limit(600)
     .path().by('name')

Sorted contact's matchings

g.V().hasLabel('contact').has('name','Contact name')
     .repeat(both('participates','works','organizes','invites','parent'))
       .until(and(hasLabel('contact').has('type','CONTACT_USER'),not(cyclicPath())))
     .limit(600)
     .tail(local)
     .groupCount().by('name')
     .order(local).by(values,desc)
English11/07/24 09:51Lluís Turró Cutiller
English11/26/24 07:17Lluís Turró Cutiller
English12/05/24 21:38Lluís Turró Cutiller
English12/08/24 08:50Lluís Turró Cutiller
English12/14/24 05:52Lluís Turró Cutiller
English12/15/24 07:21Lluís Turró Cutiller
English01/14/25 14:26Lluís Turró Cutiller
English01/15/25 07:19Lluís Turró Cutiller