how to match entity type dynamic from database data in neo4j

32 Views Asked by At

I want to add relationship. I used apoc to batch add relationship and read data from mysql tables. I have to match entity types dynamic from mysql values.

the column value in mysql is like this: 'entity_name/value' I have to split it . so my code is

match(p:split(toString(row.from_key),'/')[0]{from_key:split(toString(row.from_key),'/')[1]})

and this failed .

I can only use solid patten like match(p:entity_name{from_key:split(toString(row.from_key),'/')[1]}) and this worked.

1

There are 1 best solutions below

4
Charchit Kapoor On BEST ANSWER

You can try something like this:

MATCH (p) 
WHERE split(toString(row.from_key),'/')[0] IN labels(p) 
AND p.from_key = split(toString(row.from_key),'/')[1]