I have read all information about importing json but find that documentation poor. The memgraph docs say, just do this:
CALL json_util.load_from_url("https://download.memgraph.com/asset/mage/data.json")
YIELD objects
UNWIND objects AS o
RETURN o.first_name AS name, o.last_name AS surname;
But that does not do it, because a typical json graph dataset has several properties holding nodes and links with arbitrary properties:
{
nodes: [ ... ],
links: [ ... ],
...
}
So we need to access these properties and we need to create nodes with all properties of the imported objects. I cant find any documentation on how to do this. I finally managed to create nodes inside memgraph with the correct type ("ENTITY") but do not see how I can assign those nodes all properties from the imported json data:
CALL json_util.load_from_path("/data.json")
YIELD objects // "objects" is the named result from the function above
UNWIND objects as o // create a list of the properties of the imported result, which is a single object in my case and in most cases
UNWIND o.nodes as n // select the nodes and return them as list
CREATE (e:ENTITY { id:n.id }) // all nodes will have 1 property, "id"
RETURN e
All nodes will have 1 property, "id", but I need all properties. How is this done. Where is the documentation or the book that explains that?
In javascript I would write
CREATE (e:ENTITY { ...n })
How is this done in Cypher? Or how can this done in memgraph with another language or tool?