Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I show multiple properties on neo4j graph.?

Tags:

neo4j

In neo4j, how can I display multiple properties on graph? For example if I need to display a person's name and birth_year.

When I run this query MATCH (p:person) RETURN p.person_id, p.birth_year LIMIT 25 it shows data in tabular format in the neo4j browser. If I click on graph it says "No graph view available. You have to RETURN nodes, relationships or paths to see a graph visualization."

Any suggestions?

like image 892
Jaydeep Kubavat Avatar asked May 12 '15 07:05

Jaydeep Kubavat


People also ask

How do I add multiple nodes in Neo4j?

The create clause of Neo4j CQL is also used to create multiple nodes at the same time. To do so, you need to pass the names of the nodes to be created, separated by a comma.

Can a node have multiple labels Neo4j?

If you look closely, the labels column is in the form of an array, which means that a single node can have multiple labels. Also, with cypher projection, we can provide a virtual label, as shown in the query. One feature of the Cypher Projection is the validateRelationships parameter.

What are property keys in Neo4j?

A graph key is a property or set of properties which help you to identify a node or relationship in a graph. They are frequently used as a starting point for a graph traversal, or used as a condition to constrain.

How do I add relationships in Neo4j?

In Neo4j to create relationship between nodes you have to use the CREATE statement like we used to create nodes. lets create relation between two already created nodes.


1 Answers

The Neo4j 2.2 browser shows multiple properties when you click on a node, in the bottom panel. That does mean you need to return nodes i.e. MATCH (p:person) return p limit 25 to be able to use the graph visualization.

EDIT: You can edit the Graph Style Sheet to contain something like this:

node.person {
  color: #68BDF6;
  border-color: #5CA8DB;
  text-color-internal: #FFFFFF;
  caption: '{person_id},{birth_year}';
}

but then you'd have to do this for every kind of customization you want.

like image 180
Luanne Avatar answered Sep 30 '22 05:09

Luanne