简体   繁体   中英

How do I run LOAD CSV using spring-boot-starter-data-neo4j?

I'm trying to run LOAD CSV to load a file into neo4j using spring-boot-starter-data-neo4j 2.7.4. Since spring data neo4j gives me access to neo4j through the Neo4jRepository interface I can only submit queries and not call LOAD CSV. Is it possible to call LOAD CSV using spring data? Is there a way to execute raw cypher through spring data? If not how can I submit a LOAD CSV command directly to neo4j using Java?

public interface MyRepository extends Neo4jRepository<SomeObject,Long>{
    @Query("LOAD CSV FROM 'https://data.neo4j.com/bands/artists.csv' AS line\n"
            + "CREATE (:Artist {name: line[1], year: toInteger(line[2])})")
    void loadCsv();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM