0

I'm new to neo4j and I'm facing issue to set the node's label.

I create a new node using this code.

create(s:Student{id:'QWERTY',age:20,first_name:'Sachin',last_name:'Shah'}) 
return s.first_name

AND (without return a node data)

create(s:Student{id:'fjfktejfkahjgkjafiejg',age:20,first_name:'Sachin',
last_name:'Shah'})

By this command, I'm able to create a new node and I can see the node in a graph view.

It looks like this.

enter image description here

I didn't understand that why it's label is showing a blank? I need to set the user's first_name as a label while creating a new node.

Rajendra Kadam
  • 4,004
  • 1
  • 10
  • 24
Sachin Shah
  • 4,503
  • 3
  • 23
  • 50

1 Answers1

1

I am adding an example to select a default caption. (FYI What you are asking is called caption, Label means different in Neo4j, Here "Student" is the label).

Click on the Label (Red colored selection) and select the caption property from the bottom of the tab(Blue colored selection).enter image description here

Rajendra Kadam
  • 4,004
  • 1
  • 10
  • 24
  • Yes, I have already done this. But as you say I have to click on it and I have to set it manually. But I have to set it dynamically. – Sachin Shah Jul 09 '19 at 06:54
  • I think we have to set the label which we want for one time and in next when any new node will add, it'll set the label automatically which we set from the first time. This is what I maked. I have set the first_name and then I have 10 more data and in all data I got first_name as a label in node. – Sachin Shah Jul 09 '19 at 06:57
  • Right. you have to set it once. – Rajendra Kadam Jul 09 '19 at 06:59
  • 1
    Of course, It is the right thing. How can neo4j browser know what to show unless you tell it? – Rajendra Kadam Jul 09 '19 at 07:01
  • There can be any number of properties on the node, you have to choose which one to show – Rajendra Kadam Jul 09 '19 at 07:02
  • You can also set the default caption for all type of nodes or a particular type of node with GRASS-files. – Rajendra Kadam Jul 09 '19 at 07:06
  • I think it should provide any method like setLabel(s.first_name)... So in this way node can understand which property I have to set in a label. – Sachin Shah Jul 09 '19 at 07:20
  • 1
    The visualization is separate from the actual database. The database just returns data, it's up to the visualizer to display it. Display info does not belong in the database itself. – InverseFalcon Jul 09 '19 at 14:15