How can I put aggregation on number of reverse Edges coming in result?


(Rohan) #1

I have use case of fraud detection where in I have a graph of 40M edges representing users and their properties, 2 users having same property value are connected via same property value node.

Relations [edges] via which these 2 users are connected are reversible.
My query is like : find all the users which have any of the property value same as the given user.

I want to put aggregation and return users with max match.

Any idea would for how to draw up optimal schema would be a great help.


(Michel Conrado) #2

I believe something like this.

{
  var(func: eq(username, "Lucas")){
    value1 as somepred1
    value2 as somepred2
    value3 as somepred3
    value4 as somepred4
  }
  
  q(func: has(username)@filter (
    eq(somepred1,val(value1)) AND
    eq(somepred2,val(value2)) AND
    eq(somepred3,val(value3)) AND
    eq(somepred4,val(value4))
  )
  {
    somepred1
    somepred2
    somepred3
    somepred4
  }
}

You could also use “OR” instead of “AND”

humm, I think that’s not possible. Thinking about what you’ve just said above this part.