Skip to content

Commit 34c0290

Browse files
Fix missing query modules documentation (#1195)
* rename conditional_execution to do module * add missing docs * input output- * fixes * fixes * fixes * fixes * pr comments * update redirects --------- Co-authored-by: katarinasupe <[email protected]> Co-authored-by: Katarina Supe <[email protected]>
1 parent e522bcd commit 34c0290

File tree

10 files changed

+178
-15
lines changed

10 files changed

+178
-15
lines changed

next.config.mjs

+6-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@ export default withNextra({
131131
},
132132
{
133133
source: '/mage/query-modules/cpp/conditional-execution',
134-
destination: '/advanced-algorithms/available-algorithms/conditional_execution',
134+
destination: '/advanced-algorithms/available-algorithms/do',
135+
permanent: true
136+
},
137+
{
138+
source: '/advanced-algorithms/available-algorithms/conditional_execution',
139+
destination: '/advanced-algorithms/available-algorithms/do',
135140
permanent: true
136141
},
137142
{

pages/advanced-algorithms/available-algorithms.mdx

+5-3
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ If you want to know more and learn how this affects you, read our [announcement]
8383

8484
| Algorithms | Lang | Description |
8585
|------------------------------------------------------------------------------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
86-
| [conditional_execution](/advanced-algorithms/available-algorithms/conditional_execution) | C++ | Define conditions not expressible in Cypher and and use them to control query execution. |
8786
| [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. |
8887
| [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. |
88+
| [csv_utils](/advanced-algorithms/available-algorithms/csv_utils) | C++ | An utility module for creating and deleting CSV files. |
8989
| [date](/advanced-algorithms/available-algorithms/date) | C++ | The `date` module provides various utilities to handle date and time operations within the Cypher query language. |
90+
| [do](/advanced-algorithms/available-algorithms/do) | C++ | A module that is used to define conditions not expressible in Cypher to control query execution. |
9091
| [export_util](/advanced-algorithms/available-algorithms/export_util) | Python | A module for exporting the graph database in different formats (JSON). |
9192
| [graph_analyzer](/advanced-algorithms/available-algorithms/graph_analyzer) | Python | This Graph Analyzer query module offers insights about the stored graph or a subgraph. |
9293
| [graph_util](/advanced-algorithms/available-algorithms/graph_util) | C++ | A module with common graph algorithms and graph manipulation utilities |
@@ -95,7 +96,7 @@ If you want to know more and learn how this affects you, read our [announcement]
9596
| [label](/advanced-algorithms/available-algorithms/label) | C++ | The `label` module provides an array of utilities for working with labels. |
9697
| [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). |
9798
| [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 |
98-
| [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. |
99+
| [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. |
99100
| [meta](/advanced-algorithms/available-algorithms/meta) | C++ | Provides information about graph nodes and relationships. |
100101
| [meta_util](/advanced-algorithms/available-algorithms/meta_util) | Python | A module that contains procedures describing graphs on a meta-level. |
101102
| [migrate](/advanced-algorithms/available-algorithms/migrate) | Python | A module that can access data from a MySQL, SQL Server or Oracle database. |
@@ -104,7 +105,8 @@ If you want to know more and learn how this affects you, read our [announcement]
104105
| [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. |
105106
| [periodic](/advanced-algorithms/available-algorithms/periodic) | C++ | A module containing procedures for periodically running difficult and/or memory/time consuming queries. |
106107
| [refactor](/advanced-algorithms/available-algorithms/refactor) | C++ | The refactor module provides utilities for changing nodes and relationships. |
107-
| [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. |
108+
| [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. |
109+
| [set_property](/advanced-algorithms/available-algorithms/set_property) | C++ | A module for dynamical access and editing of node and relationship properties. |
108110
| [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. |
109111
| [text](/advanced-algorithms/available-algorithms/text) | C++ | The `text` module offers a toolkit for manipulating strings. |
110112
| [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. |

pages/advanced-algorithms/available-algorithms/_meta.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ export default {
66
"bipartite_matching": "bipartite_matching",
77
"bridges": "bridges",
88
"collections": "collections",
9+
"csv_utils": "csv_utils",
910
"community_detection_online": "community_detection_online",
1011
"community_detection": "community_detection",
11-
"conditional_execution": "conditional_execution",
12+
"do": "do",
1213
"create": "create",
1314
"cugraph": "cugraph",
1415
"cycles": "cycles",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: csv_utils
3+
description: An utility module for creating and deleting CSV files in Memgraph.
4+
---
5+
6+
import { Callout } from 'nextra/components';
7+
import { Cards } from 'nextra/components';
8+
import GitHub from '/components/icons/GitHub';
9+
10+
# csv_utils
11+
12+
The `csv_utils` module provides a set of procedures for managing CSV files within Memgraph.
13+
It allows users to create and delete CSV files directly from the database environment.
14+
15+
<Cards>
16+
<Cards.Card
17+
icon={<GitHub />}
18+
title="Source code"
19+
href="https://github.com/memgraph/mage/blob/main/cpp/csv_utils_module/csv_utils_module.cpp"
20+
/>
21+
</Cards>
22+
23+
| Trait | Value |
24+
| ------------------- | ------------------- |
25+
| **Module type** | util |
26+
| **Implementation** | C++ |
27+
| **Parallelism** | sequential |
28+
29+
## Procedures
30+
31+
### `create_csv_file()`
32+
33+
This procedure creates a new CSV file at the specified path with the given content.
34+
If the file already exists, the `is_append` flag determines whether the content should be appended to the file or overwritten.
35+
36+
{<h4 className="custom-header"> Input: </h4>}
37+
38+
- `filepath: string` ➡ The path where the CSV file will be created.
39+
- `content: string` ➡ The content to be written into the CSV file.
40+
- `is_append: bool (default = false)` ➡ If `true`, the content is appended to the existing file; otherwise, the file is overwritten.
41+
42+
{<h4 className="custom-header"> Output: </h4>}
43+
44+
- `filepath: string` ➡ The path of the created CSV file.
45+
46+
{<h4 className="custom-header"> Usage: </h4>}
47+
48+
To create a new CSV file:
49+
50+
```cypher
51+
CALL csv_utils.create_csv_file("/tmp/data.csv", "id,name\n1,John", false) YIELD filepath;
52+
```
53+
54+
To append data to an existing CSV file:
55+
56+
```cypher
57+
CALL csv_utils.create_csv_file("/tmp/data.csv", "2,Jane", true) YIELD filepath;
58+
```
59+
60+
### `delete_csv_file()`
61+
62+
This procedure deletes the specified CSV file.
63+
64+
{<h4 className="custom-header"> Input: </h4>}
65+
66+
- `filepath: string` ➡ The path of the CSV file to be deleted.
67+
68+
{<h4 className="custom-header"> Output: </h4>}
69+
70+
None.
71+
72+
{<h4 className="custom-header"> Usage: </h4>}
73+
74+
To delete an existing CSV file:
75+
76+
```cypher
77+
CALL csv_utils.delete_csv_file("/tmp/data.csv");
78+
```

pages/advanced-algorithms/available-algorithms/conditional_execution.mdx renamed to pages/advanced-algorithms/available-algorithms/do.mdx

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: conditional_execution
2+
title: do
33
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.
44
---
55

@@ -8,7 +8,7 @@ import { Steps } from 'nextra/components'
88
import { Cards } from 'nextra/components'
99
import GitHub from '/components/icons/GitHub'
1010

11-
# conditional_execution
11+
# do
1212

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

3131
## Procedures
3232

33+
<Callout type="info">
34+
You can execute this algorithm on [graph projections, subgraphs or portions of the graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph).
35+
</Callout>
36+
3337
The following procedures can't be used to run queries that execute global operations:
3438

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

4953
{<h4 className="custom-header"> Input: </h4>}
50-
54+
* `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.
55+
If subgraph is not specified, the algorithm is computed on the entire graph by default.
5156
* `conditionals: List[Any]` ➡ Variable-length list of condition-query pairs
5257
structured as `[condition, query, condition, query, …​]`. Conditions are
5358
`boolean` and queries are `string`.
@@ -88,7 +93,8 @@ RETURN value.graph_status AS graph_status;
8893
`$param_name`.
8994

9095
{<h4 className="custom-header"> Input: </h4>}
91-
96+
* `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.
97+
If subgraph is not specified, the algorithm is computed on the entire graph by default.
9298
* `condition: boolean` ➡ Determines what query to execute.
9399
* `if_query: string` ➡ The query to be executed if the condition is satisfied.
94100
* `else_query: string (default = "")` ➡ The query to be executed if the
@@ -123,7 +129,7 @@ RETURN value.graph_status AS graph_status;
123129

124130
The database contains the following data:
125131

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

128134
Created with the following Cypher queries:
129135

pages/advanced-algorithms/available-algorithms/graph_analyzer.mdx

+23
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,29 @@ CALL graph_analyzer.analyze(nodes_subset, edges_subset) YIELD name, value
111111
RETURN name, value;
112112
```
113113

114+
### `help()`
115+
116+
Shows the manual page for `graph_analyzer`.
117+
118+
{<h4 className="custom-header"> Input: </h4>}
119+
120+
None.
121+
122+
{<h4 className="custom-header"> Output: </h4>}
123+
124+
- `name: string` ➡ The name of the procedure.
125+
- `value: string` ➡ Explanation of the procedure.
126+
127+
{<h4 className="custom-header"> Usage: </h4>}
128+
129+
Use the following query to analyze the graph:
130+
131+
```cypher
132+
CALL graph_analyzer.help()
133+
YIELD name, value
134+
RETURN name, value;
135+
```
136+
114137
## Example
115138

116139
<Steps>

pages/advanced-algorithms/available-algorithms/meta.mdx

+30-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ title: meta
33
description: Create metadata about the database using procedures from the MAGE Library.
44
---
55

6+
import { Callout } from 'nextra/components';
67
import { Cards } from 'nextra/components'
78
import GitHub from '/components/icons/GitHub'
89

910
# meta
1011

12+
<Callout type="info">
13+
14+
This module got deprecated in `v2.21.0` with the addition of the [`SHOW SCHEMA INFO`](/querying/schema) feature.
15+
16+
</Callout>
17+
1118
The **meta** module provides a set of procedures for generating metadata about the database.
1219

1320
<Cards>
@@ -192,4 +199,26 @@ CALL meta.stats_offline() YIELD stats;
192199
|} |
193200
| |
194201
+-------------------------------------------------------+
195-
```
202+
```
203+
204+
### `update()`
205+
206+
Helper function used in the trigger for the `stats_online` procedure. You should not use this manually.
207+
208+
### `reset()`
209+
210+
Deletes all stored metadata about the graph.
211+
212+
{<h4 className="custom-header"> Input: </h4>}
213+
214+
None.
215+
216+
{<h4 className="custom-header"> Output: </h4>}
217+
218+
None.
219+
220+
{<h4 className="custom-header"> Usage: </h4>}
221+
222+
```cypher
223+
CALL meta.reset();
224+
```

pages/advanced-algorithms/available-algorithms/tgn.mdx

+20-1
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,25 @@ YIELD prediction
410410
RETURN n,m, prediction;
411411
```
412412

413+
### `reset()`
414+
415+
Deletes all stored data about the graph.
416+
417+
{<h4 className="custom-header"> Input: </h4>}
418+
419+
None.
420+
421+
{<h4 className="custom-header"> Output: </h4>}
422+
423+
- `message: string` ➡ Information on whether the reset was successful.
424+
425+
{<h4 className="custom-header"> Usage: </h4>}
426+
427+
```cypher
428+
CALL tgn.reset() YIELD message RETURN message;
429+
```
430+
431+
413432
## Example
414433

415434
<Steps>
@@ -530,4 +549,4 @@ Results:
530549
+--------------------+--------------------+--------------------+--------------------+--------------------+
531550
```
532551

533-
</Steps>
552+
</Steps>

pages/release-notes.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -2929,8 +2929,8 @@ instance, then the REPLICA instances.
29292929
module](/advanced-algorithms/available-algorithms/periodic) allows batching results from one query
29302930
into another to improve execution time.
29312931
[#221](https://github.com/memgraph/mage/pull/221)
2932-
- The [`conditional_execution`
2933-
module](/advanced-algorithms/available-algorithms/conditional_execution) which allows the
2932+
- The [`do`
2933+
module](/advanced-algorithms/available-algorithms/do) which allows the
29342934
execution of different queries depending on certain conditions being met, has
29352935
been rewritten from Python to C++ to improve performance and it can also
29362936
periodically iterates. [#222](https://github.com/memgraph/mage/pull/222)
@@ -3166,7 +3166,7 @@ instance, then the REPLICA instances.
31663166
{<h4 className="custom-header"> Features and improvements </h4>}
31673167

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

0 commit comments

Comments
 (0)