-5

g.V().has('Candidate','imProfileId','1000363').out('HAS_SKILL').inE('HAS_SKILL').group().by(outV().values('userId')).unfold().project('userId','count').by(select(keys)).by(select(values).count(local)).order().by('count',desc)

compare one candidate (c1) skills with other candidates and check if atleast one skill is matching among the skills of first candidate (c1).get his userId ,and what are the skills that are matching with (c1),get the count of skills that are matching and order the count of skills in descending order

  • 1
    Hello, and welcome to Stack Overflow. As you can see from the attempts to help you below, your question is not clear enough to know exactly what you are looking for. It would help give you accurate and tested answers if you can edit the question to include the Gremlin steps that build a sample graph and also the exact output you are looking to achieve. As you can see your question has received a number of down votes and at least one close vote. This is because it is very unclear what you are looking for. Please refer to these guidelines [how to ask](https://stackoverflow.com/help/how-to-ask) – Kelvin Lawrence Jun 30 '22 at 14:14

1 Answers1

0

You can transform the values of the group() with a second by() modulator:

g.V().
  has('Candidate', 'imProfileId', '$improfileId').
  out('HAS_SKILL').as('skills').
  inE('HAS_SKILL').
  group().
    by(outV().values('userId')).
    by(inV().values('skillName')).
  unfold().
  project('userid', 'skills').by(select(keys)).by(select(values))
stephen mallette
  • 45,298
  • 5
  • 67
  • 135
  • g.V().has('Candidate','imProfileId','imProfileId').out('HAS_SKILL').as('skills').inE('HAS_SKILL').group().by(outV().values('userId')).unfold().project('userid','skills').by(select(keys)).by(select(values)) how cani i modify to get skillnames – user19442466 Jun 29 '22 at 10:50
  • i thought i'd answered that. you are using `group()` to produce edge values, so the `Map` contains a list of edges as its values and the edges connect a `user --> skill`. So, the second `by()` modulator that i added is applied to each of those edges in the grouping to get the "skillName" (or whatever you've named that property key). if that doesn't answer your question, i suggest you provide update your question by adding some sample data and more details about what you are looking for. – stephen mallette Jun 29 '22 at 11:39
  • please check the image i provided i think u will understand now – user19442466 Jun 29 '22 at 12:19
  • i still don't understand what is not working. could you please explain what isn't working and expand your question with actual sample data with query output to show what is not working. here is an example: here is an example https://stackoverflow.com/questions/51388315/gremlin-choose-one-item-at-random – stephen mallette Jun 29 '22 at 17:45
  • g.V().has('Candidate','imProfileId','36350803').out('HAS_SKILL').inE('HAS_SKILL').group().by(outV().values('userId')).by(inV().values('skillName')).unfold().project('userId','skills','count').by(select(keys)).by(select(values).fold()).by(select(values).count(local)).order().by('count',desc) ==>{userId=slr1viisumjike5v169aoti45b, skills=[seo], count=1} ==>{userId=kcvauhgrm29hd0qqrsr34p2c02, skills=[seo], count=1} i need userid and count of commom skills and names of the commomskills – user19442466 Jun 30 '22 at 08:11