Skip to content

Commit ae460ff

Browse files
committed
Improve cypher aggregation docs
* how labels and properties are picked * parameters inside the node and relationshipConfig * fix the optional parameters intro
1 parent 3002197 commit ae460ff

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

doc/modules/ROOT/pages/management-ops/projections/graph-project-cypher-aggregation.adoc

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,43 @@
33
:description: This section details projecting GDS graphs using `Cypher` aggregations.
44

55

6+
Using Cypher aggregations is a more flexible and expressive approach with diminished focus on performance compared to the xref:management-ops/projections/graph-project.adoc[native projections].
7+
Cypher aggregations are primarily recommended for the development phase (see xref:common-usage/index.adoc[Common usage]).
68

7-
A projected graph can be stored in the catalog under a user-defined name.
8-
Using that name, the graph can be referred to by any algorithm in the library.
9-
This allows multiple algorithms to use the same graph without having to project it on each algorithm run.
109

11-
Using Cypher aggregations is a more flexible and expressive approach with diminished focus on performance compared to the xref:management-ops/projections/graph-project.adoc[native projections].
12-
Cypher projections are primarily recommended for the development phase (see xref:common-usage/index.adoc[Common usage]).
10+
== Considerations
1311

14-
[NOTE]
15-
--
16-
There is also a way to generate a random graph, see xref:management-ops/projections/graph-generation.adoc[Graph Generation] documentation for more details.
17-
--
12+
=== Lifecycle
1813

1914
[NOTE]
2015
--
21-
The projected graph will reside in the catalog until:
16+
The projected graphs will reside in the catalog until either:
2217

2318
- the graph is dropped using xref:graph-drop.adoc[gds.graph.drop]
2419
- the Neo4j database from which the graph was projected is stopped or dropped
2520
- the Neo4j database management system is stopped.
2621
--
2722

2823

24+
=== Node property support
25+
26+
Cypher aggregations can only project a limited set of node property types from a Cypher query.
27+
The xref:management-ops/node-properties.adoc#node-properties-supported[Node Properties page] details which node property types are supported.
28+
Other types of node properties have to be transformed or encoded into one of the supported types in order to be projected using a Cypher aggregation.
29+
30+
=== Selection of node properties and labels
31+
32+
If a node occurs multiple times, the node properties and labels of the first occurrence will be used for the projection.
33+
This is important when a node can be a source node as well as a target node.
34+
35+
2936
[[graph-project-cypher-aggregation-syntax]]
3037
== Syntax
3138

3239
A Cypher aggregation is used in a query as an aggregation over the relationships that are being projected.
3340
It takes three mandatory arguments: `graphName`, `sourceNode` and `targetNode`.
34-
In addition, the optional `sourceNodeProperties`, `targetNodeProperties`, and `relationshipProperties` parameters allows us to project properties.
41+
In addition, the optional `nodesConfig`, `relationshipConfig` parameters can be used to project properties and label or types.
42+
The optional `configuration` parameter can be used for general configuration of the projection such as `readConcurrency`.
3543

3644
[.graph-project-cypher-aggregation-syntax]
3745
--
@@ -53,15 +61,35 @@ RETURN gds.alpha.graph.project(
5361
----
5462

5563
.Parameters
56-
[opts="header",cols="1,1,8"]
64+
[opts="header",cols="2,1,7"]
5765
|===
5866
| Name | Optional | Description
5967
| graphName | no | The name under which the graph is stored in the catalog.
6068
| sourceNode | no | The source node of the relationship. Must not be null.
6169
| targetNode | yes | The target node of the relationship. The targetNode can be null (for example due to an `OPTIONAL MATCH`), in which case the source node is projected as an unconnected node.
62-
| nodesConfig | yes | Properties and Labels configuration for the source and target nodes.
63-
| relationshipConfig | yes | Properties and Type configuration for the relationship.
64-
| configuration | yes | Additional parameters to configure the cypher aggregation projection.
70+
| <<graph-project-cypher-aggregation-syntax-nodesConfig, nodesConfig>> | yes | Properties and Labels configuration for the source and target nodes.
71+
| <<graph-project-cypher-aggregation-syntax-relationshipConfig, relationshipConfig>> | yes | Properties and Type configuration for the relationship.
72+
| <<graph-project-cypher-aggregation-syntax-configuration, configuration>> | yes | Additional parameters to configure the cypher aggregation projection.
73+
|===
74+
75+
[[graph-project-cypher-aggregation-syntax-nodesConfig]]
76+
.Nodes configuration
77+
[opts="header",cols="1,1,1,4"]
78+
|===
79+
| Name | Type | Default | Description
80+
| sourceNodeProperties | Map | {} | The properties of the source node.
81+
| targetNodeProperties | Map | {} | The properties of the target node.
82+
| sourceNodeLabels | List of String or String | [] | The label(s) of the source node.
83+
| targetNodeLabels | List of String or String | [] | The label(s) of the source node.
84+
|===
85+
86+
[[graph-project-cypher-aggregation-syntax-relationshipConfig]]
87+
.Relationship configuration
88+
[opts="header",cols="1,1,1,4"]
89+
|===
90+
| Name | Type | Default | Description
91+
| properties | Map | {} | The properties of the source node.
92+
| relationshipType | String | '*' | The type of the relationship.
6593
|===
6694

6795
[[graph-project-cypher-aggregation-syntax-configuration]]

0 commit comments

Comments
 (0)