Problems using LOAD CSV within NEO4J -OGM

Hi,

Using the standard java driver (org.neo4j.driver.v1.Session) i have had the LOAD CSV functionality working perfectly correctly for some time.
e.g. StatementResult x = mySession.run("cypher query encapsulating LOAD CSV statement");

However i now need to convert this to operate under an OGM Session.
e.g. Result x = myOgmSession.query("cypher query encapsulating LOAD CSV statement", parameterMap);
Currently it is throwing a "Couldn't load external resource at..." exception. I have double checked and the neo4j.conf file is correctly setup concerning importing.

I have also subsequently read in a previous topic on this stream (Spring Data Neo4j & Neo4j-OGM) that it is not possible to use LOAD CSV with OGM/SDN.

so my question is - is it possible to invoke a LOAD CSV based cypher query using an OGM Session ?

If it is - what am i doing wrong? Do i need to set something additional when creating the OGM configuration.

best regards

R

It should basically work the same way with OGM as it works with the driver.
Could you maybe give more input about the exception you are facing or if you do a local file import?

Please have a look at an example I build to verify you did about the same. neo4j-issues-examples/load-csv at master · meistermeier/neo4j-issues-examples · GitHub

Hi,

some immediate responses

Re the Exception - just caught it as Exception so do not know the exact sub type - however the exact informational message (extracted from the thrown exception) started with "Couldn't load the external resource at .." - which i recognised as Neo4J specific - in the early days of developing this app i got the same exception and solved it by adjusting the import entries in Ne04j.conf.

I am importing from local files. The same location and files load perfectly when using the driver.

Looked at your example .
Firstly the LoadCsvWithOGM is effectively empty - so i cannot make any comments.
Secondly the LoadCsvWithDriver. i think I am doing roughly the same as you. But for avoidance of doubt i have created my equivalent (see below). i have highlighted the important differences in red

import org.neo4j.driver.v1.AuthTokens;
import org.neo4j.driver.v1.Driver;
import org.neo4j.driver.v1.StatementResult;
import org.neo4j.driver.v1.GraphDatabase;
import org.neo4j.driver.v1.Session;

........
// load csv with driver

Driver graphDatabaseDriver = GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("neo4j","password"));
Session graphDatabaseSession = graphDatabaseDriver.session();
try (
//No explicit transaction
cypherQuery = "LOAD CSV WITH HEADERS FROM '" + "file:///" + areaForWorking.replace("\\", "\\\\") + baseFilename + ".csv' AS row " +
"MATCH (n:Element { ElementGuid: row.ElementGuid}) USING INDEX n:Element(ElementGuid) " +
"SET " + propertiesToPopulate +
" SET n" + graphLabel();
StatementResult result = graphDatabaseSession.run(cypherQuery);
}

I went back to the project and made it a local file import with some instructions in the readme.

Basically both files look and behave the same.
Please make sure that the database is configured correctly.