Skip to content

Fix missing query modules documentation #1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 27, 2025
8 changes: 5 additions & 3 deletions pages/advanced-algorithms/available-algorithms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ If you want to know more and learn how this affects you, read our [announcement]

| Algorithms | Lang | Description |
|------------------------------------------------------------------------------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [conditional_execution](/advanced-algorithms/available-algorithms/conditional_execution) | C++ | Define conditions not expressible in Cypher and and use them to control query execution. |
| [collections](/advanced-algorithms/available-algorithms/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. |
| [create](/advanced-algorithms/available-algorithms/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. |
| [csv_utils](/advanced-algorithms/available-algorithms/csv_utils) | C++ | An utility module for creating and deleting CSV files. |
| [date](/advanced-algorithms/available-algorithms/date) | C++ | The `date` module provides various utilities to handle date and time operations within the Cypher query language. |
| [do](/advanced-algorithms/available-algorithms/do) | C++ | A module that is used to define conditions not expressible in Cypher to control query execution. |
| [export_util](/advanced-algorithms/available-algorithms/export_util) | Python | A module for exporting the graph database in different formats (JSON). |
| [graph_analyzer](/advanced-algorithms/available-algorithms/graph_analyzer) | Python | This Graph Analyzer query module offers insights about the stored graph or a subgraph. |
| [graph_util](/advanced-algorithms/available-algorithms/graph_util) | C++ | A module with common graph algorithms and graph manipulation utilities |
Expand All @@ -95,7 +96,7 @@ If you want to know more and learn how this affects you, read our [announcement]
| [label](/advanced-algorithms/available-algorithms/label) | C++ | The `label` module provides an array of utilities for working with labels. |
| [llm_util](/advanced-algorithms/available-algorithms/llm_util) | Python | A module that contains procedures describing graphs in a format best suited for large language models (LLMs). |
| [map](/advanced-algorithms/available-algorithms/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 |
| [merge](/advanced-algorithms/available-algorithms/merge) | C++ | A module which provides the capabilities of the `MERGE` Cypher command, merging or creating nodes and relationships as per specified conditions. It ensures precision and coherence in managing interconnected data structure. |
| [merge](/advanced-algorithms/available-algorithms/merge) | C++ | A module which provides the capabilities of the `MERGE` Cypher command, merging or creating nodes and relationships as per specified conditions. It ensures precision and coherence in managing interconnected data structure. |
| [meta](/advanced-algorithms/available-algorithms/meta) | C++ | Provides information about graph nodes and relationships. |
| [meta_util](/advanced-algorithms/available-algorithms/meta_util) | Python | A module that contains procedures describing graphs on a meta-level. |
| [migrate](/advanced-algorithms/available-algorithms/migrate) | Python | A module that can access data from a MySQL, SQL Server or Oracle database. |
Expand All @@ -104,7 +105,8 @@ If you want to know more and learn how this affects you, read our [announcement]
| [nodes](/advanced-algorithms/available-algorithms/nodes) | C++ | A module that provides a comprehensive toolkit for managing multiple graph nodes, enabling linking, updating, type deduction and more. |
| [periodic](/advanced-algorithms/available-algorithms/periodic) | C++ | A module containing procedures for periodically running difficult and/or memory/time consuming queries. |
| [refactor](/advanced-algorithms/available-algorithms/refactor) | C++ | The refactor module provides utilities for changing nodes and relationships. |
| [rust_example](https://github.com/memgraph/mage/tree/main/rust/rsmgp-example) | Rust | Example of a basic module with input parameters forwarding, made in Rust. | [set_property](/advanced-algorithms/available-algorithms/set_property) | C++ | A module for dynamical access and editing of node and relationship properties. |
| [rust_example](https://github.com/memgraph/mage/tree/main/rust/rsmgp-example) | Rust | Example of a basic module with input parameters forwarding, made in Rust. |
| [set_property](/advanced-algorithms/available-algorithms/set_property) | C++ | A module for dynamical access and editing of node and relationship properties. |
| [temporal](/advanced-algorithms/available-algorithms/temporal) | Python | A module that provides functions to handle temporal (time-related) operations and offers extended capabilities compared to the date module. |
| [text](/advanced-algorithms/available-algorithms/text) | C++ | The `text` module offers a toolkit for manipulating strings. |
| [util_module](/advanced-algorithms/available-algorithms/util_module) | C++ | A module which offers a range of functions for tasks such as validation and creating cryptographic hash values. This module serves as a practical resource for streamlining a variety of tasks related to database operations. |
Expand Down
3 changes: 2 additions & 1 deletion pages/advanced-algorithms/available-algorithms/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ export default {
"bipartite_matching": "bipartite_matching",
"bridges": "bridges",
"collections": "collections",
"csv_utils": "csv_utils",
"community_detection_online": "community_detection_online",
"community_detection": "community_detection",
"conditional_execution": "conditional_execution",
"do": "do",
"create": "create",
"cugraph": "cugraph",
"cycles": "cycles",
Expand Down
78 changes: 78 additions & 0 deletions pages/advanced-algorithms/available-algorithms/csv_utils.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: csv_utils
description: An utility module for creating and deleting CSV files in Memgraph.
---

import { Callout } from 'nextra/components';
import { Cards } from 'nextra/components';
import GitHub from '/components/icons/GitHub';

# csv_utils

The `csv_utils` module provides a set of procedures for managing CSV files within Memgraph.
It allows users to create and delete CSV files directly from the database environment.

<Cards>
<Cards.Card
icon={<GitHub />}
title="Source code"
href="https://github.com/memgraph/mage/blob/main/cpp/csv_utils_module/csv_utils_module.cpp"
/>
</Cards>

| Trait | Value |
| ------------------- | ------------------- |
| **Module type** | util |
| **Implementation** | C++ |
| **Parallelism** | sequential |

## Procedures

### `create_csv_file()`

This procedure creates a new CSV file at the specified path with the given content.
If the file already exists, the `is_append` flag determines whether the content should be appended to the file or overwritten.

{<h4 className="custom-header"> Input: </h4>}

- `filepath: string` ➡ The path where the CSV file will be created.
- `content: string` ➡ The content to be written into the CSV file.
- `is_append: bool (default = false)` ➡ If `true`, the content is appended to the existing file; otherwise, the file is overwritten.

{<h4 className="custom-header"> Output: </h4>}

- `filepath: string` ➡ The path of the created CSV file.

{<h4 className="custom-header"> Usage: </h4>}

To create a new CSV file:

```cypher
CALL csv_utils.create_csv_file("/tmp/data.csv", "id,name\n1,John", false) YIELD filepath;
```

To append data to an existing CSV file:

```cypher
CALL csv_utils.create_csv_file("/tmp/data.csv", "2,Jane", true) YIELD filepath;
```

### `delete_csv_file()`

This procedure deletes the specified CSV file.

{<h4 className="custom-header"> Input: </h4>}

- `filepath: string` ➡ The path of the CSV file to be deleted.

{<h4 className="custom-header"> Output: </h4>}

None.

{<h4 className="custom-header"> Usage: </h4>}

To delete an existing CSV file:

```cypher
CALL csv_utils.delete_csv_file("/tmp/data.csv");
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: conditional_execution
title: do
description: Optimize your graph computing workflow with Memgraph's conditional execution capabilities. Explore tutorials and comprehensive documentation to learn how to execute specific operations based on conditions within your graphs.
---

Expand All @@ -8,7 +8,7 @@ import { Steps } from 'nextra/components'
import { Cards } from 'nextra/components'
import GitHub from '/components/icons/GitHub'

# conditional_execution
# do

Queries might require conditional execution logic that can’t be adequately
expressed in Cypher. The `do` module makes it possible to define complex logic
Expand All @@ -30,6 +30,10 @@ that will control query execution.

## Procedures

<Callout type="info">
You can execute this algorithm on [graph projections, subgraphs or portions of the graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph).
</Callout>

The following procedures can't be used to run queries that execute global operations:

* creating and deleting indexes
Expand All @@ -47,7 +51,8 @@ Parameters are prefixed with `$` like `$param_name`. Check the documentation on
querying for [examples](/querying/expressions#parameters).

{<h4 className="custom-header"> Input: </h4>}

* `subgraph: Graph` (**OPTIONAL**) ➡ A specific subgraph, which is an [object of type Graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph) returned by the `project()` function, on which the algorithm is run.
If subgraph is not specified, the algorithm is computed on the entire graph by default.
* `conditionals: List[Any]` ➡ Variable-length list of condition-query pairs
structured as `[condition, query, condition, query, …​]`. Conditions are
`boolean` and queries are `string`.
Expand Down Expand Up @@ -88,7 +93,8 @@ RETURN value.graph_status AS graph_status;
`$param_name`.

{<h4 className="custom-header"> Input: </h4>}

* `subgraph: Graph` (**OPTIONAL**) ➡ A specific subgraph, which is an [object of type Graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph) returned by the `project()` function, on which the algorithm is run.
If subgraph is not specified, the algorithm is computed on the entire graph by default.
* `condition: boolean` ➡ Determines what query to execute.
* `if_query: string` ➡ The query to be executed if the condition is satisfied.
* `else_query: string (default = "")` ➡ The query to be executed if the
Expand Down Expand Up @@ -123,7 +129,7 @@ RETURN value.graph_status AS graph_status;

The database contains the following data:

![](/pages/advanced-algorithms/available-algorithms/conditional_execution/conditional-execution-1.png)
![](/pages/advanced-algorithms/available-algorithms/do/do-1.png)

Created with the following Cypher queries:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,29 @@ CALL graph_analyzer.analyze(nodes_subset, edges_subset) YIELD name, value
RETURN name, value;
```

### `help()`

Shows the manual page for `graph_analyzer`.

{<h4 className="custom-header"> Input: </h4>}

None.

{<h4 className="custom-header"> Output: </h4>}

- `name: string` ➡ The name of the procedure.
- `value: string` ➡ Explanation of the procedure.

{<h4 className="custom-header"> Usage: </h4>}

Use the following query to analyze the graph:

```cypher
CALL graph_analyzer.help()
YIELD name, value
RETURN name, value;
```

## Example

<Steps>
Expand Down
31 changes: 30 additions & 1 deletion pages/advanced-algorithms/available-algorithms/meta.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ title: meta
description: Create metadata about the database using procedures from the MAGE Library.
---

import { Callout } from 'nextra/components';
import { Cards } from 'nextra/components'
import GitHub from '/components/icons/GitHub'

# meta

<Callout type="info">

This module got deprecated in `v2.21.0` with the addition of the `SHOW SCHEMA INFO` ([link](/querying/schema)) feature.

</Callout>

The **meta** module provides a set of procedures for generating metadata about the database.

<Cards>
Expand Down Expand Up @@ -192,4 +199,26 @@ CALL meta.stats_offline() YIELD stats;
|} |
| |
+-------------------------------------------------------+
```
```

### `update()`

Helper function used in the trigger for the `stats_online` procedure. You should not use this manually.

### `reset()`

Deletes all stored metadata about the graph.

{<h4 className="custom-header"> Input: </h4>}

None.

{<h4 className="custom-header"> Output: </h4>}

None.

{<h4 className="custom-header"> Usage: </h4>}

```cypher
CALL meta.reset();
```
21 changes: 20 additions & 1 deletion pages/advanced-algorithms/available-algorithms/tgn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,25 @@ YIELD prediction
RETURN n,m, prediction;
```

### `reset()`

Deletes all stored data about the graph.

{<h4 className="custom-header"> Input: </h4>}

None.

{<h4 className="custom-header"> Output: </h4>}

- `message: string` ➡ Information on whether the reset was successful.

{<h4 className="custom-header"> Usage: </h4>}

```cypher
CALL tgn.reset() YIELD message RETURN message;
```


## Example

<Steps>
Expand Down Expand Up @@ -530,4 +549,4 @@ Results:
+--------------------+--------------------+--------------------+--------------------+--------------------+
```

</Steps>
</Steps>
6 changes: 3 additions & 3 deletions pages/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2951,8 +2951,8 @@ instance, then the REPLICA instances.
module](/advanced-algorithms/available-algorithms/periodic) allows batching results from one query
into another to improve execution time.
[#221](https://github.com/memgraph/mage/pull/221)
- The [`conditional_execution`
module](/advanced-algorithms/available-algorithms/conditional_execution) which allows the
- The [`do`
module](/advanced-algorithms/available-algorithms/do) which allows the
execution of different queries depending on certain conditions being met, has
been rewritten from Python to C++ to improve performance and it can also
periodically iterates. [#222](https://github.com/memgraph/mage/pull/222)
Expand Down Expand Up @@ -3188,7 +3188,7 @@ instance, then the REPLICA instances.
{<h4 className="custom-header"> Features and improvements </h4>}

- The [new conditional execution
module](/advanced-algorithms/available-algorithms/conditional_execution) lets you define
module](/advanced-algorithms/available-algorithms/do) lets you define
conditions not expressible in Cypher and and use them to control query
execution. [#203](https://github.com/memgraph/mage/pull/203)

Expand Down