neo4j: LOAD CSV doubled first data record of the CSV

Balael

I have a bug somewhere in my query - and any help would be very appreciated. I use LOAD CSV to import data into my DB. The CSV for testing is

"User1","Group1"
"User2","Group2"
"User3","Group3"
"User1","Group1"
"User2","Group2"

Result for the import should be

  • Every user is imported as a node without double entry
  • Every group is imported without double entries
  • The relationship between user and group is implemented

I work with this query:

LOAD CSV FROM "file:....." AS csvLine
MERGE (u:User { name: csvLine[0]})
MERGE (g:Group { name: csvLine[1]}) 
CREATE (u)-[:IS_MEMBER_OF]->(g)

Whenever I run the import I get all as expected with one exception. The first user in the csv file is always doubled - I have always two nodes with the first user name. All other users exists exactly one time. I would be happy to learn what's wrong with this approach - any comments are appreciated.

Thanks Balael

Mark Needham

I tried this and ended up with 3 Users, 3 Groups and the relationships connecting them exactly as you'd expect:

load csv from "https://gist.githubusercontent.com/mneedham/256b809f5622aebc311f/raw/0be2d9fac59ee453314c140f778c25b8fcad4b4c/file.csv" as csvLine
MERGE (u:User { name: csvLine[0]})
MERGE (g:Group { name: csvLine[1]}) 
CREATE (u)-[:IS_MEMBER_OF]->(g)

Can you show the output of doing:

MATCH (u:User) RETURN u

and:

MATCH (g:Group) RETURN g

Thanks Mark

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

neo4j: LOAD CSV doubled first data record of the CSV

From Dev

Neo4j load csv file

From Dev

Neo4J custom load CSV

From Dev

Neo4j load csv file

From Dev

Load CSV into neo4j does not fill in relationship properties

From Dev

Neo4j Load CSV Import Stalling

From Dev

Neo4j toInt conversion on LOAD CSV

From Dev

Cypher query, Load CSV not responding in Neo4j 2.1

From Dev

neo4j: Cypher LOAD CSV with uuid

From Dev

Neo4j Load csv on create set if not null

From Dev

Neo4J Load CSV -> URI is not hierarchical

From Dev

neo4j load csv invalid "ON MATCH"

From Dev

Load CSV into neo4j does not fill in relationship properties

From Dev

Neo4j relationship not getting added using Load csv

From Dev

neo4j: How to load CSV using conditional correctly?

From Dev

How to load a large csv file into Neo4j

From Dev

Exporting data from neo4j to csv instead of json

From Dev

Loading relationships from CSV data into neo4j db

From Dev

Loading data in Neo4j from csv

From Dev

Exporting data from neo4j to csv instead of json

From Dev

Loading relationships from CSV data into neo4j db

From Dev

neo4j LOAD CSV returns Couldn't Load external resource - neo4j lost in directory

From Dev

Load CSV Fails in Cypher + Neo4j "LoadExternalResourceException: Couldn't load the external resource at:"

From Dev

Neo4j 3.x LOAD CSV absolute file path

From Dev

Neo4j Cypher - creating nodes and setting labels with LOAD CSV

From Dev

Neo4j Cypher: MERGE conditionally with values from LOAD CSV

From Dev

How to use WHERE and IN to update attributes in Neo4j comblined with LOAD CSV?

From Dev

Neo4j LOAD CSV fails when multiline fields are encountered

From Dev

can I use constraint and index in a single query to load csv to neo4j?

Related Related

  1. 1

    neo4j: LOAD CSV doubled first data record of the CSV

  2. 2

    Neo4j load csv file

  3. 3

    Neo4J custom load CSV

  4. 4

    Neo4j load csv file

  5. 5

    Load CSV into neo4j does not fill in relationship properties

  6. 6

    Neo4j Load CSV Import Stalling

  7. 7

    Neo4j toInt conversion on LOAD CSV

  8. 8

    Cypher query, Load CSV not responding in Neo4j 2.1

  9. 9

    neo4j: Cypher LOAD CSV with uuid

  10. 10

    Neo4j Load csv on create set if not null

  11. 11

    Neo4J Load CSV -> URI is not hierarchical

  12. 12

    neo4j load csv invalid "ON MATCH"

  13. 13

    Load CSV into neo4j does not fill in relationship properties

  14. 14

    Neo4j relationship not getting added using Load csv

  15. 15

    neo4j: How to load CSV using conditional correctly?

  16. 16

    How to load a large csv file into Neo4j

  17. 17

    Exporting data from neo4j to csv instead of json

  18. 18

    Loading relationships from CSV data into neo4j db

  19. 19

    Loading data in Neo4j from csv

  20. 20

    Exporting data from neo4j to csv instead of json

  21. 21

    Loading relationships from CSV data into neo4j db

  22. 22

    neo4j LOAD CSV returns Couldn't Load external resource - neo4j lost in directory

  23. 23

    Load CSV Fails in Cypher + Neo4j "LoadExternalResourceException: Couldn't load the external resource at:"

  24. 24

    Neo4j 3.x LOAD CSV absolute file path

  25. 25

    Neo4j Cypher - creating nodes and setting labels with LOAD CSV

  26. 26

    Neo4j Cypher: MERGE conditionally with values from LOAD CSV

  27. 27

    How to use WHERE and IN to update attributes in Neo4j comblined with LOAD CSV?

  28. 28

    Neo4j LOAD CSV fails when multiline fields are encountered

  29. 29

    can I use constraint and index in a single query to load csv to neo4j?

HotTag

Archive