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.

Apoc.import.graphml with Neo4j 4.0.0

Hi dear Community,

yesterday I upgraded to Neo4j 4.0 and am still struggling with some bugs. One of them concerns the apoc.import.graphml procedure.

The aim: import a graphml file that is somewhere on my local machine. Particularly, it is NOT in the import folder of my Neo4j graph.

Before the upgrade I used to import my graphml by

CALL apoc.import.graphml( '/C:/Users/.../graph.graphml', {batchSize: 10000, readLabels: true, useTypes: true})

However, using the exact same file String as before after the update, I get the error: Failed to invoke procedure apoc.import.graphml: Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 2:

Now, I tried several ways of transforming the file location which gave me different errors:

  • ''C:/Users/.../graph.graphml" (without leading '/') results in the error Failed to invoke procedure apoc.import.graphml: Caused by: java.io.FileNotFoundException: C:\Users....Neo4jDesktop\neo4jDatabases\database-69e88dd7-63b9-483d-8666-faa9171664e9\installation-4.0.1\import\Users...\graph.graphml

  • "C://Users//...//graph.graphml" (using double '/') results in the error Failed to invoke procedure apoc.import.graphml: Caused by: java.io.FileNotFoundException: C:\Users....Neo4jDesktop\neo4jDatabases\database-69e88dd7-63b9-483d-8666-faa9171664e9\installation-4.0.1\import\Users...\graph.graphml

  • "C:\Users...\graph.graphml" (using '\') results in the error Invalid input 's': expected four hexadecimal digits specifying a unicode character (line 1, column 32 (offset: 31))

From most of the errors, it seems to me that the APOC always tries to look into the import folder of my graph database. Does anyone know, if it is still possible to import graphml's from different locations than the import folder?

I appreciate every help. Thank you.
Regards,
Elena

1 ACCEPTED SOLUTION

Hi elena,

Thanks!
My answer was not a good answer.
The right answer is to set it up like you.

I changed the settings in neo4j.conf.
This setting is for my Mac (not Windows)

dbms.directories.import=/

Then I can access the root directory /.

View solution in original post

4 REPLIES 4

Hi Elena,

You can comment out this line in neo4j.conf (dbms.directories.import=import) and restart neo4j.

# allow files to be loaded from anywhere in the filesystem; this introduces possible security problems. See the
# `LOAD CSV` section of the manual for details.
dbms.directories.import=import

Hi Koji!

Thank you very much for your answer!
However, only commenting out the line did not help me. It made the default folder "jump up" one level making the folder Neo4jDesktop\neo4jDatabases\database-69e88dd7-63b9-483d-8666-faa9171664e9\installation-4.0.1 the default.

But, setting

dbms.directories.import = C:/

helped putting the C drive as the default folder from where I then can access the needed folder.

The perfect solution of course would be to set it even one level higher to also be able to access files from other drives...

Hi elena,

Thanks!
My answer was not a good answer.
The right answer is to set it up like you.

I changed the settings in neo4j.conf.
This setting is for my Mac (not Windows)

dbms.directories.import=/

Then I can access the root directory /.

Hi Koji,

awesome, it also works for Windows. Issue solved.

Thank you very much for your help!

Elena