The styles in Neo4j Browser (I use Mac) seem to have changed over time, and old training materials and documentation don't seem to be accurate anymore. Where is it currently documented? It does not seem to be in the Operations Guide, the Cypher guide, or anywhere else I have looked. Here are some of the issues and questions I would like to understand:
In the past there was a place to drag a .grass file into the popup of a node. That doesn't exist anymore. There is an area to chose node size, color etc. manually. Any way to import into that? Any way to copy styles between nodes?
In a recent upgrade the colors one can pick changed... colors I used in the past went away. Yet nodes I had previously colored kept their old colors. So now I have a mish-mash and no way to fix it other than changing all old node types to use the new colors.
The :style keyword displays all the current styles. I can save that as a .grass file. If I edit that file, I do not see how to import it. Someone said to drag it into the top browser window. That pastes it there, but when I run it I get a syntax error.
I've also tried entering small parts of a .grass file into the window, and always get syntax error.
I tried prefacing all the .grass info with ":style " and entering it in the window but that doesn't help.
Someone said you can import it from a URL. They had put a .grass file on a web server. Not wanting to do that, I tried a local URL like "file://~/Downloads/my.grass" but that got the same error. Should that work?
":style rest" clears out all the styles. :style then says "No style generated or set yet. Run a query and return a few nodes and relationships to generate some styling." After running a basic query there are indeed some default styles loaded. Where is it getting the defaults? Are they in a file somewhere that I can influence?
Where are custom styles I set persisted? Obviously they are saved from session to session. I'm not finding a .grass file saved somewhere. All this experimenting has lost the styles I had set. I could restore them from backups... if I knew where they were.
And since :style seems to do a total replacement, I don't see how to load a custom set of styles... all I can do is :style reset, and then manual styling by hand with the mouse.
Note this has changed. You can now import directly from your computer .grass and .cypher files by dragging and dropping anywhere onto the Browser. As seen here:
I found that this wasn't sufficient because the browser has to be authorised otherwise a Access-Control-Allow-Origin (CORS) error occurs preventing the browser loading the .grass file. In the end I solved this by modifying the Apache httpd.conf file adding:
# Modification to allow Neo4J .grass file to be loaded
# To prevent error: Failed to load resource: Origin http://localhost:7474 is not allowed by Access- Control-Allow-Origin.
<FilesMatch "\.(grass)$">
<IfModule mod_headers.c>
SetEnvIf Origin "http(s)?://(localhost)$" AccessControlAllowOrigin=$0
Header Set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
# End of modification
It still suffers the same problem as the file-drop method wrt to the older method of dropping onto the specific .grass file area in the Favourites tab - the browser seems to cache the styles so simply changing the .grass file isn't enough to change the style returned - the browser has to be refreshed losing the earlier query results.