-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIncoming_Package_Dependencies.cypher
25 lines (24 loc) · 1.15 KB
/
Incoming_Package_Dependencies.cypher
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Incoming Package Dependencies. Requires "Add_file_name and_extension.cypher".
MATCH (p:Package)
MATCH (artifact:Artifact)-[:CONTAINS]->(p)
OPTIONAL MATCH (p)-[:CONTAINS]->(it:Java:Type)<-[r:DEPENDS_ON]-(et:Java:Type)<-[:CONTAINS]-(ep:Package)<-[:CONTAINS]-(ea:Artifact)
WHERE ep.fqn <> p.fqn
OPTIONAL MATCH (it)<-[:DEPENDS_ON]-(ei:Java:Type:Interface)
WITH artifact.name AS artifactName
,p
,COUNT(et) AS incomingDependencies
,SUM(r.weight) AS incomingDependenciesWeight
,COUNT(DISTINCT et) AS incomingDependentTypes
,COUNT(DISTINCT ei) AS incomingDependentInterfaces // also included in dependent types
,COUNT(DISTINCT ep) AS incomingDependentPackages
,COUNT(DISTINCT ea) - 1 AS incomingDependentArtifacts
ORDER BY incomingDependencies DESC, p.fqn ASC // package with most incoming dependencies first
RETURN artifactName
,p.fqn AS packageName
,incomingDependencies
,incomingDependenciesWeight
,incomingDependentTypes
,incomingDependentInterfaces
,incomingDependentPackages
,incomingDependentArtifacts
LIMIT 50