Skip to content

Commit adb410b

Browse files
committed
docs(kuzu): add documents for kuzu
1 parent 7eeeaf5 commit adb410b

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

docs/docs/core/flow_def.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ It will use `Staging__doc_embeddings` as the collection name if the current app
348348
Most time a target storage is created by calling `export()` method on a collector, and this `export()` call comes with configurations needed for the target storage, e.g. options for storage indexes.
349349
Occasionally, you may need to specify some configurations for target storage out of the context of any specific data collector.
350350

351-
For example, for graph database targets like `Neo4j`, you may have a data collector to export data to Neo4j relationships, which will create nodes referenced by various relationships in turn.
351+
For example, for graph database targets like `Neo4j` and `Kuzu`, you may have a data collector to export data to relationships, which will create nodes referenced by various relationships in turn.
352352
These nodes don't directly come from any specific data collector (consider relationships from different data collectors may share the same nodes).
353353
To specify configurations for these nodes, you can *declare* spec for related node labels.
354354

docs/docs/ops/storages.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,12 @@ graph TD
391391
classDef node font-size:8pt,text-align:left,stroke-width:2;
392392
```
393393

394+
#### Examples
395+
396+
You can find end-to-end examples fitting into any of supported property graphs in the following directories:
397+
* [examples/docs_to_knowledge_graph](https://github.com/cocoindex-io/cocoindex/tree/main/examples/docs_to_knowledge_graph)
398+
* [examples/product_recommendation](https://github.com/cocoindex-io/cocoindex/tree/main/examples/product_recommendation)
399+
394400
### Neo4j
395401

396402
If you don't have a Neo4j database, you can start a Neo4j database using our docker compose config:
@@ -407,14 +413,14 @@ Please read and agree the license before starting the instance.
407413

408414
:::
409415

410-
The `Neo4j` storage exports each row as a relationship to Neo4j Knowledge Graph. The spec takes the following fields:
416+
The `Neo4j` target spec takes the following fields:
411417

412418
* `connection` (type: [auth reference](../core/flow_def#auth-registry) to `Neo4jConnectionSpec`): The connection to the Neo4j database. `Neo4jConnectionSpec` has the following fields:
413419
* `url` (type: `str`): The URI of the Neo4j database to use as the internal storage, e.g. `bolt://localhost:7687`.
414420
* `user` (type: `str`): Username for the Neo4j database.
415421
* `password` (type: `str`): Password for the Neo4j database.
416422
* `db` (type: `str`, optional): The name of the Neo4j database to use as the internal storage, e.g. `neo4j`.
417-
* `mapping` (type: `NodeMapping | RelationshipMapping`): The mapping from collected row to nodes or relationships of the graph. 2 variations are supported:
423+
* `mapping` (type: `Nodes | Relationships`): The mapping from collected row to nodes or relationships of the graph. For either [nodes to export](#nodes-to-export) or [relationships to export](#relationships-to-export).
418424

419425
Neo4j also provides a declaration spec `Neo4jDeclaration`, to configure indexing options for nodes only referenced by relationships. It has the following fields:
420426

@@ -424,4 +430,26 @@ Neo4j also provides a declaration spec `Neo4jDeclaration`, to configure indexing
424430
* `primary_key_fields` (required)
425431
* `vector_indexes` (optional)
426432

427-
You can find an end-to-end example [here](https://github.com/cocoindex-io/cocoindex/tree/main/examples/docs_to_knowledge_graph).
433+
### Kuzu
434+
435+
CocoIndex supports talking to Kuzu through its [API server](https://github.com/kuzudb/api-server).
436+
You can bring up a Kuzu API server locally by running:
437+
438+
```bash
439+
KUZU_DB_DIR=$HOME/.kuzudb
440+
KUZU_PORT=8123
441+
docker run -d --name kuzu -p ${KUZU_PORT}:8000 -v ${KUZU_DB_DIR}:/database kuzudb/api-server:latest
442+
```
443+
444+
The `Kuzu` target spec takes the following fields:
445+
446+
* `connection` (type: [auth reference](../core/flow_def#auth-registry) to `KuzuConnectionSpec`): The connection to the Neo4j database. `KuzuConnectionSpec` has the following fields:
447+
* `api_server_url` (type: `str`): The URL of the Kuzu API server, e.g. `http://localhost:8123`.
448+
* `mapping` (type: `Nodes | Relationships`): The mapping from collected row to nodes or relationships of the graph. For either [nodes to export](#nodes-to-export) or [relationships to export](#relationships-to-export).
449+
450+
Kuzu also provides a declaration spec `KuzuDeclaration`, to configure indexing options for nodes only referenced by relationships. It has the following fields:
451+
452+
* `connection` (type: auth reference to `KuzuConnectionSpec`)
453+
* Fields for [nodes to declare](#declare-extra-node-labels), including
454+
* `nodes_label` (required)
455+
* `primary_key_fields` (required)

0 commit comments

Comments
 (0)