Last active
February 20, 2022 13:33
-
-
Save vladbatushkov/342d68a90c58c6a6c728e471c5b8a6cc to your computer and use it in GitHub Desktop.
Find dependency for subject, and then find other consumers of same dependency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNWIND ['module1.*', 'module2.*', 'module3.*'] as module | |
CALL { | |
WITH module | |
MATCH (s:File)-[:DEPENDS_ON]->(d:File)<-[:DEPENDS_ON*]-(c:File) | |
WHERE s.name =~ module | |
AND NOT c.name =~ module | |
AND NOT d.name =~ 'common/.*' | |
WITH DISTINCT s.name as subject, | |
d.name as dependency, | |
collect(DISTINCT c.name) as consumers | |
RETURN subject, | |
dependency, | |
size(consumers) as consumers_count, | |
consumers as consumers_detials | |
} | |
RETURN subject, dependency, consumers_count, consumers_detials | |
ORDER BY consumers_count DESC, subject ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment