neo4jneo4j-apocapoc

how to match entity type dynamic from database data in neo4j


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.


Solution

  • 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]