Skip to content

Commit 46e9b2e

Browse files
committed
Small renaming
1 parent 4c4994b commit 46e9b2e

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

docs/ADRs/RAG-Integration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ Implementing a RAG system with a graph database addresses these limitations by p
4040
The implementation uses these core node types:
4141

4242
```
43-
(:Source {id, name, type, base_uri}) # Origin of documents
43+
(:Source {id, name, type, uri}) # Origin of documents
4444
(:Document {id, path, content, title, source_id}) # Full documents
45-
(:DocumentChunk {id, path, content, parent_document_id, chunk_index}) # Document portions
45+
(:DocumentChunk {id, path, content, parent_id, chunk_index}) # Document portions
4646
(:VectorStore {id, model, status}) # Vector embedding configuration
4747
(:Vector {id, chunk_id, vector_store_id, embedding}) # Actual embeddings
4848
(:Interaction {id, session_id, content, role}) # Chat messages
@@ -368,7 +368,7 @@ class TextSplitter:
368368
class ChunkMetadata(DocumentMetadata):
369369
chunk_index: int
370370
chunk_count: int
371-
parent_document_id: str
371+
parent_id: str
372372
parent_document_path: str
373373
is_chunk: bool
374374

docs/rag_architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ graph TD
7474
The RAG system uses the following node types:
7575

7676
1. **Source**: Represents the origin of documents
77-
- Properties: name, type, base_uri
77+
- Properties: name, type, uri
7878
- Types: "file", "website", etc.
7979

8080
2. **Document**: Represents a full document with content and metadata
8181
- Properties: path, content, title, source_id, reference_ids
8282
- Linked to Source with SOURCED_FROM relationship
8383

8484
3. **DocumentChunk**: Represents a portion of a document for embedding
85-
- Properties: path, content, content_hash, parent_document_id, chunk_index
85+
- Properties: path, content, content_hash, parent_id, chunk_index
8686
- Linked to Document with CHUNK_OF relationship
8787

8888
4. **VectorStore**: Represents embedding storage configuration

docs/rag_edge_relationships.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ When documents are processed through the RAG system:
4848
1. **Source Creation**: Register content origin
4949
```python
5050
# Create source node based on content type
51-
source = Source(name=domain, type="website", base_uri=url)
51+
source = Source(name=domain, type="website", uri=url)
5252
db.create_source(source)
5353
```
5454

@@ -67,7 +67,7 @@ When documents are processed through the RAG system:
6767
chunk = DocumentChunk(
6868
path=path,
6969
content=node.text,
70-
parent_document_id=document.id,
70+
parent_id=document.id,
7171
chunk_index=idx
7272
)
7373
db.create_chunk(chunk)
@@ -91,14 +91,14 @@ Relationships are established during entity creation:
9191
def create_chunk(self, chunk: DocumentChunk) -> str:
9292
self._execute(*chunk.create())
9393

94-
if not chunk.parent_document_id:
95-
raise ValueError("DocumentChunk must have a parent_document_id")
94+
if not chunk.parent_id:
95+
raise ValueError("DocumentChunk must have a parent_id")
9696

9797
# Create CHUNK_OF relationship from chunk to document
9898
self._execute(*chunk.link(
9999
EdgeType.CHUNK_OF,
100100
Document.label(),
101-
chunk.parent_document_id,
101+
chunk.parent_id,
102102
))
103103
```
104104

examples/9-test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async def test_vector_search(query_text: str):
8888
doc_ids = set()
8989
for result in search_results:
9090
chunk = result["chunk"]
91-
doc_id = chunk["parent_document_id"]
91+
doc_id = chunk["parent_id"]
9292
if not doc_id in doc_ids:
9393
doc_ids.add(doc_id)
9494

@@ -101,13 +101,13 @@ async def test_vector_search(query_text: str):
101101
print(f"Document ID: {doc_id}")
102102
refs = db.get_references(doc_id)
103103
for ref in refs:
104-
ref_uri = ref["base_uri"]
104+
ref_uri = ref["uri"]
105105
if not ref_uri in references:
106106
references.add(ref_uri)
107107

108108
sources = db.get_sources(doc_id)
109109
print(f"Sources: {sources}")
110-
source_uris = [source["base_uri"] for source in sources]
110+
source_uris = [source["uri"] for source in sources]
111111
data.append({
112112
"sources": source_uris,
113113
"content": document["content"],

src/core/rag/dbhandler/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ def create_document(self, doc: Document) -> str:
100100
def create_chunk(self, chunk: DocumentChunk) -> str:
101101
self._execute(*chunk.create())
102102

103-
if not chunk.parent_document_id:
104-
raise ValueError("DocumentChunk must have a parent_document_id")
103+
if not chunk.parent_id:
104+
raise ValueError("DocumentChunk must have a parent_id")
105105

106106
self._execute(*chunk.link(
107107
EdgeType.CHUNK_OF,
108108
Document.label(),
109-
chunk.parent_document_id,
109+
chunk.parent_id,
110110
))
111111

112112
def create_source(self, source: Source) -> str:

src/core/rag/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ def __init__(
145145
self,
146146
path: str,
147147
content: str, # Keep content in the graph for direct access
148-
parent_document_id: str,
148+
parent_id: str,
149149
chunk_index: int = 0,
150150
token_count: int = 0,
151151
):
152152
super().__init__()
153153
self.path = path
154154
self.content = content
155155
self.content_hash = hashlib.sha256(content.encode()).hexdigest()
156-
self.parent_id = parent_document_id
156+
self.parent_id = parent_id
157157
self.chunk_index = chunk_index
158158
self.token_count = token_count
159159

src/libs/dataloader/document.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def create_source(self, source_path) -> Document:
1717
source = Source(
1818
name=source_path.split("/")[-1],
1919
type="file",
20-
base_uri=source_path
20+
uri=source_path
2121
)
2222

2323
source.id = hashlib.sha256(self.path.encode()).hexdigest()[:16]
@@ -66,7 +66,7 @@ def load_data(self) -> Generator[Tuple[Document, List[DocumentChunk]], Source]:
6666
doc_chunk = DocumentChunk(
6767
path=path,
6868
content=chunk_content,
69-
parent_document_id=document.id,
69+
parent_id=document.id,
7070
chunk_index=idx,
7171
token_count=len(chunk_content.split())
7272
)

src/libs/dataloader/web.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def create_source(self, source_url) -> Source:
4444
source = Source(
4545
name=domain,
4646
type="website",
47-
base_uri=source_url
47+
uri=source_url
4848
)
4949

5050
source.id = hashlib.sha256(source_url.encode()).hexdigest()[:16]
@@ -168,7 +168,7 @@ def load_data(self) -> Generator[Tuple[Source, Document, List[DocumentChunk]], N
168168
doc_chunk = DocumentChunk(
169169
path=display_url,
170170
content=chunk_content,
171-
parent_document_id=document.id,
171+
parent_id=document.id,
172172
chunk_index=idx,
173173
token_count=len(chunk_content.split())
174174
)

0 commit comments

Comments
 (0)