neo4jcypherneo4j-browser

How to set text on the node in neo4j


I want to set the text on the node

I have a example,node is created,but it is bare in graph,only a circle without a text.

 merge(n1 {label:'me'})
 return n1

I expect a text on the node. actually,result is like this: bare node image

what I expected is: node with text

I know I can creat a node with text like this:

MERGE (michael:Person { name: 'Michael Douglas' })
RETURN michael

Text will be Michael Douglas node with name

But if I change it to:

MERGE (michael:Person { name1: 'Michael Douglas' })
RETURN michael

No text! no text

or:

MERGE (michael:Event { name: 'Michael Douglas' })
RETURN michael

Text is a number 35 number text

So what is the principle of setting text?Why sometimes it will use the name of person,sometimes it is a number of internal id?sometimes it is bare?

Are there some rules?some document to tell?


Solution

  • Neo4j Browser comes with visual tool.

    The fact that nodes displayed with different properties you see is just visual guide, completely unrelated to the Neo4j itself.

    In the docs: Neo4j Browser Style Guide

    The nodes will already have sensible captions assigned by the browser, which auto-selects a property from the property list to use as a caption. You can see all the properties of that element if you click on any node or relationship. Properties will appear below the visualization. Larger property sets might be collapsed into a subset, but there is a little triangle on the right to unfold them.

    The Neo4j Browser will pick a "suitable" property to display. So it's usual to see name property is displayed but name1 is not.

    To manually select a property to display:

    1. Select the node (in the upper bar of the result view, not in the view)
    2. Select the field you want to display as captions (in the lower bar)

    enter image description here