// Explore outgoing desclaration dependencies of modules 8 MATCH (source:TS:Module)-[rm:DEPENDS_ON]->(target:ExternalModule) WHERE source.globalFqn = '/Users/johnny/Repositories/git/react-router/packages/react-router-native/index.tsx' AND target.globalFqn = '/Users/johnny/Repositories/git/react-router/packages/router/history.ts' WITH source ,target ,count(DISTINCT target) AS numberOfExternalModules ,sum(rm.cardinality) AS sumOfExternalModulesCardinalities OPTIONAL MATCH (source)-[rd:DEPENDS_ON]->(declaration:ExternalDeclaration)<-[:EXPORTS]-(target) WITH source ,target ,numberOfExternalModules ,sumOfExternalModulesCardinalities ,collect(DISTINCT declaration) AS declarations // TODO remove after debugging ,count(DISTINCT declaration) AS numberOfDeclarations ,sum(rd.cardinality) AS sumOfDeclarationCardinalities OPTIONAL MATCH (source)-[:DECLARES]->(abstraction:TypeAlias|Interface)-[ra:DEPENDS_ON]->(target) WITH source ,target ,declarations // TODO remove after debugging ,numberOfExternalModules ,sumOfExternalModulesCardinalities ,numberOfDeclarations ,sumOfDeclarationCardinalities ,collect(DISTINCT abstraction) AS abstractions // TODO remove after debugging ,count(DISTINCT abstraction) AS numberOfAbstractions ,sum(ra.cardinality) AS sumOfAbstractionCardinalities OPTIONAL MATCH (source)-[:DECLARES]->(implementation:!TypeAlias&!Interface)-[ri:DEPENDS_ON]->(target) WITH source ,target ,declarations // TODO remove after debugging ,abstractions // TODO remove after debugging ,numberOfExternalModules ,sumOfExternalModulesCardinalities ,numberOfDeclarations ,sumOfDeclarationCardinalities ,numberOfAbstractions ,sumOfAbstractionCardinalities ,collect(DISTINCT implementation) AS implementations // TODO remove after debugging ,count(DISTINCT implementation) AS numberOfImplementations ,sum(ri.cardinality) AS sumOfImplementationCardinalities RETURN source.globalFqn AS sourceFqn ,numberOfExternalModules ,numberOfDeclarations ,numberOfAbstractions ,numberOfImplementations ,sumOfExternalModulesCardinalities ,sumOfDeclarationCardinalities ,sumOfAbstractionCardinalities ,sumOfImplementationCardinalities ,source // TODO remove after debugging ,collect(DISTINCT target) AS targets // TODO remove after debugging ,declarations // TODO remove after debugging ,abstractions // TODO remove after debugging ,implementations // TODO remove after debugging ORDER BY source.globalFqn ASC