Your Cypher is not correct, you should use parameters. And you should use
labels.
I also recommend that you rethink your model if it wouldn't make more sense
to turn the Review into a node.
graph= Graph("http://localhost:7474/db/data/")
query = """
MATCH (au:Author {name:{author_name} }),(ai:Airline {name: { airline_name}
})
CREATE (au)-[:RATED {authorcountry: , {country}, aircraft: {aircraft} , route:
{route} }->(ai)
"""
params = {"author_name" : review.loc[review_index, 'authorname'],
"airline_name" : review.loc[review_index, 'airlinename'] ,
"country": review.loc[review_index, 'authorcountry'], "aircraft":
review.loc[review_index,
'aircraft'], "route":review.loc[review_index, 'route']}
graph.run=.run(query,params )
On Fri, Feb 24, 2017 at 4:26 AM, Gautam Shah <[email protected]>
wrote:
> I am trying to create relationship between existing nodes read from a csv
> file using py2neo. The column has to be read and matched then a relation
> has to
> be created, so that nodes are not duplicated. Thus, a variable has to be
> assigned in the matching condition, which gives an error.
>
> Below is the code:
>
>
> graph= Graph("http://localhost:7474/db/data/")
>
> graph.run=.run("""MATCH (au{name:review.loc[review_index,
> 'authorname']}),(ai{name:review.loc[review_index, 'airlinename']})
> WITH au, ai
> CREATE (au)-[:RATED{authorcountry:
> review.loc[review_index, 'authorcountry'],
> aircraft: review.loc[review_index,
> 'aircraft'],
> route: review.loc[review_index,
> 'route'] }->(ai)
>
>
>
> Error:
> py2neo.database.status.CypherSyntaxError: Invalid input ','
>
> --( in the variabl review.loc[review_index, 'authorname'] (which loops to
> fetch each column and compares with existing node) )--
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.