set_property

**Set property ** is a collection of Memgraph's dynamical access and edit of node and relationship properties. The procedures included in it involve copying properties from one entity to another.

TraitValue
Module typemodule
ImplementationC++
Graph directiondirected/undirected
Edge weightsunweighted/weighted
Parallelismsequential

Procedures

copyPropertyNode2Node()

Copies properties from one node to another.

Input:

  • subgraph: Graph (OPTIONAL) ➡ A specific subgraph, which is an object of type Graph returned by the project() function, on which the algorithm is run.
  • sourceNode: Vertex ➡ The node you want to copy property from.
  • sourceProperties: List[string] ➡ List of properties you want to copy from.
  • targetNode: Vertex ➡ The node you want to copy property to.
  • targetProperties: List[string] ➡ List of properties you want to copy to.

Output:

  • result: boolean ➡ yields true if the operation was successful, false otherwise

Usage:

MATCH (from {id:1}), MATCH (to {id: 2})
CALL set_property.copyPropertyNode2Node(from, ["prop"], to, ["prop"]) YIELD result
RETURN result;

copyPropertyNode2Rel()

Copies properties from one node to another relationship.

Input:

  • subgraph: Graph (OPTIONAL) ➡ A specific subgraph, which is an object of type Graph returned by the project() function, on which the algorithm is run.
  • sourceNode: Vertex ➡ The node you want to copy property from.
  • sourceProperties: List[string] ➡ List of properties you want to copy from.
  • targetRel: Relationship ➡ The relationship you want to copy property to.
  • targetProperties: List[string] ➡ List of properties you want to copy to.

Output:

  • result: boolean ➡ yields true if the operation was successful, false otherwise

Usage:

MATCH (from {id:1})-[to:TYPE]->({id: 2})
CALL set_property.copyPropertyNode2Rel(from, ["prop"], to, ["prop"]) YIELD result
RETURN result;

copyPropertyRel2Node()

Copies properties from one relationship to another node.

Input:

  • subgraph: Graph (OPTIONAL) ➡ A specific subgraph, which is an object of type Graph returned by the project() function, on which the algorithm is run.
  • sourceRel: Relationship ➡ The relationship you want to copy property from.
  • sourceProperties: List[string] ➡ List of properties you want to copy from.
  • targetNode: Vertex ➡ The node you want to copy property to.
  • targetProperties: List[string] ➡ List of properties you want to copy to.

Output:

  • result: boolean ➡ yields true if the operation was successful, false otherwise

Usage:

MATCH (to {id:1})-[from:TYPE]->({id: 2})
CALL set_property.copyPropertyRel2Node(from, ["prop"], to, ["prop"]) YIELD result
RETURN result;

copyPropertyRel2Rel()

Copies properties from one relationship to another.

Input:

  • subgraph: Graph (OPTIONAL) ➡ A specific subgraph, which is an object of type Graph returned by the project() function, on which the algorithm is run.
  • sourceRel: Vertex ➡ The relationship you want to copy property from.
  • sourceProperties: List[string] ➡ List of properties you want to copy from.
  • targetRel: Vertex ➡ The relationship you want to copy property to.
  • targetProperties: List[string] ➡ List of properties you want to copy to.

Output:

  • result: boolean ➡ yields true if the operation was successful, false otherwise

Usage:

MATCH ({id:1})-[from:TYPE]->(to {id: 2}), ({id:3})-[to:TYPE]->(to {id: 4})
CALL set_property.copyPropertyRel2Rel(from, ["prop"], to, ["prop"]) YIELD result
RETURN result;