cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Neo.ClientError.Statement.SyntaxError

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

@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

All the sessions of the conference are now available online