Neo4j 2.0.1 graphstyle.grass for multiple labels
css, neo4j
Solution
That's a perfectly sensible approach, which would be correct. As of Neo4j 2.0.1, the graph stylesheets aren't yet clever enough to handle chained class selectors. The order of selection is (as you've observed) also broken.
update: As of 2.2, multiple class selectors are supported, as long as you edit the grass definition by hand.
Problem
I'm having a hard time setting properties for nodes with multiple labels. My graphstyle.grass file looks like this: ``` node { diameter: 40px; color: #aaaaaa; border-color: #888888; border-width: 1.5px; text-color-internal: #000000; caption: '{name}'; font-size: 12px; } node.foo { color: #aaaaff; } node.bar { color: #aaffaa; } node.bar.a { border-color: #ff0000; } node.bar.b { border-color: #0000ff; } ``` So the intention here is that if you have a label of 'bar' the node is colored a certain way, if you also have an additional label of 'a' or 'b' your border is colored appropriately. My CSS knowledge is weak but I think this is traditionally how multiple class selectors are done. The behavior I'm seeing in the Neo 2.0.1 browser graph display is that if a node has multiple labels, it picks the first label, tries to find a node.first_label selector in the grass file, if it doesn't find it it just adds a new selector for it. So two concrete examples: - If there's a node with labels ['bar','a'] (in that order) then Neo4j will find the node.bar selector above and use it, not doing anything with the second class.. i.e. the 'node.bar.a' attributes won't be applied. - If the node has the labels ['a','bar'] (in that order) then Neo4j will look for a selector of the form 'node.a' and not invoke any of the selectors above but instead create a new selector with a set of default parameters. Any guidance or suggestions are greatly appreciated.