Thanks to visit codestin.com
Credit goes to github.com

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

Feature request: createRel, add Duplicates parameter #77

@ch-ricardor

Description

@ch-ricardor

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions