Hi all,
I have a list of Products and Persons. A Product can have relationships to different Persons, such as "hasProductOwner", "hasDeveloper", "hasTechnicalWriter", etc. (these are effectively roles that a person can have for a Product).
A Person can have multiple roles for the same Product or across different Products.
I want to find the Person with the most roles across all Products (i.e. the count), as well as I want to list all the roles that this person has against which product.
I am running this query, which gets me the results, but a) it says it's deprecated and b) how do I filter that I only want to count relationship between Product and Person of a certain type (e.g. only "hasProductOwner", "hasDeveloper", "hasTechnicalWriter") ?
This gives me the count
MATCH (pr:Product`)-[r*0..1]-(pe:Person`)
WITH pe, count(r) as rs
RETURN pe.lastName, rs
ORDER BY rs DESC
This gives me the list of relationships
MATCH (pr:Product`)-[r*0..1]-(pe:Person`)
WITH pe, collect(r) as rs
RETURN pe.lastName, rs
This gives me an error, as the type() function expect a relationship, not a list of relationships
MATCH (pr:Product`)-[r*0..1]-(pe:Person`)
WITH pe, collect(type(r)) as rs
RETURN pe.lastName, rs
Many thanks