@loradb/lora-node 0.36.0 → 0.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +5 -0
  2. package/docs/README.md +86 -0
  3. package/docs/concepts/graph-model.md +270 -0
  4. package/docs/concepts/nodes.md +285 -0
  5. package/docs/concepts/properties.md +348 -0
  6. package/docs/concepts/relationships.md +325 -0
  7. package/docs/concepts/result-formats.md +183 -0
  8. package/docs/concepts/schema-free.md +183 -0
  9. package/docs/cookbook.md +1081 -0
  10. package/docs/data-types/lists-and-maps.md +406 -0
  11. package/docs/data-types/overview.md +210 -0
  12. package/docs/data-types/scalars.md +376 -0
  13. package/docs/data-types/spatial.md +291 -0
  14. package/docs/data-types/temporal.md +355 -0
  15. package/docs/data-types/vectors.md +563 -0
  16. package/docs/errors.md +183 -0
  17. package/docs/functions/aggregation.md +372 -0
  18. package/docs/functions/list.md +522 -0
  19. package/docs/functions/map.md +207 -0
  20. package/docs/functions/math.md +421 -0
  21. package/docs/functions/number.md +197 -0
  22. package/docs/functions/overview.md +545 -0
  23. package/docs/functions/spatial.md +384 -0
  24. package/docs/functions/string.md +502 -0
  25. package/docs/functions/temporal.md +590 -0
  26. package/docs/functions/utility.md +137 -0
  27. package/docs/functions/vectors.md +772 -0
  28. package/docs/getting-started/installation.md +204 -0
  29. package/docs/getting-started/node.md +582 -0
  30. package/docs/getting-started/tutorial.md +334 -0
  31. package/docs/index.md +203 -0
  32. package/docs/limitations.md +291 -0
  33. package/docs/performance.md +219 -0
  34. package/docs/queries/aggregation.md +520 -0
  35. package/docs/queries/cheat-sheet.md +302 -0
  36. package/docs/queries/constraints.md +239 -0
  37. package/docs/queries/create.md +331 -0
  38. package/docs/queries/examples.md +453 -0
  39. package/docs/queries/index.md +169 -0
  40. package/docs/queries/indexes.md +546 -0
  41. package/docs/queries/match.md +429 -0
  42. package/docs/queries/ordering.md +359 -0
  43. package/docs/queries/parameters.md +328 -0
  44. package/docs/queries/paths.md +462 -0
  45. package/docs/queries/return-with.md +500 -0
  46. package/docs/queries/set-delete.md +369 -0
  47. package/docs/queries/unwind-merge.md +358 -0
  48. package/docs/queries/where.md +416 -0
  49. package/docs/snapshot.md +545 -0
  50. package/docs/troubleshooting.md +1158 -0
  51. package/docs/wal.md +570 -0
  52. package/docs/why.md +273 -0
  53. package/package.json +13 -14
@@ -0,0 +1,453 @@
1
+ ---
2
+ title: "Cypher Query Examples for LoraDB"
3
+ description: "Copy-paste Cypher examples that run against one seeded LoraDB playground graph."
4
+ online: "https://loradb.com/docs/queries/examples"
5
+ package: "@loradb/lora-node@0.36.2"
6
+ ---
7
+
8
+ # Cypher Query Examples for LoraDB
9
+
10
+ These examples are designed for the playground. Start with a fresh database,
11
+ run the seed query once, then run any example on this page. The snippets avoid
12
+ host-side parameters so they can execute directly in the browser.
13
+
14
+ > Working through this for the first time? Try the guided version at
15
+ > [**A Ten-Minute Tour**](../getting-started/tutorial.md) first.
16
+
17
+ ## On this page
18
+
19
+ - [Seed graph](#seed-graph)
20
+ - [Pattern matching](#pattern-matching)
21
+ - [Filtering with WHERE](#filtering-with-where)
22
+ - [Optional patterns](#optional-patterns)
23
+ - [Aggregation](#aggregation)
24
+ - [Parameter-shaped filters](#parameter-shaped-filters)
25
+ - [Updating and deleting](#updating-and-deleting)
26
+ - [CASE expressions](#case-expressions)
27
+ - [Common patterns](#common-patterns)
28
+ - [Domain shapes](#domain-shapes)
29
+
30
+ ## Seed graph
31
+
32
+ Run this once in an empty playground database. It creates people, companies,
33
+ projects, tasks, stations, movies, and relationships between them.
34
+
35
+ ```cypher
36
+ CREATE (alice:Person:User {id: 1, name: 'Alice', handle: 'alice', born: 1989, city: 'London', score: 1200, tier: 'bronze'})
37
+ CREATE (bob:Person:User {id: 2, name: 'Bob', handle: 'bob', born: 1994, city: 'Berlin', score: 240, tier: 'bronze'})
38
+ CREATE (carol:Person:User {id: 3, name: 'Carol', handle: 'carol', born: 1982, city: 'London', score: 80, tier: 'bronze'})
39
+ CREATE (dave:Person:User {id: 4, name: 'Dave', handle: 'dave', born: 1996, city: 'Paris', score: 30, tier: 'bronze'})
40
+ CREATE (eve:Person:User:Influencer {id: 5, name: 'Eve', handle: 'eve', born: 1991, city: 'Berlin', score: 500, tier: 'bronze'})
41
+ CREATE (frank:Person {id: 6, name: 'Frank', handle: 'frank', born: 1978, city: 'London', score: 40})
42
+ CREATE (alice)-[:KNOWS {since: 2015, strength: 5}]->(bob)
43
+ CREATE (alice)-[:KNOWS {since: 2018, strength: 8}]->(carol)
44
+ CREATE (bob)-[:KNOWS {since: 2019, strength: 4}]->(carol)
45
+ CREATE (bob)-[:KNOWS {since: 2020, strength: 3}]->(dave)
46
+ CREATE (carol)-[:KNOWS {since: 2017, strength: 6}]->(eve)
47
+ CREATE (eve)-[:KNOWS {since: 2016, strength: 7}]->(frank)
48
+ CREATE (alice)-[:FOLLOWS]->(carol)
49
+ CREATE (alice)-[:FOLLOWS]->(eve)
50
+ CREATE (bob)-[:FOLLOWS]->(alice)
51
+ CREATE (carol)-[:FOLLOWS]->(frank)
52
+ CREATE (dave)-[:FOLLOWS]->(alice)
53
+ CREATE (frank)-[:FOLLOWS]->(bob)
54
+ CREATE (music:Interest {name: 'Music'})
55
+ CREATE (travel:Interest {name: 'Travel'})
56
+ CREATE (sports:Interest {name: 'Sports'})
57
+ CREATE (alice)-[:INTERESTED_IN {level: 'high'}]->(music)
58
+ CREATE (alice)-[:INTERESTED_IN {level: 'medium'}]->(travel)
59
+ CREATE (bob)-[:INTERESTED_IN {level: 'high'}]->(sports)
60
+ CREATE (dave)-[:INTERESTED_IN {level: 'high'}]->(music)
61
+ CREATE (eve)-[:INTERESTED_IN {level: 'high'}]->(travel)
62
+ CREATE (acme:Company {name: 'Acme', founded: 2010})
63
+ CREATE (contoso:Company {name: 'Contoso', founded: 2018})
64
+ CREATE (alice)-[:WORKS_AT {since: 2018}]->(acme)
65
+ CREATE (bob)-[:WORKS_AT {since: 2020}]->(acme)
66
+ CREATE (carol)-[:WORKS_AT {since: 2015}]->(acme)
67
+ CREATE (dave)-[:WORKS_AT {since: 2021}]->(contoso)
68
+ CREATE (eve)-[:WORKS_AT {since: 2022}]->(contoso)
69
+ CREATE (alpha:Project {name: 'Alpha', budget: 100000})
70
+ CREATE (beta:Project {name: 'Beta', budget: 50000})
71
+ CREATE (alice)-[:ASSIGNED_TO {role: 'lead'}]->(alpha)
72
+ CREATE (bob)-[:ASSIGNED_TO {role: 'dev'}]->(alpha)
73
+ CREATE (carol)-[:ASSIGNED_TO {role: 'lead'}]->(beta)
74
+ CREATE (eve)-[:ASSIGNED_TO {role: 'dev'}]->(beta)
75
+ CREATE (:Task {title: 'Fix login', status: 'done', priority: 'p1'})
76
+ CREATE (:Task {title: 'Ship billing', status: 'pending', priority: 'p0'})
77
+ CREATE (:Task {title: 'Archive logs', status: 'cancelled', priority: 'p2'})
78
+ CREATE (ams:Station {name: 'Amsterdam', zone: 1})
79
+ CREATE (utrecht:Station {name: 'Utrecht', zone: 1})
80
+ CREATE (rotterdam:Station {name: 'Rotterdam', zone: 2})
81
+ CREATE (denhaag:Station {name: 'Den Haag', zone: 2})
82
+ CREATE (eindhoven:Station {name: 'Eindhoven', zone: 3})
83
+ CREATE (ams)-[:ROUTE {distance: 40, duration: 25}]->(utrecht)
84
+ CREATE (utrecht)-[:ROUTE {distance: 40, duration: 25}]->(ams)
85
+ CREATE (ams)-[:ROUTE {distance: 60, duration: 40}]->(rotterdam)
86
+ CREATE (rotterdam)-[:ROUTE {distance: 60, duration: 40}]->(ams)
87
+ CREATE (utrecht)-[:ROUTE {distance: 55, duration: 35}]->(rotterdam)
88
+ CREATE (rotterdam)-[:ROUTE {distance: 55, duration: 35}]->(utrecht)
89
+ CREATE (rotterdam)-[:ROUTE {distance: 25, duration: 15}]->(denhaag)
90
+ CREATE (denhaag)-[:ROUTE {distance: 25, duration: 15}]->(rotterdam)
91
+ CREATE (utrecht)-[:ROUTE {distance: 100, duration: 60}]->(eindhoven)
92
+ CREATE (eindhoven)-[:ROUTE {distance: 100, duration: 60}]->(utrecht)
93
+ CREATE (matrix:Movie {title: 'Matrix', year: 1999, genre: 'sci-fi'})
94
+ CREATE (inception:Movie {title: 'Inception', year: 2010, genre: 'sci-fi'})
95
+ CREATE (amelie:Movie {title: 'Amelie', year: 2001, genre: 'drama'})
96
+ CREATE (jaws:Movie {title: 'Jaws', year: 1975, genre: 'thriller'})
97
+ CREATE (alice)-[:RATED {score: 5}]->(matrix)
98
+ CREATE (alice)-[:RATED {score: 4}]->(inception)
99
+ CREATE (alice)-[:RATED {score: 3}]->(amelie)
100
+ CREATE (bob)-[:RATED {score: 5}]->(matrix)
101
+ CREATE (bob)-[:RATED {score: 2}]->(jaws)
102
+ CREATE (carol)-[:RATED {score: 4}]->(amelie)
103
+ CREATE (carol)-[:RATED {score: 5}]->(inception)
104
+ CREATE (:Scratch {name: 'temporary'})
105
+ ```
106
+
107
+ ## Pattern matching
108
+
109
+ [`MATCH`](./match.md) finds every way to satisfy a pattern. This returns one row
110
+ for each directed `KNOWS` relationship.
111
+
112
+ ```cypher
113
+ MATCH (p:Person)-[:KNOWS]->(other:Person)
114
+ RETURN p.name AS person, other.name AS knows
115
+ ORDER BY person, knows
116
+ ```
117
+
118
+ ### Multi-hop
119
+
120
+ ```cypher
121
+ MATCH (a:Person)-[:KNOWS]->(b:Person)-[:KNOWS]->(c:Person)
122
+ RETURN a.name AS start, b.name AS middle, c.name AS finish
123
+ ORDER BY start, finish
124
+ ```
125
+
126
+ ### Either direction
127
+
128
+ ```cypher
129
+ MATCH (a:Person)-[:KNOWS]-(b:Person)
130
+ RETURN a.name AS person, b.name AS connected
131
+ ORDER BY person, connected
132
+ ```
133
+
134
+ ## Filtering with WHERE
135
+
136
+ [`WHERE`](./where.md) runs after `MATCH` and can reference anything the match
137
+ bound.
138
+
139
+ ```cypher
140
+ MATCH (p:Person)
141
+ WHERE p.born < 1990 AND p.name STARTS WITH 'A'
142
+ RETURN p.name AS name, p.born AS born
143
+ ORDER BY born ASC
144
+ ```
145
+
146
+ ### IN list membership
147
+
148
+ ```cypher
149
+ MATCH (p:Person)
150
+ WHERE p.city IN ['London', 'Berlin']
151
+ RETURN p.name AS name, p.city AS city
152
+ ORDER BY city, name
153
+ ```
154
+
155
+ ### NOT EXISTS anti-join
156
+
157
+ ```cypher
158
+ MATCH (p:Person)
159
+ WHERE NOT EXISTS { (p)-[:FOLLOWS]->() }
160
+ RETURN p.name AS person_without_outgoing_follows
161
+ ```
162
+
163
+ ## Optional patterns
164
+
165
+ [`OPTIONAL MATCH`](./match.md#optional-match) keeps the row and fills missing
166
+ bindings with `null`.
167
+
168
+ ```cypher
169
+ MATCH (p:Person {name: 'Eve'})
170
+ OPTIONAL MATCH (p)-[:FOLLOWS]->(target:Person)
171
+ RETURN p.name AS person, target.name AS follows
172
+ ```
173
+
174
+ ## Aggregation
175
+
176
+ Any non-aggregated column becomes an
177
+ [implicit group key](./aggregation.md#grouping).
178
+
179
+ ```cypher
180
+ MATCH (p:Person)-[:KNOWS]->(friend:Person)
181
+ RETURN p.name AS person, count(friend) AS friends
182
+ ORDER BY friends DESC, person
183
+ ```
184
+
185
+ ### Collect into a list
186
+
187
+ ```cypher
188
+ MATCH (p:Person)-[:INTERESTED_IN]->(interest:Interest)
189
+ RETURN p.name AS person, collect(interest.name) AS interests
190
+ ORDER BY person
191
+ ```
192
+
193
+ ### Multiple aggregates
194
+
195
+ ```cypher
196
+ MATCH (p:Person)
197
+ RETURN count(*) AS people,
198
+ min(p.born) AS earliest,
199
+ max(p.born) AS latest,
200
+ avg(p.born) AS mean_year
201
+ ```
202
+
203
+ ## Parameter-shaped filters
204
+
205
+ The [playground](https://loradb.com/docs/getting-started/playground) accepts inline literals
206
+ so the examples on this page run as-is. In application code, replace the
207
+ literals with `$name`, `$city`, or other parameters through your binding.
208
+
209
+ ```cypher
210
+ MATCH (p:Person {name: 'Alice'})
211
+ WHERE p.city = 'London'
212
+ RETURN p.name AS name, p.city AS city, p.score AS score
213
+ ```
214
+
215
+ See [Parameters](./parameters.md) for host API examples that bind `$name`,
216
+ `$city`, and structured values safely.
217
+
218
+ ## Updating and deleting
219
+
220
+ [`SET`](./set-delete.md#set--properties) updates properties. `SET n += {...}`
221
+ merges a patch into the existing property map.
222
+
223
+ ```cypher
224
+ MATCH (p:Person {name: 'Alice'})
225
+ SET p += {city: 'Oxford', score: 1300}
226
+ RETURN p.name AS name, p.city AS city, p.score AS score
227
+ ```
228
+
229
+ Deleting a node with relationships requires
230
+ [`DETACH DELETE`](./set-delete.md#detach-delete). This example deletes only the
231
+ disposable `Scratch` node from the seed data.
232
+
233
+ ```cypher
234
+ MATCH (s:Scratch {name: 'temporary'})
235
+ DETACH DELETE s
236
+ ```
237
+
238
+ ## CASE expressions
239
+
240
+ [`CASE`](./return-with.md#case-expressions) is LoraDB's conditional expression.
241
+
242
+ ### Simple form
243
+
244
+ ```cypher
245
+ MATCH (t:Task)
246
+ RETURN t.title AS task,
247
+ CASE t.status
248
+ WHEN 'done' THEN 'counted'
249
+ WHEN 'cancelled' THEN 'closed'
250
+ WHEN 'pending' THEN 'waiting'
251
+ ELSE 'unknown'
252
+ END AS state
253
+ ORDER BY task
254
+ ```
255
+
256
+ ### Generic form
257
+
258
+ ```cypher
259
+ MATCH (u:User)
260
+ RETURN u.name AS user,
261
+ CASE
262
+ WHEN u.score >= 1000 THEN 'platinum'
263
+ WHEN u.score >= 100 THEN 'gold'
264
+ ELSE 'bronze'
265
+ END AS tier
266
+ ORDER BY tier, user
267
+ ```
268
+
269
+ ### Conditional count (CASE inside count)
270
+
271
+ `count(expr)` skips `null`, so a `CASE` without `ELSE` can count only the
272
+ rows that match a condition.
273
+
274
+ ```cypher
275
+ MATCH (u:User)-[r:RATED]->(m:Movie)
276
+ RETURN m.title AS movie,
277
+ count(CASE WHEN r.score >= 4 THEN 1 END) AS positive,
278
+ count(CASE WHEN r.score <= 2 THEN 1 END) AS negative,
279
+ count(*) AS total
280
+ ORDER BY movie
281
+ ```
282
+
283
+ ### Custom sort order
284
+
285
+ ```cypher
286
+ MATCH (t:Task)
287
+ RETURN t.title AS task, t.priority AS priority
288
+ ORDER BY CASE t.priority
289
+ WHEN 'p0' THEN 0
290
+ WHEN 'p1' THEN 1
291
+ WHEN 'p2' THEN 2
292
+ ELSE 3
293
+ END
294
+ ```
295
+
296
+ ### In SET
297
+
298
+ ```cypher
299
+ MATCH (u:User)
300
+ SET u.tier = CASE
301
+ WHEN u.score >= 1000 THEN 'platinum'
302
+ WHEN u.score >= 100 THEN 'gold'
303
+ ELSE 'bronze'
304
+ END
305
+ RETURN u.name AS user, u.tier AS tier
306
+ ORDER BY user
307
+ ```
308
+
309
+ ## Common patterns
310
+
311
+ ### Count nodes by label
312
+
313
+ ```cypher
314
+ MATCH (n:Person)
315
+ RETURN count(*) AS people
316
+ ```
317
+
318
+ ### Group by a property
319
+
320
+ ```cypher
321
+ MATCH (p:Person)
322
+ RETURN p.city AS city, count(*) AS people
323
+ ORDER BY people DESC, city
324
+ ```
325
+
326
+ ### Distinct values
327
+
328
+ ```cypher
329
+ MATCH (p:Person)
330
+ RETURN DISTINCT p.city AS city
331
+ ORDER BY city
332
+ ```
333
+
334
+ ### Filter before aggregating
335
+
336
+ ```cypher
337
+ MATCH (p:Person)
338
+ WHERE p.born >= 1990
339
+ RETURN count(*) AS born_since_1990
340
+ ```
341
+
342
+ ### Filter after aggregating
343
+
344
+ Cypher has no `HAVING`. Pipe through [`WITH`](./return-with.md#with), then
345
+ filter.
346
+
347
+ ```cypher
348
+ MATCH (p:Person)-[:KNOWS]->(friend:Person)
349
+ WITH p.name AS person, count(friend) AS friends
350
+ WHERE friends >= 2
351
+ RETURN person, friends
352
+ ORDER BY friends DESC
353
+ ```
354
+
355
+ ### Top-N
356
+
357
+ ```cypher
358
+ MATCH (p:Person)-[:KNOWS]->(friend:Person)
359
+ RETURN p.name AS person, count(friend) AS friends
360
+ ORDER BY friends DESC
361
+ LIMIT 3
362
+ ```
363
+
364
+ ### Upsert with MERGE
365
+
366
+ [`MERGE`](./unwind-merge.md#merge) finds a pattern or creates it.
367
+
368
+ ```cypher
369
+ MERGE (u:User {id: 99})
370
+ ON MATCH SET u.name = 'Zoe'
371
+ ON CREATE SET u.name = 'Zoe', u.handle = 'zoe', u.score = 0
372
+ RETURN u.id AS id, u.name AS name, u.handle AS handle
373
+ ```
374
+
375
+ ### Bulk load with UNWIND
376
+
377
+ ```cypher
378
+ UNWIND ['click', 'signup', 'click'] AS kind
379
+ CREATE (:Event {kind: kind})
380
+ RETURN kind AS imported
381
+ ```
382
+
383
+ ### Shortest path between two stations
384
+
385
+ ```cypher
386
+ MATCH p = shortestPath(
387
+ (from:Station {name: 'Amsterdam'})-[:ROUTE*]->(to:Station {name: 'Den Haag'})
388
+ )
389
+ RETURN path.length(p) AS hops, [n IN path.nodes(p) | n.name] AS route
390
+ ```
391
+
392
+ ## Domain shapes
393
+
394
+ These examples use the same seed graph but read like application queries.
395
+
396
+ ### People you might know
397
+
398
+ ```cypher
399
+ MATCH (me:User {name: 'Alice'})-[:FOLLOWS]->(:User)-[:FOLLOWS]->(candidate:User)
400
+ WHERE candidate <> me
401
+ AND NOT EXISTS { (me)-[:FOLLOWS]->(candidate) }
402
+ RETURN candidate.name AS candidate, count(*) AS shared_paths
403
+ ORDER BY shared_paths DESC, candidate
404
+ ```
405
+
406
+ ### Colleagues at the same company
407
+
408
+ ```cypher
409
+ MATCH (a:Person)-[:WORKS_AT]->(company:Company)<-[:WORKS_AT]-(b:Person)
410
+ WHERE id(a) < id(b)
411
+ RETURN company.name AS company, a.name AS person_a, b.name AS person_b
412
+ ORDER BY company, person_a, person_b
413
+ ```
414
+
415
+ ### Project staffing
416
+
417
+ ```cypher
418
+ MATCH (p:Person)-[assignment:ASSIGNED_TO]->(project:Project)
419
+ RETURN project.name AS project,
420
+ collect(p.name) AS people,
421
+ count(assignment) AS team_size
422
+ ORDER BY project
423
+ ```
424
+
425
+ ### Movie recommendations
426
+
427
+ ```cypher
428
+ MATCH (viewer:User {name: 'Bob'})-[:RATED]->(:Movie)<-[:RATED]-(peer:User)-[rating:RATED]->(movie:Movie)
429
+ WHERE NOT EXISTS { (viewer)-[:RATED]->(movie) }
430
+ RETURN movie.title AS movie, avg(rating.score) AS score
431
+ ORDER BY score DESC, movie
432
+ ```
433
+
434
+ ### Route options
435
+
436
+ ```cypher
437
+ MATCH (from:Station {name: 'Amsterdam'})-[route:ROUTE]->(to:Station)
438
+ RETURN to.name AS station,
439
+ route.distance AS distance_km,
440
+ route.duration AS duration_min
441
+ ORDER BY duration_min ASC
442
+ ```
443
+
444
+ ## See also
445
+
446
+ - [**Queries -> Overview**](./index.md) - clause-by-clause reference.
447
+ - [**Cheat sheet**](./cheat-sheet.md) - single-page quick reference.
448
+ - [**Tutorial**](../getting-started/tutorial.md) - same language, guided
449
+ top-to-bottom.
450
+ - [**Cookbook**](../cookbook.md) - scenario-driven recipes by domain.
451
+ - [**Parameters**](./parameters.md) - typed parameter binding.
452
+ - [**Functions**](../functions/overview.md) - every built-in.
453
+ - [**Concepts -> Graph Model**](../concepts/graph-model.md) - the data model.
@@ -0,0 +1,169 @@
1
+ ---
2
+ title: "Queries overview"
3
+ description: "An index of every Cypher clause LoraDB supports — MATCH, WHERE, RETURN, WITH, CREATE, MERGE, SET, DELETE, UNWIND, paths, and aggregation — with links to each clause reference."
4
+ online: "https://loradb.com/docs/queries"
5
+ package: "@loradb/lora-node@0.36.2"
6
+ ---
7
+
8
+ # Querying LoraDB with Cypher
9
+
10
+ LoraDB speaks a pragmatic subset of Cypher. Queries are strings that
11
+ chain _clauses_ — see the [clause reference](#clause-reference)
12
+ below, or jump into the [**Ten-Minute Tour**](../getting-started/tutorial.md)
13
+ for a guided run-through.
14
+
15
+ ```cypher
16
+ MATCH (p:Person)-[:WORKS_AT]->(c:Company)
17
+ WHERE p.active = true
18
+ RETURN p.name, c.name
19
+ ORDER BY p.name
20
+ ```
21
+
22
+ Each clause reads the rows emitted by the previous one and passes rows
23
+ forward. [`RETURN`](./return-with.md) ends the pipeline.
24
+
25
+ ## Anatomy of a query
26
+
27
+ ```text
28
+ MATCH — find patterns (produces rows)
29
+ ↓
30
+ WHERE — filter rows (drops rows)
31
+ ↓
32
+ WITH — project + optionally group (reshapes rows)
33
+ ↓
34
+ WHERE — filter rows post-aggregate (HAVING-style)
35
+ ↓
36
+ RETURN — project + sort + paginate (final shape)
37
+ ```
38
+
39
+ Not every query uses every stage. The important invariant: each clause
40
+ sees the rows produced by the previous one.
41
+
42
+ ## Clause reference
43
+
44
+ | Clause | Purpose |
45
+ |---|---|
46
+ | [**MATCH**](./match.md) | Find patterns of nodes and relationships |
47
+ | [**CREATE**](./create.md) | Create nodes and relationships |
48
+ | [**WHERE**](./where.md) | Filter rows |
49
+ | [**Indexes**](./indexes.md) | Declare, inspect, query, and drop secondary indexes |
50
+ | [**Constraints**](./constraints.md) | Add uniqueness, existence, key, and type checks |
51
+ | [**RETURN / WITH**](./return-with.md) | Project, rename, order, and page results |
52
+ | [**ORDER BY / SKIP / LIMIT**](./ordering.md) | Sort and paginate |
53
+ | [**SET / REMOVE / DELETE**](./set-delete.md) | Mutate existing entities |
54
+ | [**UNWIND / MERGE**](./unwind-merge.md) | Iterate over lists; create-or-match |
55
+ | [**Aggregation**](./aggregation.md) | `count`, `collect`, `avg`, and group-by |
56
+ | [**Paths**](./paths.md) | Variable-length traversals and shortest paths |
57
+
58
+ For copy-paste examples covering every clause, see
59
+ [**Query Examples**](./examples.md). For a single-page terse reference,
60
+ see the [**Cheat sheet**](./cheat-sheet.md).
61
+
62
+ ## Where common tasks live
63
+
64
+ | Task | Page |
65
+ |---|---|
66
+ | Look up by label + property | [MATCH](./match.md#inline-property-filter) |
67
+ | Write new nodes/edges | [CREATE](./create.md) |
68
+ | Upsert | [MERGE](./unwind-merge.md#merge) |
69
+ | Bulk import | [UNWIND + CREATE](./unwind-merge.md#bulk-load-from-parameter) |
70
+ | Patch a property map | [`SET +=`](./set-delete.md#merge-properties-) |
71
+ | Replace all properties | [`SET =`](./set-delete.md#replace-all-properties-) |
72
+ | Remove a property | [`REMOVE` / `SET n.p = null`](./set-delete.md#remove) |
73
+ | Delete with edges | [`DETACH DELETE`](./set-delete.md#detach-delete) |
74
+ | Top-N | [`ORDER BY + LIMIT`](./ordering.md#top-n) |
75
+ | Stable pagination | [Keyset pagination](./ordering.md#stable-pagination) |
76
+ | Group and aggregate | [Aggregation walkthrough](./aggregation.md#a-five-step-walkthrough) |
77
+ | HAVING-style filter | [`WITH … WHERE`](./return-with.md#having-style-filtering-with) |
78
+ | Anti-join | [`NOT EXISTS`](./where.md#pattern-existence) |
79
+ | Speed up common predicates | [`CREATE INDEX`](./indexes.md) |
80
+ | Enforce uniqueness or property shape | [`CREATE CONSTRAINT`](./constraints.md) |
81
+ | Shortest path | [`shortestPath`](./paths.md#shortest-paths) |
82
+ | Inline related list | [Pattern comprehension](../functions/list.md#pattern-comprehension) |
83
+ | Per-row conditional value | [CASE expressions](./return-with.md#case-expressions) |
84
+ | Count rows matching a condition | [`count(CASE WHEN … THEN 1 END)`](./examples.md#conditional-count-case-inside-count) |
85
+
86
+ ## Execution model
87
+
88
+ - Queries execute **atomically** per auto-commit call. Rust and in-process
89
+ bindings also expose explicit transactions; HTTP does not.
90
+ - Auto-commit reads can overlap on Arc snapshots. Write commits and explicit
91
+ read-write transactions serialize. See
92
+ [Limitations → Concurrency](../limitations.md#concurrency).
93
+ - Names (labels, relationship types, property keys) are never checked
94
+ against the stored data: [`CREATE`](./create.md), [`MERGE`](./unwind-merge.md#merge), and
95
+ [`SET`](./set-delete.md) accept any name, and a
96
+ [`MATCH`](./match.md) on a name nothing carries returns zero rows.
97
+ - Unknown function names are rejected at analysis time — see
98
+ [**Functions**](../functions/overview.md).
99
+
100
+ ## Parameters
101
+
102
+ Any value that isn't a constant should use a parameter. The short
103
+ version follows; [**Parameters**](./parameters.md) has the full reference.
104
+
105
+ ```cypher
106
+ MATCH (p:Person) WHERE p.name = $name RETURN p
107
+ ```
108
+
109
+ Parameters are bound at call time from the host language:
110
+
111
+ - [Rust](https://loradb.com/docs/getting-started/rust#parameterised-query) — `BTreeMap<String, LoraValue>`
112
+ - [Node.js](../getting-started/node.md#parameterised-query) — plain object
113
+ - [Python](https://loradb.com/docs/getting-started/python#parameterised-query) — `dict`
114
+ - [WASM](https://loradb.com/docs/getting-started/wasm#parameterised-query) — plain object
115
+ - [Go](https://loradb.com/docs/getting-started/go#parameterised-query) — `lora.Params`
116
+ - [Ruby](https://loradb.com/docs/getting-started/ruby#parameterised-query) — `Hash`
117
+ - [HTTP server](https://loradb.com/docs/api/http#post-query) — JSON `params` object
118
+
119
+ A parameter missing from the map fails the query before it runs; bind
120
+ `null` explicitly for "no value".
121
+
122
+ ### Parameters vs inline literals
123
+
124
+ ```cypher
125
+ // Safe (parameterised)
126
+ MATCH (u:User) WHERE u.id = $id RETURN u
127
+
128
+ ;// Unsafe if $id came from untrusted input and was inlined
129
+ MATCH (u:User) WHERE u.id = 42 RETURN u
130
+ ```
131
+
132
+ Parameters are the only supported way to mix untrusted input into a
133
+ query. They also let the query planner cache plans across invocations.
134
+
135
+ ### Parameter types
136
+
137
+ | Host value | LoraDB type |
138
+ |---|---|
139
+ | `null` / `None` / `undefined` | [`Null`](../data-types/scalars.md#null) |
140
+ | `bool` | [`Boolean`](../data-types/scalars.md#boolean) |
141
+ | `int` (Python) / `number` (JS, integer) / `i64` (Rust) | [`Integer`](../data-types/scalars.md#integer) |
142
+ | `float` (Python) / `number` (JS, non-integer) / `f64` (Rust) | [`Float`](../data-types/scalars.md#float) |
143
+ | `str` / `String` | [`String`](../data-types/scalars.md#string) |
144
+ | list / array / `Vec` | [`List`](../data-types/lists-and-maps.md#lists) |
145
+ | dict / object / `BTreeMap` | [`Map`](../data-types/lists-and-maps.md#maps) |
146
+ | host helpers (`date()`, `wgs84()`, …) | [`Date`](../data-types/temporal.md), [`Point`](../data-types/spatial.md), etc. |
147
+
148
+ Host helpers are binding APIs. In query text, use cast syntax for
149
+ typed construction, for example `'2026-05-01'::DATE` or
150
+ `{x: 1, y: 2}::POINT`.
151
+
152
+ ## What's not supported
153
+
154
+ See [**Limitations**](../limitations.md) for the full list. Short
155
+ version: no general-purpose `CALL`, no `LOAD CSV`, and no
156
+ multi-database (`USE`). Index and constraint DDL are supported for scoped
157
+ catalog entries; see [Indexes](./indexes.md) and [Constraints](./constraints.md).
158
+
159
+ ## See also
160
+
161
+ - [**Ten-Minute Tour**](../getting-started/tutorial.md) — guided walkthrough.
162
+ - [**Cheat sheet**](./cheat-sheet.md) — single-page quick reference.
163
+ - [**Parameters**](./parameters.md) — typed parameter binding.
164
+ - [**Query Examples**](./examples.md) — copy-paste recipes by shape.
165
+ - [**Cookbook**](../cookbook.md) — scenario-driven recipes.
166
+ - [**Functions**](../functions/overview.md) — every built-in.
167
+ - [**Data types**](../data-types/overview.md) — value shapes for parameters and properties.
168
+ - [**Graph model**](../concepts/graph-model.md) — the underlying data model.
169
+ - [**Result formats**](../concepts/result-formats.md) — how results come back over the wire.