I am new to Neo4j and experimenting with it. Please assist.
Blog I followed : Cypher: LOAD JSON from URL AS Data - Neo4j Graph Data Platform
File name : citeaa
"citation":
[
{"id":1388,
"authors":[{"name":"Pranava K. Jha","id":2718958994}],
"title":"Further Results on Independence in Direct-Product Graphs.",
"year":2000,
"n_citation":1,
"page_start":"",
"page_end":"",
"doc_type":"Journal",
"publisher":"",
"volume":"56",
"issue":"",
"doi":"",
"fos":[{"name":"Graph","w":0.0},{"name":"Discrete mathematics","w":0.45872},{"name":"Combinatorics","w":0.4515},{"name":"Direct product","w":0.59104},{"name":"Mathematics","w":0.42784}],
"venue":{"raw":"Ars Combinatoria","id":73158690,"type":"J"}}
Below is my query and above is my JSON data. I don't know why I can't load data it just complains with all the tweak I tried.
devendra@neo4j> WITH "file:///citeaa" AS url
CALL apoc.load.json(url) YIELD value
UNWIND value.citations as q
MERGE (citation:citations {id:q.id}) ON CREATE
SET citation.id = q.id, citation.title = q.title, citation.year = q.year, citation.n_citation = q.n_citation, citation.page_start = q.page_start, citation.page_end = q.page_end, citation.doc_type = q.doc_type, citation.publisher = q.publisher, citation.volume = q.volume, citation.issue = q.issue, citation.doi = q.doi
MERGE (venue:venue {id:q.venue.id}) ON CREATE SET venue.id = q.venue.id, venue.raw = q.venue.raw, venue.type = q.venue.type
MERGE (venue)-[:FOR]->(citation)
FOREACH (a IN q.authors |
MERGE (author:authors {name:q.authors.name, id:q.authors.id}) ON CREATE
SET author.name = q.authors.name
MERGE (citation)<-[:AUTHORED_BY]-(authors)
MERGE (citation)-[:WROTE_BY]->(authors))
FOREACH (f IN q.fos |
MERGE (citation)<-[:FOS_DETAILS]-(fos:Fos {name:f.name})
MERGE (author:authors {name:a.name, id:a.id}) ON CREATE
SET fos.name = f.name, fos.w = f.w
);
Variable a
not defined (line 20, column 32 (offset: 961))
" MERGE (author:authors {name:a.name, id:a.id}) ON CREATE"