0xPlaygrounds / 0xPlaygrounds/kg-node

feat: Entity Pluralism

Abierto
#22 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
10
Forks
5
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
backend, databases
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.