Where to store local json file for access by stored procedure in Desktop

Hello,
I've written a stored procedure to load a graph with objects from a json file from Neo4j Desktop. I'm running in MacOS. However, I don't know where to put the json file for reference by a FileReader. E.g.:
new FileReader("file:///myfile.json");

I'm getting a FileNotFound error.

Things I've tried:

  • I know the apoc expects files to be in the db "import" directory, but that directory doesn't seem to be where my procedure is looking.
  • putting the file in the db "plugins" directory doesn't work either.
  • I've tried calling for the "current working directory" in Java, but the Neo4j container is preventing that from being useful.
  • I also tried an absolute path with the filename and that didn't work. I think the container is preventing that as well.
  • I've modified the "import" settings in the db config to be less restrictive, but that didn't help either.

Any help is appreciated.
Thanks!

(note: edited for more clarity)

You don't mention what your configuration is or what error message?

In docker, I put the files in /var/import and they are all always found.

You can also put them in a (local) web server to avoid putting them in the file system.

Finally, not sure if you could instead use first apoc.load.json to see if it finds your file ?

I edited my post to provide more useful information.

Thanks for the suggestion of hosting them in a web server. If I'm unable to get it to load from a directory, then I'll go that route.

apoc.load.json expects the file to be in the current db "import" directory, and I've called that procedure successfully. However, that location isn't working for my procedure.

Unfortunately, I'm working on a corporate machine and don't have permissions to access /var/import. I believe I'm stuck in whatever Neo4j Desktop requires -- which is currently unknown to me.

You'll find the right folder:

CALL dbms.listConfig() YIELD name, value
WHERE name='server.directories.import'
RETURN name, value
1 Like

That worked. Thanks sooo much!
I found a similar cypher query in another post, but it didn't return anything. I think the setting name might have changed.
I'm going to write that setting name on my screen using a sharpie ;)

1 Like