0

In Neo4j, using .grass-style files to set the appearance of nodes and relationships, how can one pick a certain style for a node with multiple labels?

Since .grass-files define the visual style of a graph item by linking a certain label to a certain style the obvious question arises:

How to deal with a graph item with multiple labels?

Say, I have the following:

.grass file (pseudo-syntax):

for label "User" use color=red
for label "computer" use color=blue

graph (abstracted):

node John has Label "user"
node Mac has Label "computer"
node Robot has Labels "user" and "computer"

This obviously colors nodes John and Mike red and blue respectively.

But what about the node Robot?

In my particular problem I have a number of nodes with 2 labels each. One of these 2 labels, LabelA is common among all nodes and the other one differs from node to node. What I want is, to use the .grass style of the other-labels-style for my nodes - what it does is, i uses LabelA for all nodes to style them.

After strugeling with this issue for quite some time I give up.

Does anyone has any clue?

marc wellman
  • 5,808
  • 5
  • 32
  • 59

1 Answers1

1

This is not an answer to my question but it is a work-around that finally helped me and might also help other people out there.

Assuming I have all relevant styles defined in a .grass files (one for each label) I simply post-process my graph once it is loaded in my Neo4j browser.

This means, that I delete all those labels from my nodes which are blocking the style I need for the nodes leaving only this single label which gives me my required style.

Sure, this is quite unhandy and not optimal but it's the only attempt I found.

I will not mark this as answer since maybe someone will have a more appropriate idea ...

marc wellman
  • 5,808
  • 5
  • 32
  • 59