Update qdrant_points.py, graph_utils.py, graph_derive_edges.py, and ingestion_processor.py to version 4.0.0: Implement GOLD-STANDARD identity with strict 4-parameter ID generation, eliminating rule_id and variant from ID calculations. Enhance documentation for clarity and consistency across modules, addressing ID drift and ensuring compatibility in the ingestion workflow.
This commit is contained in:
1 parent
8fd7ef804d
commit
a852975811
4 files changed
+58
-43
No files matched your search
@@ -1,11 +1,12 @@
|
||||
"""
|
||||
FILE: app/core/graph/graph_utils.py
|
||||
DESCRIPTION: Basale Werkzeuge, ID-Generierung und Provenance-Konfiguration für den Graphen.
|
||||
AUDIT v1.6.2:
|
||||
- Festlegung des globalen Standards für Kanten-IDs (WP-24c).
|
||||
- Fix für ImportError (_edge Funktion wiederhergestellt).
|
||||
- Integration der .env Pfad-Auflösung für Schema und Vokabular.
|
||||
VERSION: 1.6.2 (WP-24c: Global Identity Standard)
|
||||
AUDIT v4.0.0:
|
||||
- GOLD-STANDARD v4.0.0: Strikte 4-Parameter-ID für Kanten (kind, source, target, scope).
|
||||
- Eliminiert ID-Inkonsistenz zwischen Phase 1 (Autorität) und Phase 2 (Symmetrie).
|
||||
- rule_id und variant werden ignoriert in der ID-Generierung (nur im Payload gespeichert).
|
||||
- Fix für das "Steinzeitaxt"-Problem durch konsistente ID-Generierung.
|
||||
VERSION: 4.0.0 (WP-24c: Gold-Standard Identity)
|
||||
STATUS: Active
|
||||
"""
|
||||
import os
|
||||
@@ -87,29 +88,31 @@ def parse_link_target(raw: str, current_note_id: Optional[str] = None) -> Tuple[
|
||||
|
||||
def _mk_edge_id(kind: str, s: str, t: str, scope: str, rule_id: Optional[str] = None, variant: Optional[str] = None) -> str:
|
||||
"""
|
||||
WP-24c: DER GLOBALE STANDARD für Kanten-IDs.
|
||||
WP-24c v4.0.0: DER GLOBALE STANDARD für Kanten-IDs.
|
||||
Erzeugt eine deterministische UUIDv5. Dies stellt sicher, dass manuelle Links
|
||||
und systemgenerierte Symmetrien dieselbe Point-ID in Qdrant erhalten.
|
||||
|
||||
GOLD-STANDARD v4.0.0: Die ID basiert STRICT auf vier Parametern:
|
||||
f"edge:{kind}:{source}:{target}:{scope}"
|
||||
|
||||
Die Parameter rule_id und variant werden IGNORIERT und fließen NICHT in die ID ein.
|
||||
Sie können weiterhin im Payload gespeichert werden, haben aber keinen Einfluss auf die Identität.
|
||||
|
||||
Args:
|
||||
kind: Typ der Relation (z.B. 'mastered_by')
|
||||
s: Kanonische ID der Quell-Note
|
||||
t: Kanonische ID der Ziel-Note
|
||||
scope: Granularität (Standard: 'note')
|
||||
rule_id: Optionale ID der Regel (aus graph_derive_edges)
|
||||
variant: Optionale Variante für multiple Links zum selben Ziel
|
||||
rule_id: Optionale ID der Regel (aus graph_derive_edges) - IGNORIERT in ID-Generierung
|
||||
variant: Optionale Variante für multiple Links zum selben Ziel - IGNORIERT in ID-Generierung
|
||||
"""
|
||||
if not all([kind, s, t]):
|
||||
raise ValueError(f"Incomplete data for edge ID: kind={kind}, src={s}, tgt={t}")
|
||||
|
||||
# STRENGER STANDARD: Nutzt Doppelpunkte als Trenner.
|
||||
# GOLD-STANDARD v4.0.0: STRICT 4-Parameter-ID
|
||||
# Keine Suffixe für rule_id oder variant im Hash-String!
|
||||
# Jede manuelle Änderung an diesem String-Format führt zu doppelten Kanten in der DB!
|
||||
base = f"edge:{kind}:{s}:{t}:{scope}"
|
||||
|
||||
if rule_id:
|
||||
base += f":{rule_id}"
|
||||
if variant:
|
||||
base += f":{variant}"
|
||||
|
||||
# Nutzt den URL-Namespace für deterministische Reproduzierbarkeit
|
||||
return str(uuid.uuid5(uuid.NAMESPACE_URL, base))
|
||||
|
||||
Reference in new issue
Block a user