cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Neo.ClientError.Statement.SyntaxError

IchsanALi
Node Link

I have data:

IchsanALi_0-1660527423006.png

upload data :

load csv with headers from "file:///data_latihan.csv" as row
merge(v:Character{name: row.source})
merge(t:Character{name: row.target})
with v, t, row
call{
with v, t, row
with v, t, row
where row.Relasi = 'Mentions'
merge(t)-[:MENTIONS]->(v)
}
call{
with v, t, row
with v, t, row
where row.Relasi = 'Replies_to'
merge(t)-[:REPLIES_TO]->(v)
}
call{
with v, t, row
with v, t, row
where row.Relasi = 'Tweet'
merge(t)-[:TWEET]->(v)
}
call{
with v, t, row
with v, t, row
where row.Relasi = 'MentionsInRetweet'
merge(t)-[:MentionsInRetweet]->(v)
}
call{
with v, t, row
with v, t, row
where row.Relasi = 'Retweet'
merge(t)-[:Retweet]->(v)
}

call graph:

MATCH p=(:Character)-[:TWEET|MENTIONS|REPLIES_TO|MentionsInRetweet|Retweet]-(:Character)
RETURN p limit 100

output :

IchsanALi_1-1660527721376.png

I have a problem calling graph, filter by ket = "ichsan"

I try like this,

MATCH p=(:Character)-[:TWEET|MENTIONS|REPLIES_TO|MentionsInRetweet|Retweet]-(:Character)
where row.ket = 'ichsan'
RETURN p limit 100

Neo.ClientError.Statement.SyntaxError

Variable `row` not defined (line 2, column 7 (offset: 95))
"where row.ket = 'ichsan'"
       ^

 

1 REPLY 1

dana_canzano
Neo4j
Neo4j

@IchsanALi 

You first cypher

load csv with headers from "file:///data_latihan.csv" as row
merge(v:Character{name: row.source})
merge(t:Character{name: row.target})
with v, t, row
...
......
.........

reads file:///data_latihan.csv and each row from this file is aliased to variable row and his variable is used in subsequent merge/call statements.

The 2nd cypher statement makes no reference to row and as the first statement is complete it is no longer available in cypher context.

Given 'ichsan' is in your data and from the initial cypher it appears to be associated with nodes which have label :Character.   If this is the case then try

I try like this,

MATCH p=(c:Character)-[:TWEET|MENTIONS|REPLIES_TO|MentionsInRetweet|Retweet]-(:Character)
where c.ket = 'ichsan'
RETURN p limit 100

also from a performance perspective if this is a common/frequent query you might want to create an index on :Character(ket);

 

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit - November 16 - 17, 2022.


Free NODES Training Series


October 19th -

Intro to Neo4j


October 20th -

Healthcare Analytics Using Neo4j


October 25th -

Handling Neo4j data with Apache Hop


October 26th -

Blazing Fast Graphs: Hands-on with Apache Arrow and Neo4j


November 2nd -

Graph EDA Using the Neo4j GDS Client