Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

MATCH (file:File)
WHERE file.fileName IS NOT NULL
AND file.name IS NULL // Don't override an already existing "name" property
WITH *
,file.fileName AS fileName
WITH *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ OPTIONAL MATCH (targetScan:TS:Scan)-[:CONTAINS_PROJECT]->(targetProject)
// Group by project name, if the target project is the same and the distance. Return those as result.
RETURN sourceProject.name AS sourceProject
,sourceScan.name AS sourceScan
,source.rootProjectName AS sourceRootProject
,(targetProject <> sourceProject) AS isDifferentTargetProject
,(targetScan <> sourceScan) AS isDifferentTargetScan
,(target.rootProjectName <> source.rootProjectName) AS isDifferentTargetRootProject
,distance
,distanceTotalPairCount
,distanceTotalSourceCount
,distanceTotalTargetCount
,count(*) AS pairCount
,count(DISTINCT sourceNodeId) AS sourceNodeCount
,count(DISTINCT targetNodeId) AS targetNodeCount
,collect(DISTINCT source.fileName + ' ->' + target.fileName)[0..4] AS examples
,collect(DISTINCT source.fileName + ' -> ' + target.fileName)[0..4] AS examples
,collect(DISTINCT sourceProject.name + ' -> ' + targetProject.name)[0..4] AS exampleProjects
,collect(DISTINCT sourceScan.name + ' -> ' + targetScan.name)[0..4] AS exampleScans
// Sort by source project name, if the target project is the same and the distance, all ascending
ORDER BY sourceProject, isDifferentTargetProject, distance
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
OPTIONAL MATCH (sourceProject:Artifact|Project)-[:CONTAINS]->(source)
// Optionally get the name of the scan that contained that project
OPTIONAL MATCH (sourceScan:TS:Scan)-[:CONTAINS_PROJECT]->(sourceProject)
WITH *, coalesce(sourceScan, sourceProject).name AS sourceContainerName
WITH *, coalesce(source.rootProjectName, sourceScan.name, sourceProject.name) AS sourceContainerName
ORDER BY distance DESC, sourceContainerName ASC
// Only output the top 10 entries
LIMIT 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@ OPTIONAL MATCH (targetScan:TS:Scan)-[:CONTAINS_PROJECT]->(targetProject)
// Group by project name, if the target project is the same and the distance. Return those as result.
RETURN sourceProject.name AS sourceProject
,sourceScan.name AS sourceScan
,source.rootProjectName AS sourceRootProject
,(targetProject <> sourceProject) AS isDifferentTargetProject
,(targetScan <> sourceScan) AS isDifferentTargetScan
,(target.rootProjectName <> source.rootProjectName) AS isDifferentTargetRootProject
,distance
,distanceTotalPairCount
,distanceTotalSourceCount
,distanceTotalTargetCount
,count(*) AS pairCount
,count(DISTINCT sourceNodeId) AS sourceNodeCount
,count(DISTINCT targetNodeId) AS targetNodeCount
,collect(DISTINCT source.fileName + ' ->' + target.fileName)[0..4] AS examples
,collect(DISTINCT source.fileName + ' -> ' + target.fileName)[0..4] AS examples
,collect(DISTINCT sourceProject.name + ' -> ' + targetProject.name)[0..4] AS exampleProjects
,collect(DISTINCT sourceScan.name + ' -> ' + targetScan.name)[0..4] AS exampleScans
// Sort by source project name, if the target project is the same and the distance, all ascending
ORDER BY sourceProject, isDifferentTargetProject, distance

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ OPTIONAL MATCH (targetProject:Artifact|Project)-[:CONTAINS]->(target)
// Optionally get the name of the scan that contained that project
OPTIONAL MATCH (sourceScan:TS:Scan)-[:CONTAINS_PROJECT]->(sourceProject)
OPTIONAL MATCH (targetScan:TS:Scan)-[:CONTAINS_PROJECT]->(targetProject)
WITH *, coalesce(sourceScan, sourceProject).name AS sourceContainerName
WITH *, coalesce(source.rootProjectName, sourceScan.name, sourceProject.name) AS sourceContainerName
ORDER BY distance DESC, sourceContainerName ASC
// Only output the top 10 entries
LIMIT 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ WHERE module.globalFqn IS NOT NULL
AND externalModule.moduleName = module.moduleName
AND externalModule.namespace = module.namespace
AND externalModule.extensionExtended = module.extensionExtended
AND externalModule.globalFqn ENDS WITH module.localModulePath
)
)
AND module <> externalModule
Expand Down
18 changes: 18 additions & 0 deletions cypher/Typescript_Enrichment/Set_localRootPath_for_modules.cypher
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

// Set "localProjectPath", "localProjectPath" and "localModulePath" on Typescript Module nodes

MATCH (module:TS:Module)
WITH *, ltrim(module.localFqn, '.') AS trimmedLocalFqn
WITH *, split(module.globalFqn, trimmedLocalFqn)[0] AS rootPath
WITH *, reverse(split(reverse(rootPath), reverse('source/'))[0]) AS localProjectPath
WITH *, split(localProjectPath, '/')[0] AS rootProjectName
SET module.localProjectPath = localProjectPath
,module.rootProjectName = rootProjectName
,module.localModulePath = localProjectPath + trimmedLocalFqn
RETURN count(DISTINCT localProjectPath) AS identifiedLocalProjectPaths
// Debugging
//RETURN rootPath
// ,localProjectPath
// ,count(*)
// ,collect(DISTINCT module.localFqn)[0..2] AS exampleModuleLocalFqn
// ,collect(DISTINCT trimmedLocalFqn)[0..2] AS exampleTrimmedModuleLocalFqn
Loading
Loading