|
| 1 | +// List pair of files that were changed together and that have a declared dependency between each other. |
| 2 | + |
| 3 | +MATCH (firstCodeFile:File)-[dependency:DEPENDS_ON]->(secondCodeFile:File) |
| 4 | +MATCH (firstCodeFile)-[pairwiseChange:CHANGED_TOGETHER_WITH]-(secondCodeFile) |
| 5 | +WHERE elementId(firstCodeFile) < elementId(secondCodeFile) |
| 6 | + WITH firstCodeFile.fileName AS firstFileName |
| 7 | + ,secondCodeFile.fileName AS secondFileName |
| 8 | + ,dependency.weight AS dependencyWeight |
| 9 | + ,pairwiseChange.commitCount AS commitCount |
| 10 | + ,dependency.fileDistanceAsFewestChangeDirectoryCommands AS fileDistanceAsFewestChangeDirectoryCommands |
| 11 | +RETURN dependencyWeight |
| 12 | + ,commitCount |
| 13 | + ,fileDistanceAsFewestChangeDirectoryCommands |
| 14 | + // ,count(*) AS occurrences |
| 15 | + // ,collect(firstFileName + ' -> ' + secondFileName)[0..3] AS examples |
| 16 | +ORDER BY dependencyWeight, commitCount |
| 17 | + |
| 18 | +// MATCH (firstCodeFile:File)-[dependency:DEPENDS_ON]->(secondCodeFile:File) |
| 19 | +// MATCH (firstCodeFile)-[pairwiseChange:CHANGED_TOGETHER_WITH]-(secondCodeFile) |
| 20 | +// WHERE elementId(firstCodeFile) < elementId(secondCodeFile) |
| 21 | +// RETURN firstCodeFile.fileName AS firstFileName |
| 22 | +// ,secondCodeFile.fileName AS secondFileName |
| 23 | +// ,dependency.weight AS dependencyWeight |
| 24 | +// ,pairwiseChange.commitCount AS commitCount |
| 25 | +// ORDER BY dependencyWeight, commitCount |
| 26 | + |
| 27 | +// MATCH (g1:!Git&File)-[relation:CHANGED_TOGETHER_WITH|DEPENDS_ON]-(g2:!Git&File) |
| 28 | +// WITH count(DISTINCT relation) AS relatedFilesCount |
| 29 | +// ,collect(DISTINCT relation) AS relations |
| 30 | +// UNWIND relations AS relation |
| 31 | +// WITH relatedFilesCount |
| 32 | +// ,coalesce(relation.commitCount, 0) AS commitCount |
| 33 | +// ,coalesce(relation.weight, 0) AS dependencyWeight |
| 34 | +// ,coalesce(relation.fileDistanceAsFewestChangeDirectoryCommands, 0) AS fileDistanceAsFewestChangeDirectoryCommands |
| 35 | +// RETURN dependencyWeight |
| 36 | +// ,commitCount |
| 37 | +// ,fileDistanceAsFewestChangeDirectoryCommands |
| 38 | +// ORDER BY dependencyWeight, commitCount |
0 commit comments