From c3e08046ed5015d3a06786bdc7d9161a15010ee7 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Fri, 11 Aug 2023 12:37:47 +0200
Subject: [PATCH 01/11] initial create module docs
---
mage/query-modules/cpp/create.md | 36 ++++++++++++++++++++++++++++++++
mage/templates/_mage_spells.mdx | 1 +
sidebars/sidebarsMAGE.js | 1 +
3 files changed, 38 insertions(+)
create mode 100644 mage/query-modules/cpp/create.md
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
new file mode 100644
index 00000000000..bbb092bcb42
--- /dev/null
+++ b/mage/query-modules/cpp/create.md
@@ -0,0 +1,36 @@
+---
+id: create
+title: create
+sidebar_label: create
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import RunOnSubgraph from '../../templates/_run_on_subgraph.mdx';
+
+export const Highlight = ({children, color}) => (
+
+{children}
+
+);
+
+By enabling more precise and flexible creation of nodes and relationships within the graph structure, the `create` module enhances the ability of developers to model, manipulate, and query complex graph data.
+
+[![docs-source](https://img.shields.io/badge/source-create-FB6E00?logo=github&style=for-the-badge)](https://github.com/memgraph/mage/tree/main/cpp/create_module)
+
+| Trait | Value |
+| ------------------- | ----------------------------------------------------- |
+| **Module type** | **algorithm** |
+| **Implementation** | **C++** |
+| **Graph direction** | **directed**/**undirected** |
+| **Edge weights** | **weighted**/**unweighted** |
+| **Parallelism** | **sequential** |
+
+### Procedures
+
diff --git a/mage/templates/_mage_spells.mdx b/mage/templates/_mage_spells.mdx
index 83634d4a33b..86db4820360 100644
--- a/mage/templates/_mage_spells.mdx
+++ b/mage/templates/_mage_spells.mdx
@@ -8,6 +8,7 @@
| [bridges](/mage/query-modules/cpp/bridges) | C++ | A bridge is an edge, which when deleted, increases the number of connected components. The goal of this algorithm is to detect edges that are bridges in a graph. |
| [collections](/mage/query-modules/cpp/collections) | C++ | The collections module is a collection manipulation module that offers functions to work with lists in Cypher queries, allowing operations like filtering, sorting, and modification for efficient data handling. |
| [community_detection](/mage/query-modules/cpp/community-detection) | C++ | The Louvain method for community detection is a greedy method for finding communities with maximum modularity in a graph. Runs in _O_(*n*log*n*) time. |
+| [create](/mage/query-modules/cpp/create) | C++ | The create module is a set of powerful tools that provide additional capabilities for creating nodes and relationships in the Memgraph graph database. |
| [cycles](/mage/query-modules/cpp/cycles) | C++ | Algorithm for detecting cycles on graphs. |
| [distance_calculator](/mage/query-modules/cpp/distance-calculator) | C++ | Module for finding the geographical distance between two points defined with 'lng' and 'lat' coordinates. |
| [degree_centrality](/mage/query-modules/cpp/degree-centrality) | C++ | The basic measurement of centrality that refers to the number of edges adjacent to a node. |
diff --git a/sidebars/sidebarsMAGE.js b/sidebars/sidebarsMAGE.js
index 3d940c7c061..82ca0c158a6 100644
--- a/sidebars/sidebarsMAGE.js
+++ b/sidebars/sidebarsMAGE.js
@@ -31,6 +31,7 @@ module.exports = {
"query-modules/cpp/community-detection",
"query-modules/cpp/community-detection-online",
"query-modules/cpp/conditional-execution",
+ "query-modules/cpp/create",
"query-modules/cpp/cycles",
"query-modules/cuda/cugraph",
"query-modules/cpp/degree-centrality",
From 1d194339a79100aee96136b00d293723809a93d6 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Fri, 11 Aug 2023 13:44:07 +0200
Subject: [PATCH 02/11] add create.node docs
---
mage/query-modules/cpp/create.md | 37 ++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index bbb092bcb42..334196f44a2 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -34,3 +34,40 @@ By enabling more precise and flexible creation of nodes and relationships within
### Procedures
+### `node(labels, properties)`
+
+Provides a more flexible way of creating nodes than Cypher’s CREATE clause.
+
+#### Input:
+
+- `labels: List[string]` ➡ list of all the labels to be added to the new node
+- `properties: Map` ➡ map with key/value pairs to be added as new node's properties
+
+#### Output:
+
+- `node: Node` ➡ new node which is added to the graph
+
+#### Usage:
+
+```cypher
+CALL create.node(["Person", "Programmer"], {name: "Ana", age: 20}) YIELD node RETURN node
+```
+
+```plaintext
++----------------------------+
+| node |
++----------------------------+
+| { |
+| "id": 1, |
+| "labels": [ |
+| "Person", |
+| "Programmer" |
+| ], |
+| "properties": { |
+| name: "Ana", |
+| age: 20 |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
+```
From 2cb24bea2be9ea14a4257e4a866e94f99aaf8208 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Mon, 14 Aug 2023 10:35:55 +0200
Subject: [PATCH 03/11] add rest of create docs
---
mage/query-modules/cpp/create.md | 134 +++++++++++++++++++++++++++++++
1 file changed, 134 insertions(+)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index 334196f44a2..dd4f5d301db 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -71,3 +71,137 @@ CALL create.node(["Person", "Programmer"], {name: "Ana", age: 20}) YIELD node RE
| } |
+----------------------------+
```
+
+
+### `set_properties(input_nodes, input_keys, input_values)`
+
+Adds the provided properties to the node(s).
+
+#### Input:
+
+- `input_nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids
+- `input_keys: List[string]` ➡ list of all the property keys to be added to the node(s)
+- `input_values: List[Any]` ➡ list of all the corresponding property values to be added to the node(s)
+
+#### Output:
+
+- `nodes: Node` ➡ node(s) with new properties
+
+#### Usage:
+
+```cypher
+CREATE (:Student {name: "Ana"});
+CREATE (:Student {name: "Maria"});
+MATCH (s:Student) CALL create.set_properties(s, ["age", "grade"], [20, "1st"]) YIELD nodes RETURN nodes;
+```
+
+```plaintext
++----------------------------+
+| nodes |
++----------------------------+
+| { |
+| "id": 1, |
+| "labels": [ |
+| "Student" |
+| ], |
+| "properties": { |
+| name: "Ana", |
+| age: 20, |
+| grade: "1st" |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
+| { |
+| "id": 2, |
+| "labels": [ |
+| "Student" |
+| ], |
+| "properties": { |
+| name: "Maria", |
+| age: 20, |
+| grade: "1st" |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
+```
+
+
+### `set_rel_property(input_rel, input_key, input_value)`
+
+Adds the provided property to the relationship(s).
+
+#### Input:
+
+- `input_rel: Any` ➡ relationship, relationship's id or a list of relationships and relationships' ids
+- `input_key: string` ➡ property key to be added to the relationship(s)
+- `input_value: Any` ➡ corresponding property value to be added to the relationship(s)
+
+#### Output:
+
+- `relationship: Relationship` ➡ relationship(s) with new property
+
+#### Usage:
+
+```cypher
+MERGE (s1:Student) MERGE (s2:Student) CREATE (s1)-[k:KNOWS]->(s2);
+MATCH (:Student)-[k:KNOWS]->(:Student) CALL create.set_rel_property(k, "since", 2020)
+YIELD relationship RETURN relationship;
+```
+
+```plaintext
++----------------------------+
+| relationship |
++----------------------------+
+| { |
+| "id": 1, |
+| "start": 1, |
+| "end": 2, |
+| "label": "KNOWS", |
+| "properties": { |
+| since: 2020 |
+| }, |
+| "type": "relationship" |
+| } |
++----------------------------+
+```
+
+
+### `remove_labels(labels, nodes)`
+
+Removes the provided labels from the node(s).
+
+#### Input:
+
+- `nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids
+- `labels: List[string]` ➡ list of labels to be removed (if exist) from the nodes(s)
+
+#### Output:
+
+- `nodes: Node` ➡ node(s) without provided labels
+
+#### Usage:
+
+```cypher
+CREATE (:Person:Student:Programmer {name: "Ana"})
+MATCH (p:Person) CALL create.remove_labels(p, ["Student", "Engineer"]) YIELD nodes RETURN nodes;
+```
+
+```plaintext
++----------------------------+
+| nodes |
++----------------------------+
+| { |
+| "id": 1, |
+| "labels": [ |
+| "Person", |
+| "Programmer", |
+| ], |
+| "properties": { |
+| name: "Ana" |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
+```
\ No newline at end of file
From b094f856b5d3a1f1fcf39adbd7adf889a04602ce Mon Sep 17 00:00:00 2001
From: imilinovic
Date: Wed, 16 Aug 2023 13:25:54 +0200
Subject: [PATCH 04/11] add part of create docs
---
mage/query-modules/cpp/create.md | 124 +++++++++++++++++++++++++++++++
1 file changed, 124 insertions(+)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index bbb092bcb42..52fad57f066 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -34,3 +34,127 @@ By enabling more precise and flexible creation of nodes and relationships within
### Procedures
+### `relationship(from, relationshipType, properties, to)`
+
+Creates a new relationship with the given type and properties directed from->to.
+
+#### Input:
+
+- `from: Node` ➡ tail node
+- `relationshipType: string` ➡ relationship type
+- `properties: Map` ➡ properties of the new relationship(s)
+- `to: Node` ➡ head node
+
+#### Output:
+
+- `relationship: Relationship` ➡ the new relationship(s)
+
+#### Usage:
+
+```cypher
+CREATE (p:Person {name: "Cillian Murphy"});
+CREATE (m:Movie {title:"Oppenheimer"});
+
+MATCH (p:Person {name: "Cillian Murphy"}) MATCH (m:Movie {title: "Oppenheimer"}) CALL create.relationship(p, "ACTED_IN", {roles:['Oppenheimer']}, m) YIELD relationship RETURN relationship;
+```
+
+```plaintext
++-----------------------------+
+| relationship |
++-----------------------------+
+| { |
+| "id": 0, |
+| "start": 0 |
+| "end": 0 |
+| "label": "Acted_in" |
+| "properties": { |
+| roles: ["Oppenhimer"] |
+| }, |
+| "type": "relationship" |
+| } |
++-----------------------------+
+```
+
+### `set_rel_properties(relationships, keys, values)`
+
+Adds the provided properties to the given relationships and returns the modified relationships. If the property already exists it is modified.
+
+#### Input:
+
+- `relationships: int|Relationship|List[int|Relationship]` ➡ relationships to be modified given by their object or id
+- `keys: List[string]` ➡ list of all the property keys to be added to the relationship(s)
+- `values: List[Any]` ➡ list of all the corresponding property values to be added to the relationship(s)
+
+#### Output:
+
+- `relationship: Relationship` ➡ the modified relationship(s)
+
+#### Usage:
+
+```cypher
+CREATE (idora:Person {name: "Idora"})
+CREATE (ivan:Person {name: "Ivan"})
+CREATE (ivan)-[:Friend {since:"long ago"}]->(idora);
+
+MATCH (:Person)-[friends:Friend]->(:Person) CALL create.set_rel_properties(friends, ["really", "until"], [true, "forever"]) YIELD relationship RETURN relationship
+```
+
+```plaintext
++----------------------------+
+| relationship |
++----------------------------+
+| { |
+| "id": 0, |
+| "start": 1, |
+| "end": 0, |
+| "label": "Friend", |
+| "properties": { |
+| "really": true, |
+| "since": "long ago", |
+| "until": "forever" |
+| }, |
+| "type": "relationship" |
+| } |
++----------------------------+
+```
+
+### `remove_rel_properties(relationships, keys)`
+
+Removes the provided properties from the given relationships and returns the modified relationships. If a property doesn't exist in the given relationship nothing happens with it.
+
+#### Input:
+
+- `relationships: int|Relationship|List[int|Relationship]` ➡ relationships to be modified
+- `keys: List[string]` ➡ list of property names to be removed from the given relationships
+
+#### Output:
+
+- `relationship: Relationship` ➡ modified relationship(s)
+
+#### Usage:
+
+```cypher
+CREATE (matija:Person {name: "Matija"})
+CREATE (ivan:Person {name: "Ivan"})
+CREATE (ivan)-[:Friend {since: 'forever and ever', until: 'forever'}]->(matija);
+
+MATCH (:Person)-[friends:Friend]->(:Person) CALL create.remove_rel_properties(friends, ["until"]) YIELD relationship return relationship;
+
+```
+
+```plaintext
++------------------------------------+
+| relationship |
++------------------------------------+
+| { |
+| "id": 0, |
+| "start: 1, |
+| "end": 0, |
+| "label": "Friend", |
+| "properties": { |
+| "since": "forever and ever" |
+| }, |
+| "type": "relationship" |
+| } |
++------------------------------------+
+```
From 5d88e49048b66699cd929278118fea8d1f02cfdc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matija=20Pintari=C4=87?=
<99442742+mpintaric55334@users.noreply.github.com>
Date: Thu, 17 Aug 2023 15:51:31 +0200
Subject: [PATCH 05/11] Write create docs (#1001)
---
mage/query-modules/cpp/create.md | 99 ++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index bbb092bcb42..1bae9fb5f7f 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -34,3 +34,102 @@ By enabling more precise and flexible creation of nodes and relationships within
### Procedures
+### `nodes(labels, properties)`
+
+Create nodes with given labels and properties. For each property map, a separate node is created.
+
+#### Input:
+
+- `labels: List[string]` ➡ the list with labels of the new nodes.
+- `properties: List[Map]` ➡ the list of property maps for new nodes, for each map, a separate node is created.
+
+
+#### Output:
+
+- `node: Node` ➡ created node(s).
+
+#### Usage:
+
+```cypher
+CALL create.nodes(["Human", "Soldier"], [{branch: "Marines", MOS: "Gunner"}, {branch: "Army", MOS: "Paratrooper"}]) YIELD node RETURN node;
+```
+
+```plaintext
++---------------------------------------------------------------------------------------------------------------------+
+| node |
++---------------------------------------------------------------------------------------------------------------------+
+| {"id": 0, "labels": ["Human", "Soldier"], "properties": {"MOS": "Gunner", "branch": "Marines"}, "type": "node} |
++---------------------------------------------------------------------------------------------------------------------+
+| {"id": 1, "labels": ["Human", "Soldier"], "properties": {"MOS": "Paratrooper", "branch": "Army"}, "type": "node"} |
++---------------------------------------------------------------------------------------------------------------------+
+```
+
+
+### `set_property(nodes, key, value)`
+
+Sets the property of the input node(s), based on the provided key-value pair. If the property doesn't exist, creates a new one. Input node(s) can be a single node, node ID, or a list of nodes and node IDs. Otherwise, an exception is thrown.
+
+#### Input:
+
+- `nodes: any` ➡ input node(s). Can be a node, node's ID, or a list of nodes and IDs.
+- `key: string` ➡ name of the property which is about to be set.
+- `value: any` ➡ new value of the property.
+
+
+#### Output:
+
+- `node: Node` ➡ node(s) with modified property.
+
+#### Usage:
+
+```cypher
+CREATE (d:Dog),(h:Human);
+MATCH (d:Dog), (h:Human)
+CALL create.set_property([d,id(h)],"property", 50) YIELD node RETURN node;
+```
+
+```plaintext
++---------------------------------------------------------------------------------------------------------------------+
+| node |
++---------------------------------------------------------------------------------------------------------------------+
+| {"id": 18, "labels": ["Dog"], "properties": {"property": 50}, "type": "node"} |
++---------------------------------------------------------------------------------------------------------------------+
+| {"id": 19, "labels": ["Human"], "properties": {"property": 50},"type": "node"} |
++---------------------------------------------------------------------------------------------------------------------+
+```
+
+
+### `remove_properties(nodes, list_keys)`
+
+Removes all the properties of the given node(s). Input node(s) can be a single node, node ID, or a list of nodes and node IDs. Otherwise, an exception is thrown.
+#### Input:
+
+- `nodes: any` ➡ input node(s). Can be a node, node's ID, or a list of nodes and IDs.
+- `list_keys: List[string]` ➡ list of properties which are to be removed.
+
+
+#### Output:
+
+- `node: Node` ➡ node(s) with removed properties.
+
+#### Usage:
+
+```cypher
+CREATE (d:Dog {property: 30, property2: 50}),(h:Human {property: 80});
+MATCH (d:Dog), (h:Human)
+CALL create.remove_properties([d,id(h)],["property", "property2"]) YIELD node RETURN node;
+```
+
+```plaintext
++---------------------------------------------------------------------------------------------------------------------+
+| node |
++---------------------------------------------------------------------------------------------------------------------+
+| {"id": 120, "labels": ["Dog"], "properties": {}, "type": "node"} |
++---------------------------------------------------------------------------------------------------------------------+
+| {"id": 121, "labels": ["Human"], "properties": {}, "type": "node"} |
++---------------------------------------------------------------------------------------------------------------------+
+```
+
+
+
+
From f37b4c6cbb78bf11c2235f40273e1a42507304cc Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Fri, 18 Aug 2023 08:58:04 +0200
Subject: [PATCH 06/11] add fullstops
---
mage/query-modules/cpp/create.md | 34 ++++++++++++++++----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index dd4f5d301db..84ed363ad85 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -40,17 +40,17 @@ Provides a more flexible way of creating nodes than Cypher’s CREATE clause.
#### Input:
-- `labels: List[string]` ➡ list of all the labels to be added to the new node
-- `properties: Map` ➡ map with key/value pairs to be added as new node's properties
+- `labels: List[string]` ➡ list of all the labels to be added to the new node.
+- `properties: Map` ➡ map with key/value pairs to be added as new node's properties.
#### Output:
-- `node: Node` ➡ new node which is added to the graph
+- `node: Node` ➡ new node which is added to the graph.
#### Usage:
```cypher
-CALL create.node(["Person", "Programmer"], {name: "Ana", age: 20}) YIELD node RETURN node
+CALL create.node(["Person", "Programmer"], {name: "Ana", age: 20}) YIELD node RETURN node;
```
```plaintext
@@ -79,13 +79,13 @@ Adds the provided properties to the node(s).
#### Input:
-- `input_nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids
-- `input_keys: List[string]` ➡ list of all the property keys to be added to the node(s)
-- `input_values: List[Any]` ➡ list of all the corresponding property values to be added to the node(s)
+- `input_nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids.
+- `input_keys: List[string]` ➡ list of all the property keys to be added to the node(s).
+- `input_values: List[Any]` ➡ list of all the corresponding property values to be added to the node(s).
#### Output:
-- `nodes: Node` ➡ node(s) with new properties
+- `nodes: Node` ➡ node(s) with new properties.
#### Usage:
@@ -134,13 +134,13 @@ Adds the provided property to the relationship(s).
#### Input:
-- `input_rel: Any` ➡ relationship, relationship's id or a list of relationships and relationships' ids
-- `input_key: string` ➡ property key to be added to the relationship(s)
-- `input_value: Any` ➡ corresponding property value to be added to the relationship(s)
+- `input_rel: Any` ➡ relationship, relationship's id or a list of relationships and relationships' ids.
+- `input_key: string` ➡ property key to be added to the relationship(s).
+- `input_value: Any` ➡ corresponding property value to be added to the relationship(s).
#### Output:
-- `relationship: Relationship` ➡ relationship(s) with new property
+- `relationship: Relationship` ➡ relationship(s) with new property.
#### Usage:
@@ -174,17 +174,17 @@ Removes the provided labels from the node(s).
#### Input:
-- `nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids
-- `labels: List[string]` ➡ list of labels to be removed (if exist) from the nodes(s)
+- `nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids.
+- `labels: List[string]` ➡ list of labels to be removed (if exist) from the nodes(s).
#### Output:
-- `nodes: Node` ➡ node(s) without provided labels
+- `nodes: Node` ➡ node(s) without provided labels.
#### Usage:
```cypher
-CREATE (:Person:Student:Programmer {name: "Ana"})
+CREATE (:Person:Student:Programmer {name: "Ana"});
MATCH (p:Person) CALL create.remove_labels(p, ["Student", "Engineer"]) YIELD nodes RETURN nodes;
```
@@ -204,4 +204,4 @@ MATCH (p:Person) CALL create.remove_labels(p, ["Student", "Engineer"]) YIELD nod
| "type": "node" |
| } |
+----------------------------+
-```
\ No newline at end of file
+```
From d9dc2d717bbe202edefb6e5e0688580065dce4a9 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Mon, 21 Aug 2023 09:12:42 +0200
Subject: [PATCH 07/11] edit function yield name
---
mage/query-modules/cpp/create.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index 84ed363ad85..03e5fb0507d 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -85,19 +85,19 @@ Adds the provided properties to the node(s).
#### Output:
-- `nodes: Node` ➡ node(s) with new properties.
+- `node: Node` ➡ node(s) with new properties.
#### Usage:
```cypher
CREATE (:Student {name: "Ana"});
CREATE (:Student {name: "Maria"});
-MATCH (s:Student) CALL create.set_properties(s, ["age", "grade"], [20, "1st"]) YIELD nodes RETURN nodes;
+MATCH (s:Student) CALL create.set_properties(s, ["age", "grade"], [20, "1st"]) YIELD node RETURN node;
```
```plaintext
+----------------------------+
-| nodes |
+| node |
+----------------------------+
| { |
| "id": 1, |
From 136ef8e5022f13beed1469ae3880bf1545fd0d55 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Wed, 6 Sep 2023 13:42:58 +0200
Subject: [PATCH 08/11] edit table look
---
mage/query-modules/cpp/create.md | 98 +++++++++++++++++++++++++-------
1 file changed, 76 insertions(+), 22 deletions(-)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index a50fb1500c6..84a995ea155 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -94,13 +94,35 @@ CALL create.nodes(["Human", "Soldier"], [{branch: "Marines", MOS: "Gunner"}, {br
```
```plaintext
-+---------------------------------------------------------------------------------------------------------------------+
-| node |
-+---------------------------------------------------------------------------------------------------------------------+
-| {"id": 0, "labels": ["Human", "Soldier"], "properties": {"MOS": "Gunner", "branch": "Marines"}, "type": "node} |
-+---------------------------------------------------------------------------------------------------------------------+
-| {"id": 1, "labels": ["Human", "Soldier"], "properties": {"MOS": "Paratrooper", "branch": "Army"}, "type": "node"} |
-+---------------------------------------------------------------------------------------------------------------------+
++----------------------------+
+| node |
++----------------------------+
+| { |
+| "id": 0, |
+| "labels": [ |
+| "Human", |
+| "Soldier" |
+| ], |
+| "properties": { |
+| MOS: "Gunner", |
+| branch: "Marines" |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
+| { |
+| "id": 1, |
+| "labels": [ |
+| "Human", |
+| "Soldier" |
+| ], |
+| "properties": { |
+| MOS: "Paratrooper", |
+| branch: "Army" |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
```
### `set_property(nodes, key, value)`
@@ -127,13 +149,31 @@ CALL create.set_property([d,id(h)],"property", 50) YIELD node RETURN node;
```
```plaintext
-+---------------------------------------------------------------------------------------------------------------------+
-| node |
-+---------------------------------------------------------------------------------------------------------------------+
-| {"id": 18, "labels": ["Dog"], "properties": {"property": 50}, "type": "node"} |
-+---------------------------------------------------------------------------------------------------------------------+
-| {"id": 19, "labels": ["Human"], "properties": {"property": 50},"type": "node"} |
-+---------------------------------------------------------------------------------------------------------------------+
++----------------------------+
+| node |
++----------------------------+
+| { |
+| "id": 0, |
+| "labels": [ |
+| "Dog" |
+| ], |
+| "properties": { |
+| property: 50 |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
+| { |
+| "id": 1, |
+| "labels": [ |
+| "Human" |
+| ], |
+| "properties": { |
+| property: 50 |
+| }, |
+| "type": "node" |
+| } |
++----------------------------+
```
### `set_properties(input_nodes, input_keys, input_values)`
@@ -212,13 +252,27 @@ CALL create.remove_properties([d,id(h)],["property", "property2"]) YIELD node RE
```
```plaintext
-+---------------------------------------------------------------------------------------------------------------------+
-| node |
-+---------------------------------------------------------------------------------------------------------------------+
-| {"id": 120, "labels": ["Dog"], "properties": {}, "type": "node"} |
-+---------------------------------------------------------------------------------------------------------------------+
-| {"id": 121, "labels": ["Human"], "properties": {}, "type": "node"} |
-+---------------------------------------------------------------------------------------------------------------------+
++----------------------------+
+| node |
++----------------------------+
+| { |
+| "id": 0, |
+| "labels": [ |
+| "Dog" |
+| ], |
+| "properties": {}, |
+| "type": "node" |
+| } |
++----------------------------+
+| { |
+| "id": 1, |
+| "labels": [ |
+| "Human" |
+| ], |
+| "properties": {}, |
+| "type": "node" |
+| } |
++----------------------------+
```
### `set_rel_property(input_rel, input_key, input_value)`
@@ -421,4 +475,4 @@ MATCH (:Person)-[friends:Friend]->(:Person) CALL create.remove_rel_properties(fr
| "type": "relationship" |
| } |
+------------------------------------+
-```
\ No newline at end of file
+```
From f70ff4b1162f2f69ff7a7a29767abdfc55843cea Mon Sep 17 00:00:00 2001
From: Vlasta <95473291+vpavicic@users.noreply.github.com>
Date: Fri, 8 Sep 2023 13:19:12 +0200
Subject: [PATCH 09/11] Apply suggestions from code review
---
mage/query-modules/cpp/create.md | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index 84a995ea155..9a2c145e7c5 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -72,7 +72,6 @@ CALL create.node(["Person", "Programmer"], {name: "Ana", age: 20}) YIELD node RE
+----------------------------+
```
-
### `nodes(labels, properties)`
Create nodes with given labels and properties. For each property map, a separate node is created.
@@ -182,7 +181,7 @@ Adds the provided properties to the node(s).
#### Input:
-- `input_nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids.
+- `input_nodes: Any` ➡ node, node's ID or a list of nodes and nodes' IDs.
- `input_keys: List[string]` ➡ list of all the property keys to be added to the node(s).
- `input_values: List[Any]` ➡ list of all the corresponding property values to be added to the node(s).
@@ -233,6 +232,7 @@ MATCH (s:Student) CALL create.set_properties(s, ["age", "grade"], [20, "1st"]) Y
### `remove_properties(nodes, list_keys)`
Removes all the properties of the given node(s). Input node(s) can be a single node, node ID, or a list of nodes and node IDs. Otherwise, an exception is thrown.
+
#### Input:
- `nodes: any` ➡ input node(s). Can be a node, node's ID, or a list of nodes and IDs.
@@ -281,7 +281,7 @@ Adds the provided property to the relationship(s).
#### Input:
-- `input_rel: Any` ➡ relationship, relationship's id or a list of relationships and relationships' ids.
+- `input_rel: Any` ➡ relationship, relationship's ID or a list of relationships and relationships' IDs.
- `input_key: string` ➡ property key to be added to the relationship(s).
- `input_value: Any` ➡ corresponding property value to be added to the relationship(s).
@@ -320,7 +320,7 @@ Removes the provided labels from the node(s).
#### Input:
-- `nodes: Any` ➡ node, node's id or a list of nodes and nodes' ids.
+- `nodes: Any` ➡ node, node's ID or a list of nodes and nodes' IDs.
- `labels: List[string]` ➡ list of labels to be removed (if exist) from the nodes(s).
#### Output:
@@ -399,13 +399,13 @@ Adds the provided properties to the given relationships and returns the modified
#### Input:
-- `relationships: int|Relationship|List[int|Relationship]` ➡ relationships to be modified given by their object or id
-- `keys: List[string]` ➡ list of all the property keys to be added to the relationship(s)
-- `values: List[Any]` ➡ list of all the corresponding property values to be added to the relationship(s)
+- `relationships: int|Relationship|List[int|Relationship]` ➡ relationships to be modified given by their object or ID.
+- `keys: List[string]` ➡ list of all the property keys to be added to the relationship(s).
+- `values: List[Any]` ➡ list of all the corresponding property values to be added to the relationship(s).
#### Output:
-- `relationship: Relationship` ➡ the modified relationship(s)
+- `relationship: Relationship` ➡ the modified relationship(s).
#### Usage:
@@ -442,8 +442,8 @@ Removes the provided properties from the given relationships and returns the mod
#### Input:
-- `relationships: int|Relationship|List[int|Relationship]` ➡ relationships to be modified
-- `keys: List[string]` ➡ list of property names to be removed from the given relationships
+- `relationships: int|Relationship|List[int|Relationship]` ➡ relationships to be modified.
+- `keys: List[string]` ➡ list of property names to be removed from the given relationships.
#### Output:
From 930ad1d50810af79c8edaa5f4f6dc0fbe2d09bb4 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Sat, 9 Sep 2023 09:08:08 +0200
Subject: [PATCH 10/11] PR review changes
---
mage/query-modules/cpp/create.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mage/query-modules/cpp/create.md b/mage/query-modules/cpp/create.md
index 9a2c145e7c5..388740dec42 100644
--- a/mage/query-modules/cpp/create.md
+++ b/mage/query-modules/cpp/create.md
@@ -36,7 +36,7 @@ By enabling more precise and flexible creation of nodes and relationships within
### `node(labels, properties)`
-Provides a more flexible way of creating nodes than Cypher’s CREATE clause.
+Provides a more flexible way of creating nodes than Cypher’s CREATE clause by allowing labels and properties to be extracted as results of other procedures and sent as a list or map.
#### Input:
From 3045143faa2e5acaacea6c1fe3292e75188248cc Mon Sep 17 00:00:00 2001
From: Vlasta
Date: Tue, 12 Sep 2023 14:00:55 +0200
Subject: [PATCH 11/11] change-to-util
---
mage/templates/_mage_spells.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mage/templates/_mage_spells.mdx b/mage/templates/_mage_spells.mdx
index 86db4820360..75ada5542d8 100644
--- a/mage/templates/_mage_spells.mdx
+++ b/mage/templates/_mage_spells.mdx
@@ -8,7 +8,6 @@
| [bridges](/mage/query-modules/cpp/bridges) | C++ | A bridge is an edge, which when deleted, increases the number of connected components. The goal of this algorithm is to detect edges that are bridges in a graph. |
| [collections](/mage/query-modules/cpp/collections) | C++ | The collections module is a collection manipulation module that offers functions to work with lists in Cypher queries, allowing operations like filtering, sorting, and modification for efficient data handling. |
| [community_detection](/mage/query-modules/cpp/community-detection) | C++ | The Louvain method for community detection is a greedy method for finding communities with maximum modularity in a graph. Runs in _O_(*n*log*n*) time. |
-| [create](/mage/query-modules/cpp/create) | C++ | The create module is a set of powerful tools that provide additional capabilities for creating nodes and relationships in the Memgraph graph database. |
| [cycles](/mage/query-modules/cpp/cycles) | C++ | Algorithm for detecting cycles on graphs. |
| [distance_calculator](/mage/query-modules/cpp/distance-calculator) | C++ | Module for finding the geographical distance between two points defined with 'lng' and 'lat' coordinates. |
| [degree_centrality](/mage/query-modules/cpp/degree-centrality) | C++ | The basic measurement of centrality that refers to the number of edges adjacent to a node. |
@@ -52,6 +51,7 @@
| Algorithms | Lang | Description |
| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [conditional_execution](/mage/query-modules/cpp/conditional-execution) | C++ | Define conditions not expressible in Cypher and and use them to control query execution. |
+| [create](/mage/query-modules/cpp/create) | C++ | The create module is a set of powerful tools that provide additional capabilities for creating nodes and relationships in the Memgraph graph database. |
| [export_util](/mage/query-modules/python/export-util) | Python | A module for exporting the graph database in different formats (JSON). |
| [graph_analyzer](/mage/query-modules/python/graph-analyzer) | Python | This Graph Analyzer query module offers insights about the stored graph or a subgraph. |
| [graph_util](/mage/query-modules/cpp/graph-util) | C++ | A module with common graph algorithms and graph manipulation utilities |