Skip to content

Commit 4d044e4

Browse files
committed
Follow our own doc guidelines
1 parent 330ee55 commit 4d044e4

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

doc/README.md

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ We use asciidoc for writing documentation, and we render it to both HTML and PDF
88

99
### Rendering the docs locally
1010

11-
First, run `npm install` to install all dependencies. You only need to do this once.
11+
First, run `npm install` to install all dependencies.
12+
You only need to do this once.
1213
To build and view the docs locally, use `npm start`.
1314
This will build the docs, start a web server hosting the docs at http://localhost:8000.
1415

@@ -22,7 +23,9 @@ If you experiene any kind of trouble, try `npm cache clear --force`
2223

2324
Currently, our toolchain cannot render LaTeX snippets into PDF (works for HTML tho!). So we are unable to use it.
2425

25-
What you can do though is use _cursive_, `monospace` and `.svg` images for anything more complicated. https://www.codecogs.com/latex/eqneditor.php is helpful for inputting LaTeX and outputting `.svg` images, or any other image format for that matter. We seem to use `.svg` so maybe stick to that.
26+
What you can do though is use _cursive_, `monospace` and `.svg` images for anything more complicated.
27+
https://www.codecogs.com/latex/eqneditor.php is helpful for inputting LaTeX and outputting `.svg` images, or any other image format for that matter.
28+
We seem to use `.svg` so maybe stick to that.
2629

2730

2831
### Documentation authoring
@@ -38,13 +41,20 @@ We use a few conventions for documentation source management:
3841

3942
## Documentation testing
4043

41-
We do documentation testing where we scan documentation pages; extract setup queries, project queries and example queries; and execute them as tests. A page is a natural boundary for a set of tests, and generally there is some data setup at the start, followed by several examples down the page. This pattern aligns very well with telling a coherent story.
44+
We do documentation testing where we scan documentation pages; extract setup queries, project queries and example queries; and execute them as tests.
45+
A page is a natural boundary for a set of tests, and generally there is some data setup at the start, followed by several examples down the page.
46+
This pattern aligns very well with telling a coherent story.
4247

4348
**NB:** You can have tests that span several pages.
4449

50+
4551
### Setup
4652

47-
Setup queries are executed first. Think Cypher `CREATE` statements and their friends. You need a database innit. These happen once per page, the JUnit equivalent is `@BeforeAll`. And that is an important point, we use JUnit as the driver for the tests, so we extract code snippets and turn pages into JUnit tests effectively.
53+
Setup queries are executed first.
54+
Think Cypher `CREATE` statements and their friends.
55+
You need a database innit.
56+
These happen once per page, the JUnit equivalent is `@BeforeAll`.
57+
And that is an important point, we use JUnit as the driver for the tests, so we extract code snippets and turn pages into JUnit tests effectively.
4858

4959
```
5060
[source, cypher, role=noplay setup-query]
@@ -57,13 +67,17 @@ CREATE (a:Location {name: 'A'}),
5767
----
5868
```
5969

60-
AsciiDoc parses the above _source block_ and applies some _cypher_ styling, those are both unrelated to testing. So is the `role=noplay` attribute which controls rendering a button in the final documentation page.
70+
AsciiDoc parses the above _source block_ and applies some _cypher_ styling, those are both unrelated to testing.
71+
So is the `role=noplay` attribute which controls rendering a button in the final documentation page.
6172

6273
What you need to know is that the `setup-query` puts the `CREATE` statement in among the `@BeforeAll` queries on a Neo4j instance that is lifecycled with the page.
6374

75+
6476
### Project
6577

66-
Project queries happen next, taking data from Neo4j into GDS. Scope here is, we give you a clean projection for each example, for safety. This is implemented with JUnit `@BeforeEach` semantics.
78+
Project queries happen next, taking data from Neo4j into GDS.
79+
Scope here is, we give you a clean projection for each example, for safety.
80+
This is implemented with JUnit `@BeforeEach` semantics.
6781

6882
```
6983
[source, cypher, role=noplay graph-project-query]
@@ -81,9 +95,12 @@ CALL gds.graph.project(
8195

8296
The interesting bit there is the `graph-project-query` attribute.
8397

98+
8499
### Demonstrate/ test
85100

86-
And lastly, we execute examples. `@Test`s. Here the convention is to have a Cypher statement with a procedure call first, and then a result table that gets turned into assertions about the output of the procedure call.
101+
And lastly, we execute examples.
102+
`@Test`s.
103+
Here the convention is to have a Cypher statement with a procedure call first, and then a result table that gets turned into assertions about the output of the procedure call.
87104

88105
```
89106
[role=query-example]
@@ -127,9 +144,11 @@ We then need to provide two blocks inside, a query and a result table. We demarc
127144

128145
Remember to match and close the blocks!
129146

147+
130148
#### Ignoring results
131149

132-
Sometimes you want to run a test that has no assertions. For this use case you have the `no-results` attribute:
150+
Sometimes you want to run a test that has no assertions.
151+
For this use case you have the `no-results` attribute:
133152

134153
```
135154
It is now safe to drop the in-memory graph or shutdown the db, as we can restore it at a later point.
@@ -143,9 +162,12 @@ CALL gds.graph.drop('myGraph')
143162
--
144163
```
145164

165+
146166
#### Grouping tests
147167

148-
Sometimes you want your test to span multiple queries, so that one can observe side effects from another. You use the `group` attribute. Imagine you do first call a mutate procedure:
168+
Sometimes you want your test to span multiple queries, so that one can observe side effects from another.
169+
You use the `group` attribute.
170+
Imagine you do first call a mutate procedure:
149171

150172
```
151173
[role=query-example, group=louvain-conductance]
@@ -191,6 +213,7 @@ YIELD community, conductance
191213

192214
These two procedure calls are wrapped in a single test, and this within the scope of a single `@BeforeEach` (projection).
193215

216+
194217
#### Impersonating a user
195218

196219
For some procedures the operator matters, and we have the `operator` attribute:
@@ -203,6 +226,8 @@ CALL gds.alpha.config.defaults.set('concurrency', 12, 'Alicia')
203226
----
204227
```
205228

229+
206230
#### Limitations
207231

208-
Remember, you are executing queries against an in-memory Neo4j Community database, so functional things like RBAC are not available. And hence, you would not be able to illustrate any procedures requiring administrator-like privileges.
232+
Remember, you are executing queries against an in-memory Neo4j Community database, so functional things like RBAC are not available.
233+
And hence, you would not be able to illustrate any procedures requiring administrator-like privileges

0 commit comments

Comments
 (0)