Hooksmultiplekeys

We are using the Geoff format and neo4j plugin to batch data into our Neo4J instance, and for the most part it works great. There are situations, however, where we need to bind to existing nodes by using more than one key. For example, we have a ZipCode label that is uniquely identified by both the actual zip code number and the country code. We also needed a way for hooks to not always create a node if it does not exist already. 

So we have implemented support for multiple keys in the hooks as well as the ability to create an optional hook (which means that if it does match an existing node, any command referencing that hook will not be imported). Unit tests are included as well. 

Updated syntax for hooks:

hook           := ":" ~ label [~ ":" ~ key]+ ~ ":" "=>" "?"? node

Examples

Bind to a Person matching both properties 'name' and 'age'

:Person:name:age:=>(ingrid:Person {"name":"Ingrid", "age":20})

Optionally bind to a Person matching both properties 'name' and 'age', and if found, Ingrid age 20 will be related to Holger age 3. If Ingrid, age 20, does not exist, no relation to Holger, age 3, will be created.

:Person:name:age:=>?(ingrid:Person {"name":"Ingrid", "age":20})
(ingrid)-[:KNOWS]->(holger:Person {"name":"Holger", "age":3})