Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-06-2022 05:06 PM
ok so im trying to import a large csv into Neo4j, Its full news article and meta data per row
I am trying to get all of this into 1 node on the graph with the article as the primary and then metadata as the properties, in theory i want to NLP the article to get "fact" extraction and have the meta data travel with it.
LOAD CSV WITH HEADERS FROM 'file:///all.csv' AS row
WITH row.raw_text AS article, row.date AS date, row.author AS author, row.description AS description, row.title AS title, row.url AS url, row.tags AS tags, row.sitename AS sitename, row.author AS author,
MERGE (a:article {article: article})
SET a.date = date, a.author = author, a.url = url, a.tags = tags, a.sitename = sitename, a.title = title
LIMIT 5;
Is throwing error
Invalid input ')': expected whitespace or a relationship pattern (line 3, column 36 (offset: 291))
"MERGE (a:article {article: article})"
I have been copy/pasting so i dont know where the formating error could have come from??
Solved! Go to Solution.
04-06-2022 06:06 PM
Hi @shiva27shiva !
I think you are missing article on your first WITH.
Another thing, you dont need to open all the properties before the set. You can do something like:
LOAD CSV WITH HEADERS FROM 'file:///all.csv' AS row
WITH row //LIMIT 5
MERGE (a:article {article: row.article})
SET a += row { .date, .author, .url, .tags, .sitename, .title}
Bennu
04-06-2022 06:06 PM
Hi @shiva27shiva !
I think you are missing article on your first WITH.
Another thing, you dont need to open all the properties before the set. You can do something like:
LOAD CSV WITH HEADERS FROM 'file:///all.csv' AS row
WITH row //LIMIT 5
MERGE (a:article {article: row.article})
SET a += row { .date, .author, .url, .tags, .sitename, .title}
Bennu
04-06-2022 06:31 PM
That got it to load thank you so much for the help. Tune in next week for my next beginner questions
Thanks
All the sessions of the conference are now available online