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 Cypher - creating nodes and setting labels with LOAD CSV

From Dev

Cypher query, Load CSV not responding in Neo4j 2.1

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

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

From Dev

Exporting data from neo4j to csv instead of json

From Dev

neo4j: Cypher LOAD CSV with uuid

From Dev

neo4j: LOAD CSV doubled first data record of the CSV

From Dev

Loading relationships from CSV data into neo4j db

From Dev

Neo4j Load csv on create set if not null

From Dev

Neo4j Load CSV Import Stalling

From Dev

Neo4j LOAD CSV fails when multiline fields are encountered

From Dev

Neo4j load csv file

From Dev

Neo4J Load CSV -> URI is not hierarchical

From Dev

Neo4j toInt conversion on LOAD CSV

From Dev

Neo4j 3.x LOAD CSV absolute file path

From Dev

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

From Dev

Load CSV into neo4j does not fill in relationship properties

From Dev

Neo4J custom load CSV

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 invalid "ON MATCH"

From Dev

Neo4j load csv file

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

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

From Dev

How to load a large csv file into Neo4j

Related Related

  1. 1

    Neo4j Cypher - creating nodes and setting labels with LOAD CSV

  2. 2

    Cypher query, Load CSV not responding in Neo4j 2.1

  3. 3

    Neo4j Cypher: MERGE conditionally with values from LOAD CSV

  4. 4

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

  5. 5

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

  6. 6

    Exporting data from neo4j to csv instead of json

  7. 7

    neo4j: Cypher LOAD CSV with uuid

  8. 8

    neo4j: LOAD CSV doubled first data record of the CSV

  9. 9

    Loading relationships from CSV data into neo4j db

  10. 10

    Neo4j Load csv on create set if not null

  11. 11

    Neo4j Load CSV Import Stalling

  12. 12

    Neo4j LOAD CSV fails when multiline fields are encountered

  13. 13

    Neo4j load csv file

  14. 14

    Neo4J Load CSV -> URI is not hierarchical

  15. 15

    Neo4j toInt conversion on LOAD CSV

  16. 16

    Neo4j 3.x LOAD CSV absolute file path

  17. 17

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

  18. 18

    Load CSV into neo4j does not fill in relationship properties

  19. 19

    Neo4J custom load CSV

  20. 20

    Loading data in Neo4j from csv

  21. 21

    Exporting data from neo4j to csv instead of json

  22. 22

    Loading relationships from CSV data into neo4j db

  23. 23

    neo4j load csv invalid "ON MATCH"

  24. 24

    Neo4j load csv file

  25. 25

    Load CSV into neo4j does not fill in relationship properties

  26. 26

    Neo4j relationship not getting added using Load csv

  27. 27

    neo4j: How to load CSV using conditional correctly?

  28. 28

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

  29. 29

    How to load a large csv file into Neo4j

HotTag

Archive