cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to specify relationship properties when using apoc.graph.fromDocument?

Hi, I'm looking at creating nodes + relationships using apoc.graph.fromDocument but am having trouble figuring out how to specify properties for relationships. For example, how would one specify the "roles:Forrest" property of the ACTED_IN relationship? Any help much appreciated! Thanks!!

CREATE (a:Actor {name:'Tom Hanks'})-[r:ACTED_IN {roles:'Forrest'}]->(m:Movie {title:'Forrest Gump'})
RETURN *

Something like the following but not sure how to incorporate the 'roles' bit...

{
  "id": 1,
  "type": "Actor",
  "name": "Tom Hanks",
  "actedIn": [
    {
      "type": "movies",
      "id": 1,
      "title": "Forrest Gump"
    }
  ]
}
1 REPLY 1

@predman

It seems that currently the procedure doesn't provide this feature.
It's possible put in the configuration parameter a mapping to filter/customize nodes, and a relMapping to change the default relationship type.

Maybe this relMapping could be improved, it could support a map instead of a string to pick property to put into the relationship, or something like that.

I suggest you to open a GitHub feature issue here to track this.