0

I try to fetch the relatioships in order to render a neo4j graph using alchemy.js accorfind to the example I need to generate a Json that contains the nodes and links

For the nodes I manage to list all graphs nodes using the query:

MATCH (p) SET p.id = ID(p) return p

And afterwards I can manage the relationship data with:

MATCH (p1)-[n]->(p2) return n,ID(p1),ID(p2)

But how I can get the relationship name in order ot use it as caption?

I mean if I have a relationship:

(:POINT)-[:LINKS]->(:POINT)

How I can get the LINKS string, in other words the relatioship name.

Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164

1 Answers1

2

You should return the path directly,

MATCH path = (p1)-[n]->(p2) return path

Correction:

you can use type(n) in cypher.

MATCH (p1)-[n]->(p2) return type(n)
Liping Huang
  • 4,378
  • 4
  • 29
  • 46