Beyond an exercise in personal education — there were chunks of tech in here I hadn't even heard of — this is a db to pixel gizmo which integrates
- Neo4j a graph database using Cypher query language
- NodeJS, Express
- Angular4, Material Design
- ngx-charts for the force directed graph
Still in progress, this exercise focuses more on the backend.
The database seeds with 100k records, each seed a random IP address with 3 random connections.
In the graph db, this gets UNWIND
-ed (UNWOUND
?) via Cypher query language.
let queryString = 'WITH {_seeds} AS seeds';
queryString += ' UNWIND seeds as seed';
queryString += ' MERGE (source:Address { address: seed.address })';
queryString += ' WITH source, seed.connections AS connections';
queryString += ' UNWIND connections AS connection';
queryString += ' MATCH (target:Address) WHERE target.address = connection';
queryString += ' MERGE (source)-[:CONNECTS_TO]->(target)';
This also proved a challenge where I missed a key bit until @InverseFalcon helped me via StackOverflow: UNWIND with child UNWIND producing wrong nodes and relationships
Despite watching a series of videos and reading the docs repeatedly I never ran across this:
The
WITH
statement creates its own, new scope.
My original version missed ' WITH **source,** seed.connections AS connections';
and had me stumped until @InverseFalcon chimed in. I had tried other versions of passing in a var to the UNWIND
loop, but kept bonking.
I really wanted the UNWIND and child UNWIND all in one place rather than seeding parents then adding all the connections afterward.
- update README - part 1
- update README - part 2
- get the Swagger spec wired all proper-like
- tests, tests, tests
- improve Docker bits
- audit and update the todos
- Every 5 seconds add 10 new random nodes with connections are added.
- Every 10 seconds delete 5 random nodes and relationships.
run: node ./src/neo/neo-db-randomizer.js
node ./src/neo/neo-db-seeder.js
This project was generated with Angular CLI version 1.0.0.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive/pipe/service/class/module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.