0

I have multiple documents I have multiple users Users read documents

I want to get documents who read by user Stefan.

g.V().
has('user','name','Stefan').
out('read').
hasLabel('document')

What other users has read the same document. And what other documents are those users reading wich the user Stefan doesn't have:

g.V().
has('user','name','Stefan').
out('read').
hasLabel('document').
in('read').
has('user','name',neq('Stefan')).
out('read').
match(
    __.as('d').hasLabel('document'),
    __.not(__.as('d').hasLabel('document').in('read').has('user','name','Stefan'))
).
select('d').valueMap('docId','title')

Now i want to sort this by number of user what read the document with groupCount.

g.V().
has('user','name','Stefan').
out('read').
hasLabel('document').
in('read').
has('user','name',neq('Stefan')).
out('read').
match(
    __.as('d').hasLabel('document'),
    __.not(__.as('d').hasLabel('document').in('read').has('user','name','Stefan'))
).
select('d').valueMap('docId','title').
groupCount().by().
order(local).by(values,decr)

This will work, but the result is not what i want:

{
  "{docId=[33975], title=[Doc1 - 5 - 1]}": 3,
  "{docId=[33379], title=[Doc2 - 5]}": 2,
  "{docId=[32474], title=[Doc3 - 5]}": 2,
  "{docId=[31150], title=[Doc4 2-2013]}": 1,
  "{docId=[107944], title=[Doc5]}": 1
}

The key is folded. I want to have 3 columns in my result:

  1. DocId
  2. Title
  3. GroupCount value.

How can i do this?

0 Answers0