neo4j return a relationship that isn't defined

2020-03-25 neo4j cypher

I am quite new to graph databases so what I am asking may be completely made up in my head.

I have three nodes, product, supplier and country which looks like the below (feedback welcome on appraoch). neo4j graph

I would like to return the product and the country BUT I would like to return a relationship between them to show they are connected (I am envisioning two nodes connected by a line). I got this far where I can return product and supplier but no matter which way I spin the syntax I can't seem to get product and country connected by a relationship on return. Is that even possible?

match (p1:part)<--(s1:supplier)-->(c1:country) return (p1)--(s1)

Any help would be greatly appreciated.

Regards, Adam


You can use the APOC virtual nodes and relationships functions to visualize relationships (or nodes) that do not really exist in the DB.

For example:

MATCH (p:part)<-[:SUPPLIES]-(:supplier)-[:LOCATED_IN]->(c:country)
RETURN p, c, apoc.create.vRelationship(p, 'IS_IN', {}, c) as rel

produces this visualization in the neo4j Browser:

enter image description here