Skip to content

Commit c06087b

Browse files
committed
docs(kg): update to make it simpler
1 parent 6fb7e70 commit c06087b

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

docs/docs/ops/storages.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,32 @@ You can find an end-to-end example [here](https://github.com/cocoindex-io/cocoin
8787

8888
## Property Graph Targets
8989

90-
Property graph is a graph data model where both nodes and relationships can have properties.
90+
Property graph is a widely-adopted model for knowledge graphs, where both nodes and relationships can have properties.
91+
[Graph database concepts](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/) has a good introduction to basic concepts of property graphs.
92+
93+
The following concepts will be used in the following sections:
94+
* [Node](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/#graphdb-node)
95+
* [Node label](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/#graphdb-labels), which represents a type of nodes.
96+
* [Relationship](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/#graphdb-relationship), which describes a connection between two nodes.
97+
* [Relationship type](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/#graphdb-relationship-type)
98+
* [Properties](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/#graphdb-properties), which are key-value pairs associated with nodes and relationships.
9199

92100
### Data Mapping
93101

94-
In CocoIndex, you can export data to property graph databases.
95-
This usually involves more than one collectors, and you export them to different types of graph elements (nodes and relationships).
96-
In particular,
102+
Data from collectors are mapped to graph elements in various types:
97103

98-
1. You can export rows from some collectors to nodes in the graph. Each row is mapped to a node.
99-
2. You can export rows from some other collectors to relationships in the graph. Each row is mapped to a relationship, together with the source and target nodes of the relationship.
100-
3. Since relationships exported in 2 may share the same nodes (with nodes exported in 1, and other relationships exported in 2),
101-
there will match and deduplicate nodes, using their primary key as each node's identifier.
104+
1. Rows from collectors → Nodes in the graph
105+
2. Rows from collectors → Relationships in the graph (including source and target nodes of the relationship)
102106

103-
This is what you need to provide to export data to a property graph database:
107+
This is what you need to provide to define these mappings:
104108

105-
* Provide `Nodes` to export nodes with each label (part 1).
106-
* For labels that will appear as source/target nodes of relationships (part 2) without being exported as nodes (part 1), you need to declare these labels to provide label-level configuration like primary keys.
107-
* Provide `Relationships` to export relationships with each type (part 2).
109+
* Specify [nodes to export](#nodes-to-export).
110+
* [Declare extra node labels](#declare-extra-node-labels), for labels to appear as source/target nodes of relationships but not exported as nodes.
111+
* Specify [relationships to export](#relationships-to-export).
108112

109-
Nodes' matching and deduplicating are taken care of by CocoIndex, without additional configuration.
113+
In addition, the same node may appear multiple times, from exported nodes and various relationships.
114+
They should appear as the same node in the target graph database.
115+
CocoIndex automatically [matches and deduplicates nodes](#nodes-matching-and-deduplicating) based on their primary key values.
110116

111117
#### Nodes to Export
112118

@@ -171,7 +177,7 @@ graph TD
171177
classDef node font-size:8pt,text-align:left,stroke-width:2;
172178
```
173179

174-
#### Nodes to Declare
180+
#### Declare Extra Node Labels
175181

176182
If a node label needs to appear as source or target of a relationship, but not exported as a node, you need to [declare](../core/flow_def#target-declarations) the label with necessary configuration.
177183

@@ -318,9 +324,9 @@ graph TD
318324
}
319325
320326
321-
Doc_Chapter1:::nodeRef -- **[MENTION]**{location:12} --> Place_CrystalPalace_a:::node
322-
Doc_Chapter2_a:::nodeRef -- **[MENTION]**{location:23} --> Place_MagicForest:::node
323-
Doc_Chapter2_b:::nodeRef -- **[MENTION]**{location:56} --> Place_CrystalPalace_b:::node
327+
Doc_Chapter1:::nodeRef -- **:MENTION** (location:12) --> Place_CrystalPalace_a:::node
328+
Doc_Chapter2_a:::nodeRef -- **:MENTION** (location:23) --> Place_MagicForest:::node
329+
Doc_Chapter2_b:::nodeRef -- **:MENTION** (location:56) --> Place_CrystalPalace_b:::node
324330
325331
classDef nodeRef font-size:8pt,text-align:left,fill:transparent,stroke-width:1,stroke-dasharray:5 5;
326332
classDef node font-size:8pt,text-align:left,stroke-width:2;
@@ -330,7 +336,7 @@ graph TD
330336
#### Nodes Matching and Deduplicating
331337

332338
The nodes and relationships we got above are discrete elements.
333-
To fit them into a connected property graph, CocoIndex will match and deduplicate nodes:
339+
To fit them into a connected property graph, CocoIndex will match and deduplicate nodes automatically:
334340

335341
* Match nodes based on their primary key values. Nodes with the same primary key values are considered as the same node.
336342
* For non-primary key fields (a.k.a. value fields), CocoIndex will pick the values from an arbitrary one.
@@ -378,9 +384,9 @@ graph TD
378384
classDef: node
379385
}
380386
381-
Doc_Chapter1:::node -- **[MENTION]**{location:12} --> Place_CrystalPalace:::node
382-
Doc_Chapter2:::node -- **[MENTION]**{location:23} --> Place_MagicForest:::node
383-
Doc_Chapter2:::node -- **[MENTION]**{location:56} --> Place_CrystalPalace:::node
387+
Doc_Chapter1:::node -- **:MENTION** (location:12) --> Place_CrystalPalace:::node
388+
Doc_Chapter2:::node -- **:MENTION** (location:23) --> Place_MagicForest:::node
389+
Doc_Chapter2:::node -- **:MENTION** (location:56) --> Place_CrystalPalace:::node
384390
385391
classDef node font-size:8pt,text-align:left,stroke-width:2;
386392
```

0 commit comments

Comments
 (0)