Skip to content

Commit 60f9558

Browse files
authored
Neo4j destination connector: show related query examples (#438)
1 parent c169cb9 commit 60f9558

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

snippets/general-shared-text/neo4j-graph.mdx

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,64 @@ In the preceding diagram:
6161
- Each `UnstructuredElement` node has a `PART_OF_CHUNK` relationship with a `Chunk` element.
6262
- Each `Chunk` node, except for the "last" `Chunk` node, has a `NEXT_CHUNK` relationship with its "next" `Chunk` node.
6363

64-
Learn more about [document elements](/platform/document-elements) and [chunking](/platform/chunking).
64+
Learn more about [document elements](/platform/document-elements) and [chunking](/platform/chunking).
65+
66+
Some related example Neo4j graph queries include the following.
67+
68+
Query for all nodes:
69+
70+
```text
71+
MATCH (n)
72+
RETURN n
73+
```
74+
75+
Query for `Chunk` to `Document` relationships:
76+
77+
```text
78+
MATCH (chunk:Chunk)-[:PART_OF_DOCUMENT]->(doc:Document)
79+
RETURN chunk, doc
80+
```
81+
82+
Query for `UnstructuredElement` to `Document` relationships:
83+
84+
```text
85+
MATCH (element:UnstructuredElement)-[:PART_OF_DOCUMENT]->(doc:Document)
86+
RETURN element, doc
87+
```
88+
89+
Query for `UnstructuredElement` to `Chunk` relationships:
90+
91+
```text
92+
MATCH (element:UnstructuredElement)-[:PART_OF_CHUNK]->(chunk:Chunk)
93+
RETURN element, chunk
94+
```
95+
96+
Query for `Chunk` to `Chunk` relationships:
97+
98+
```text
99+
MATCH (this:Chunk)-[:NEXT_CHUNK]->(previous:Chunk)
100+
RETURN this, previous
101+
```
102+
103+
Query for `UnstructuredElement` to `Chunk` to `Document` relationships:
104+
105+
```text
106+
MATCH (element:UnstructuredElement)-[:PART_OF_CHUNK]-(chunk:Chunk)-[:PART_OF_DOCUMENT]->(doc:Document)
107+
RETURN element, chunk, doc
108+
```
109+
110+
Query for `UnstructuredElements` containing the text `jury`, and show their `Chunk` relationships:
111+
112+
```text
113+
MATCH (element:UnstructuredElement)-[:PART_OF_CHUNK]->(chunk:Chunk)
114+
WHERE element.text =~ '(?i).*jury.*'
115+
RETURN element, chunk
116+
```
117+
118+
Query for the `Chunk` with the specified `id`, and show its `UnstructuredElement` relationships:
119+
120+
```text
121+
MATCH (element:UnstructuredElement)-[:PART_OF_CHUNK]->(chunk:Chunk)
122+
WHERE chunk.id = '731508bf53637ce4431fe93f6028ebdf'
123+
RETURN element, chunk
124+
```

0 commit comments

Comments
 (0)