-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDependencies_0_Verify_Projectable.cypher
More file actions
33 lines (32 loc) · 1.77 KB
/
Copy pathDependencies_0_Verify_Projectable.cypher
File metadata and controls
33 lines (32 loc) · 1.77 KB
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
26
27
28
29
30
31
32
33
// Verify that nodes and relationships are complete and ready for projection
MATCH (source)-[dependency:DEPENDS_ON]->(target)
WHERE $dependencies_projection_node IN labels(source)
AND $dependencies_projection_node IN labels(target)
WITH (NOT $dependencies_projection_weight_property IN keys(dependency)) AS missingWeightProperty
,(dependency[$dependencies_projection_weight_property]) AS weightPropertyValue
,(dependency[$dependencies_projection_weight_property] < 1) AS nonPositiveWeightPropertyValue
,coalesce(dependency.resolved, false) AS resolvedDependency
,EXISTS { (target)<-[:IS_IMPLEMENTED_IN]-(resolvedTarget:ExternalModule) } AS resolvedTarget
,(source.incomingDependencies IS NULL OR
target.incomingDependencies IS NULL) AS missingIncomingDependencies
,(source.outgoingDependencies IS NULL OR
target.outgoingDependencies IS NULL) AS missingOutgoingDependencies
,source
,target
WHERE missingWeightProperty
// OR nonPositiveWeightPropertyValue // if strict positive weights are needed
OR missingIncomingDependencies
OR missingOutgoingDependencies
RETURN missingWeightProperty
,nonPositiveWeightPropertyValue
,resolvedDependency
,resolvedTarget
,missingIncomingDependencies
,missingOutgoingDependencies
,count(*) AS numberOfRelationships
,min(weightPropertyValue) AS minWeightPropertyValue
,max(weightPropertyValue) AS maxWeightPropertyValue
,collect(DISTINCT coalesce(source.globalFqn, source.fqn) + ' -> ' + coalesce(target.globalFqn, target.fqn))[0..4] AS examples
// Output source and target nodes for troubleshooting
//,collect(source)[0..4]
//,collect(target)[0..4]