Consider a Neo4J 2.0 Cypher request
MERGE (u:User {id_str:"123"}) ON CREATE SET {giant_params_string_from_twitter_api} ON MATCH SET u.lastSeen = timestamp() RETURN u
Here I downloaded the user's metadata from Twitter, and if the user does not exist, I insert all of his metadata. If the user already exists, I just change his timestamp.
The Twitter API call required to retrieve the parameters is long and expensive (especially considering that I continue to get the speed limit). And a lot of time node already exists in the database. Here is the best:
MERGE (u:User {id_str:"123"}) ON CREATE SET get_twitter_params("123") ON MATCH SET u.lastSeen = timestamp() RETURN u
In ON CREATE, I would like to somehow call a callback to pull this data.
Is there any way to cause the creation of my own function to be used in Cypher?
source share