From 266305d4e1093008057cfc93e548d16382b297ed Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Mon, 14 Aug 2023 13:58:55 +0200
Subject: [PATCH 1/4] add label module docs
---
mage/query-modules/cpp/label.md | 65 +++++++++++++++++++++++++++++++++
mage/templates/_mage_spells.mdx | 1 +
sidebars/sidebarsMAGE.js | 1 +
3 files changed, 67 insertions(+)
create mode 100644 mage/query-modules/cpp/label.md
diff --git a/mage/query-modules/cpp/label.md b/mage/query-modules/cpp/label.md
new file mode 100644
index 00000000000..acc80cb3fc2
--- /dev/null
+++ b/mage/query-modules/cpp/label.md
@@ -0,0 +1,65 @@
+---
+id: label
+title: label
+sidebar_label: label
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import RunOnSubgraph from '../../templates/_run_on_subgraph.mdx';
+
+export const Highlight = ({children, color}) => (
+
+{children}
+
+);
+
+Labels are used to categorize nodes, and the `label` module provides an array of utilities for working with labels in a Memgraph database.
+
+
+[![docs-source](https://img.shields.io/badge/source-label-FB6E00?logo=github&style=for-the-badge)](https://github.com/memgraph/mage/tree/main/cpp/label_module)
+
+| Trait | Value |
+| ------------------- | ----------------------------------------------------- |
+| **Module type** | **algorithm** |
+| **Implementation** | **C++** |
+| **Graph direction** | **directed**/**undirected** |
+| **Edge weights** | **weighted**/**unweighted** |
+| **Parallelism** | **sequential** |
+
+### Procedures
+
+### `exists(node, label)`
+
+Checks whether a specified label exists within the provided node.
+
+#### Input:
+
+- `node: Any` ➡ node whose labels are to be checked
+- `label: string` ➡ name of the label whose existence is to be confirmed
+
+#### Output:
+
+- `exists: bool` ➡ whether or not provided node has a specified label
+
+#### Usage:
+
+```cypher
+CREATE (:Student {name: 'Ana'});
+MATCH (s:Student {name: 'Ana'}) CALL label.exists(s, "Teacher") YIELD exists RETURN exists
+```
+
+```plaintext
++----------------------------+
+| exists |
++----------------------------+
+| False |
++----------------------------+
+```
+
diff --git a/mage/templates/_mage_spells.mdx b/mage/templates/_mage_spells.mdx
index 83634d4a33b..ae9bb9e38f3 100644
--- a/mage/templates/_mage_spells.mdx
+++ b/mage/templates/_mage_spells.mdx
@@ -14,6 +14,7 @@
| [graph_coloring](/mage/query-modules/python/graph-coloring) | Python | Algorithm for assigning labels to the graph elements subject to certain constraints. In this form, it is a way of coloring the graph vertices such that no two adjacent vertices are of the same color. |
| [katz_centrality](/mage/query-modules/cpp/katz-centrality) | C++ | Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length. |
| [kmeans](/mage/query-modules/python/kmeans) | Python | An algorithm for clustering given data. |
+| [label](/mage/query-modules/cpp/label) | C++ | The label module provides an array of utilities for working with labels in a Memgraph database. |
| [map](/mage/query-modules/cpp/map) | C++ | The map module offers a versatile toolkit for manipulating collections of key-value pairs, enabling advanced data operations within a graph database context |
| [max_flow](/mage/query-modules/python/max-flow) | Python | An algorithm for finding a flow through a graph such that it is the maximum possible flow. |
| [node_similarity](/mage/query-modules/cpp/node-similarity) | C++ | A module that contains similarity measures for calculating the similarity between two nodes. |
diff --git a/sidebars/sidebarsMAGE.js b/sidebars/sidebarsMAGE.js
index 3d940c7c061..ea02901b225 100644
--- a/sidebars/sidebarsMAGE.js
+++ b/sidebars/sidebarsMAGE.js
@@ -46,6 +46,7 @@ module.exports = {
"query-modules/cpp/katz-centrality",
"query-modules/cpp/katz-centrality-online",
"query-modules/python/kmeans",
+ "query-modules/cpp/label",
"query-modules/python/link-prediction-with-gnn",
"query-modules/python/llm-util",
"query-modules/cpp/map",
From 9b212444bf5adf3abf4130b3de758ed4f447b193 Mon Sep 17 00:00:00 2001
From: Vlasta <95473291+vpavicic@users.noreply.github.com>
Date: Thu, 17 Aug 2023 08:42:42 +0200
Subject: [PATCH 2/4] Apply suggestions from code review
---
mage/query-modules/cpp/label.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mage/query-modules/cpp/label.md b/mage/query-modules/cpp/label.md
index acc80cb3fc2..0975b28df20 100644
--- a/mage/query-modules/cpp/label.md
+++ b/mage/query-modules/cpp/label.md
@@ -41,12 +41,12 @@ Checks whether a specified label exists within the provided node.
#### Input:
-- `node: Any` ➡ node whose labels are to be checked
-- `label: string` ➡ name of the label whose existence is to be confirmed
+- `node: Any` ➡ node whose labels are to be checked.
+- `label: string` ➡ name of the label whose existence is to be confirmed.
#### Output:
-- `exists: bool` ➡ whether or not provided node has a specified label
+- `exists: bool` ➡ whether or not provided node has a specified label.
#### Usage:
From c2047997116caa9e9f8d42a52318c807ea23ccb4 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Fri, 18 Aug 2023 08:27:28 +0200
Subject: [PATCH 3/4] add semicolon
---
mage/query-modules/cpp/label.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mage/query-modules/cpp/label.md b/mage/query-modules/cpp/label.md
index 0975b28df20..90d08309711 100644
--- a/mage/query-modules/cpp/label.md
+++ b/mage/query-modules/cpp/label.md
@@ -52,7 +52,7 @@ Checks whether a specified label exists within the provided node.
```cypher
CREATE (:Student {name: 'Ana'});
-MATCH (s:Student {name: 'Ana'}) CALL label.exists(s, "Teacher") YIELD exists RETURN exists
+MATCH (s:Student {name: 'Ana'}) CALL label.exists(s, "Teacher") YIELD exists RETURN exists;
```
```plaintext
From d9214752d3087ed27f7043ef4114c10f9fd6ae40 Mon Sep 17 00:00:00 2001
From: ind1xa <95344788+ind1xa@users.noreply.github.com>
Date: Fri, 18 Aug 2023 08:32:47 +0200
Subject: [PATCH 4/4] stash changes
---
package-lock.json | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 94a01e30b54..a85fa60513b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5888,14 +5888,14 @@
}
},
"node_modules/docusaurus-plugin-sass": {
- "version": "0.2.2",
- "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.2.tgz",
- "integrity": "sha512-ZZBpj3PrhGpYE2kAnkZB9NRwy/CDi4rGun1oec6PYR8YvGzqxYGtXvLgHi6FFbu8/N483klk8udqyYMh6Ted+A==",
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.5.tgz",
+ "integrity": "sha512-Z+D0fLFUKcFpM+bqSUmqKIU+vO+YF1xoEQh5hoFreg2eMf722+siwXDD+sqtwU8E4MvVpuvsQfaHwODNlxJAEg==",
"dependencies": {
"sass-loader": "^10.1.1"
},
"peerDependencies": {
- "@docusaurus/core": "^2.0.0-beta",
+ "@docusaurus/core": "^2.0.0-beta || ^3.0.0-alpha",
"sass": "^1.30.0"
}
},
@@ -17485,9 +17485,9 @@
}
},
"docusaurus-plugin-sass": {
- "version": "0.2.2",
- "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.2.tgz",
- "integrity": "sha512-ZZBpj3PrhGpYE2kAnkZB9NRwy/CDi4rGun1oec6PYR8YvGzqxYGtXvLgHi6FFbu8/N483klk8udqyYMh6Ted+A==",
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.5.tgz",
+ "integrity": "sha512-Z+D0fLFUKcFpM+bqSUmqKIU+vO+YF1xoEQh5hoFreg2eMf722+siwXDD+sqtwU8E4MvVpuvsQfaHwODNlxJAEg==",
"requires": {
"sass-loader": "^10.1.1"
}