1
votes

In a Test, I made many types of nodes and relationships with Cypher syntax. After all, I delete all of unneccessary nodes and their relations. Actually, there are Types and Labels still there in my Browser Are there any method to clear Or change name of unneccessary Type, Label with Neo4j and Cypher..??

Best regards

5

5 Answers

1
votes

All the information is stored in the browser local storage. So If you are using chrome browser, once you are in localhost:7474/browser. right click your mouse and select "Inspect Element", this will open a chrome developer tool, then go to Resources and under resources, go to "Local Storage", you should see "http: //localhost:7474". select it. and select the key neo4j.grass, you can modify the value, by copying out and copying it back. or you can just delete the whole record (key and value) and close your browser. Open your browser again. start clicking on the labels. you will only see the labels you want. You can repeat this to clean up until neo4j come out with a better way.

if you are using firefox, you can install firebug, and click on the firebug then dom then local storage. then you can do the similar thing for other browser I am sure that you can figure out ways(google) to clear the local storage

0
votes

This cypher query deletes all nodes and relationships:

start n=node(*) match n-[r?]-() delete n, r;

You can customize it adding index or asking if it has attributes:

start n=node:users(':') match n-[r?]-() delete n, r;

0
votes

If you've removed the labels from all nodes you should be able to get a clean result visualization stream by clearing your web browser's cache/cookies. This will not remove them from the info bar on your left, only from the graph vis. frame. Since labels and relationship types are database global constructs, unlike properties, they can exist in the database also after all their instances have been deleted. That may be the intended behavior, but I would expect there to also be a way to remove them completely from the database when 2.0 is released (if there isn't a way already that I've missed). If you want a clean start you can always stop your server, delete your database directory, and restart the server. You may still have to clear your browser or you may see ghost labels from your old database still haunt your visualization stream.

0
votes

Searching for a removed label, I found that they are still left in data/graph.db/neostore.labeltokenstore.db.names, wh.

0
votes

Remove nodes you don't want, backup DB, purge DB data dir, stop / start server, reinsert DB, enjoy.

I tried following on both Firefox and Chromium and it didn't work:

  1. removing all nodes of types I no longer used
  2. clearing localStorage neo4j.grass key - it does contain labels, but this doesn't help
  3. clearing whole localStorage (completely)
  4. stopping / killing server and bringing it back after points above
  5. removing files with labels in their names from DB data dir
  6. removing all neo4j cookies (in fact, later, whole browser cache as well)

Since purging DB and reinserting data worked, and since clearing local storage and launching another browser gets you same labels you had, I'm guessing the info is held partially in localStorage AND partially in files in graph.db dir (or however your DB dir is called). Files there are often binary, so I picked redoing whole DB (since it wasn't big anyway) over blind edits or decoding binaries - simply faster.

EDIT:

You may try something I've just spotted:

label > properties > view Stylesheet > click on drop icon (looks like extinguisher). This should drop the grass key.

You may need to have at least one node of given type for that, to open a view where you actually set up node display (colors and other properties) to get to it's stylesheet.