-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOutgoing_Package_Dependencies.cypher
25 lines (24 loc) · 1.14 KB
/
Outgoing_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
// Outgoing Package Dependencies. Requires "Add_file_name and_extension.cypher".
MATCH (p:Package)
MATCH (artifact:Artifact)-[:CONTAINS]->(p)
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 outgoingDependencies
,SUM(r.weight) AS outgoingDependenciesWeight
,COUNT(DISTINCT et) AS outgoingDependentTypes
,COUNT(DISTINCT ei) AS outgoingDependentInterfaces // also included in dependent types
,COUNT(DISTINCT ep) AS outgoingDependentPackages
,COUNT(DISTINCT ea) - 1 AS outgoingDependentArtifacts
ORDER BY outgoingDependencies DESC, p.fqn ASC // package with most incoming dependencies first
RETURN artifactName
,p.fqn AS packageName
,outgoingDependencies
,outgoingDependenciesWeight
,outgoingDependentTypes
,outgoingDependentInterfaces
,outgoingDependentPackages
,outgoingDependentArtifacts
LIMIT 50