|
| 1 | +// List top anomalies |
| 2 | + |
| 3 | + MATCH (codeUnit) |
| 4 | + WHERE $projection_node_label IN labels(codeUnit) |
| 5 | + AND codeUnit.anomalyScore > 0 |
| 6 | + AND codeUnit.anomalyLabel = 1 |
| 7 | + ORDER BY codeUnit.anomalyScore DESC |
| 8 | + LIMIT 50 |
| 9 | +OPTIONAL MATCH (artifact:Java:Artifact)-[:CONTAINS]->(codeUnit) |
| 10 | + WITH *, artifact.name AS artifactName |
| 11 | +OPTIONAL MATCH (projectRoot:Directory)<-[:HAS_ROOT]-(proj:TS:Project)-[:CONTAINS]->(codeUnit) |
| 12 | + WITH *, last(split(projectRoot.absoluteFileName, '/')) AS projectName |
| 13 | + WITH *, coalesce(artifactName, projectName) AS projectName |
| 14 | + RETURN projectName |
| 15 | + ,codeUnit.name AS shortCodeUnitName |
| 16 | + ,coalesce(codeUnit.fqn, codeUnit.globalFqn, codeUnit.fileName, codeUnit.signature, codeUnit.name) AS codeUnitName |
| 17 | + ,codeUnit.anomalyScore AS anomalyScore |
| 18 | + ,coalesce(codeUnit.anomalyAuthorityRank, 0) AS authorityRank |
| 19 | + ,coalesce(codeUnit.anomalyBottleneckRank, 0) AS bottleneckRank |
| 20 | + ,coalesce(codeUnit.anomalyBridgeRank, 0) AS bridgeRank |
| 21 | + ,coalesce(codeUnit.anomalyHubRank, 0) AS hubRank |
| 22 | + ,coalesce(codeUnit.anomalyOutlierRank, 0) AS outlierRank |
| 23 | + ,codeUnit.anomalyTopFeature1 AS topFeature1 |
| 24 | + ,codeUnit.anomalyTopFeature2 AS topFeature2 |
| 25 | + ,codeUnit.anomalyTopFeature3 AS topFeature3 |
| 26 | + ,codeUnit.anomalyTopFeatureSHAPValue1 AS topFeature1Score |
| 27 | + ,codeUnit.anomalyTopFeatureSHAPValue2 AS topFeature2Score |
| 28 | + ,codeUnit.anomalyTopFeatureSHAPValue3 AS topFeature3Score |
0 commit comments