Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-29-2022 03:02 AM
I am new to neo4j cypher.
I have a few .json files that I copy to my DBMS's folder using python.
Once the .json files are in the folder, I'd like to create a node for each of the dictionaries inside of the json list files.
The cypher query shown belows does, quite frankly, nothing.
01-04-2023 06:05 AM - edited 01-04-2023 06:06 AM
even if this did work your reference to
CREATE(f:File)
CREATE(p:Process)
CREATE(r:Registry)
is simply going to create 3 nodes with no properties, and thus a node with label :File a node with label :Process and a node with label :Registry. .... and I suspect this is not what you want.
Maybe you want something similar to
CALL apoc.load.json('processes.json') YIELD value AS processes UNWIND processes AS Process
CREATE(p:Process) set p.image=Process.Image,
p.processguid=Process.ProcessGuid,
p.processid=Process.processid
p.utctime=Process.UtcTime;
CALL apoc.load.json('files.json') YIELD value AS files UNWIND files AS File
CREATE(f:File) set f........
CALL apoc.load.json('registry.json') YIELD value AS registries UNWIND registries AS Registry
CREATE(r:Registry) set r........
note the references above and on line 8 and 10 and to set f........ and set r........ would need to be further defined by you
01-04-2023 06:55 AM
Is there no way to load all fields from the dictionary in a generic way? Seems like a pretty common use case to me..
01-04-2023 06:58 AM - edited 01-04-2023 07:08 AM
try
CALL apoc.load.json('processes.json') YIELD value AS processes UNWIND processes AS Process
CREATE(p:Process) set p=Process
All the sessions of the conference are now available online