Home > Enterprise >  Neo4j issue during running the merge syntax how can it be solved?
Neo4j issue during running the merge syntax how can it be solved?

Time:02-22

    LOAD CSV WITH HEADERS FROM 
    'file:///epl_mataches.csv' as row 
    MATCH (c1:Club {name:row.`Team1`}), (c2:Club {name:row.`Team2`})
    MERGE (c1) -[f:FEATURED{
        round:toInteger(row.Round),
        date:row.Date,
        homeTeamFTScore: toInteger(split(row.FT,"-" [0])),
        awayTeamFTScore: toInteger(split(row.FT,"-" [1])),
        homeTeamHTScore: toInteger(split(row.HT,"-" [0])),
        awayTeamHTScore: toInteger(split(row.HT,"-" [1]))
    }] -> (c2)

The error is present when I try to create the relationships and to pull through the required information from the data file.

Neo.ClientError.Statement.SyntaxError
Type mismatch: expected List<T> but was String (line 7, column 45 (offset: 248))
"    homeTeamFTScore: toInteger(split(row.FT,"-" [0])),"

CodePudding user response:

There is a typo on your script, so instead of

homeTeamFTScore: toInteger(split(row.FT,"-" [0])),

Use below

homeTeamFTScore: toInteger(split(row.FT,"-") [0])

Notice the parenthesis before [0] and NOT after it.

For example:

RETURN toInteger(split("2-test","-") [0]) as sample

 result:
╒════════╕
│"sample"│
╞════════╡
│ 2      │
└────────┘
  • Related