Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Feature request: createRel, add Duplicates parameter #77

Open
ch-ricardor opened this issue May 2, 2018 · 1 comment
Open

Feature request: createRel, add Duplicates parameter #77

ch-ricardor opened this issue May 2, 2018 · 1 comment

Comments

@ch-ricardor
Copy link

ch-ricardor commented May 2, 2018

createRel
createRel(alice, "KNOWS", charles, props)

Would be nice to have:
createRel(alice, "KNOWS", charles, props, duplicates = TRUE )
or
getOrCreateRel = createRel(alice, "KNOWS", charles, props, duplicates = FALSE )

createRel(
In this case duplicates with default value TRUE, to not modify the actual functionality in previous implementations.

the code:

before the link creation, is it possible to check if the link exists if duplicates is FALSE.

query = paste0("MATCH (a),(b) WHERE ID(a)={a} AND ID(b)={b} CREATE (a)-[r:", .relType, " {props}]->(b) RETURN r")

Country->Region
createRel(lknGcCt_n, 'IS_IN',lknGcS_n)

if the script runs several times creates the same relationship multiple times.

image

At the moment it is possible to use:

if ( is.null( outgoingRels(lknGcCt_n,'IS_IN') ) )

The relationship is One to One, in cases One to many it is not possible.

At the moment I'm using something like:

num_rels <- getRels(graph,"MATCH (:Geo_Code {code:{from_code}})-[r:IS_IN]->(:Geo_Code {code:{to_code}}) RETURN r", from_code = lknGcCt_n$code, to_code = lknGcS_n$code)
if ( length(num_rels) == 0 ) {
createRel(lknGcCt_n, 'IS_IN',lknGcS_n)

@sajukassim
Copy link

Yes. This will highly appreciated..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants