0xPlaygrounds / 0xPlaygrounds/kg-node

feat: Entity Pluralism

Đang mở
#22 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
10
Fork
5
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Motivation
One of the main goals of the knowledge graph is to allow for natural composability. This is mostly done through the use of global IDs for entities. This is especially important when a triple is created in a space which refers to some entity that exists in another space. When that happens, we want the "view" of the entity in that first space to sometimes include triples of other spaces. This is called pluralism.

## Design
#### Definitions
- We say that some space `S` **touches** an entity `E` if it either: 1) defines a relation pointing to or from that entity `E`; or 2) defines a triple for that entity `E`.
- A **source space** `S'` can be defined for any entity `E` in some space `S`.
- A space `S` can have a **parent space** as well as **subspaces** (spaces for which it is the parent space). A set of spaces related through subspaces relationships are called a **space hierarchy**. The space hierarchy can have one or more **roots** (spaces in the hierarchy with no parent space) and **leaves** (spaces in the hierarchy with no subspaces).
- The **global graph** is one such space hierarchy, specifically the one where the **Root space** (id `25omwWh6HYgeRQKCaSpVpa`) is the root of the hierarchy.
- A space `S` can have **verified spaces** (or trusted spaces) which are spaces outside of its hierarchy but that are nonetheless closely related to it and more importantly, spaces that have been vetted.
- A **space ranking** is a ranking of all spaces that are part of the global graph. Many such ranking can exist (e.g.: proximity to the Root space, relevance, number of entities, etc.) and those can be used to determine the most likely target space for an entity reference in cases where it is not defined.

#### Entity Triples
If the entity `E` is only ever touched by space `S`, then the triples returned for entity `E` in space `S` are the triples defined in that space.

If the entity `E` was touched by spaces other than space `S`, then the triples returned for entity `E` in space `S` are the triples defined in that space **in addition** to other triples according to the following rules, in order of priority:
1. If a **source space** `S'` is defined for entity `E` in space `S` and `S'` is part of a **space hierarchy** (i.e.: it has a parent space), then the triples returned for entity `E` in space `S` are all triples defined in all spaces of the space hierarchy between the **root of the space hierarchy** (not necessarily the root space) and space `S'`, in addition to the triples defined in space `S`. In the case where multiple spaces set a value for the same attribute, priority is given to the one set in the space lowest in the hierarchy (i.e.: the more "specific" spaces).
2. If no source space is defined for entity `E` in space `S` and `S` is part of a space hierarchy (i.e.: it has a parent space) then the triples returned for entity `E` in space `S` are aggregated according to the algorithm above with the parent of `S` as the source space.
4. If no source space is defined for entity `E` in space `S` and `S` is not part of a hierarchy, then the triples returned for entity `E` in space `S` will include those defined in space `S` as well as the triples defined in the **top ranked space** that touches this entity, with precedence given to the triples defined in `S`.

## Implementation
The plan is to start implementing this feature gradually. Here are some rough steps/milestones:
- [ ] Implement a simple "placeholder" space ranking (e.g.: oldest first)
- [ ] Implement rule 4. with the placeholder ranking
- [ ] Handle entity source space definition (currently not handled/modelled)
- [ ] Implement rule 1.
- [ ] Implement rule 2.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

This is a major design and implementation task for a knowledge graph system. The issue outlines complex rules for entity pluralism across spaces. A newcomer would need to understand the existing space and entity modeling in the codebase, likely starting with data structures in src/. The first milestone suggests implementing a placeholder space ranking, which would be the initial research point. 'Done' means all rules are implemented and tested.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
backend, databases
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.