Update graph_derive_edges.py and graph_utils.py to version 4.1.0: Enhance edge ID generation by incorporating target_section into the ID calculation, allowing for distinct edges across different sections. Update documentation to reflect changes in ID structure and improve clarity on edge handling during de-duplication.
This commit is contained in:
1 parent
a852975811
commit
2da98e8e37
2 files changed
+20
-20
No files matched your search
@@ -86,7 +86,7 @@ def parse_link_target(raw: str, current_note_id: Optional[str] = None) -> Tuple[
|
||||
|
||||
return target, section
|
||||
|
||||
def _mk_edge_id(kind: str, s: str, t: str, scope: str, rule_id: Optional[str] = None, variant: Optional[str] = None) -> str:
|
||||
def _mk_edge_id(kind: str, s: str, t: str, scope: str, target_section: Optional[str] = None) -> str:
|
||||
"""
|
||||
WP-24c v4.0.0: DER GLOBALE STANDARD für Kanten-IDs.
|
||||
Erzeugt eine deterministische UUIDv5. Dies stellt sicher, dass manuelle Links
|
||||
@@ -109,12 +109,13 @@ def _mk_edge_id(kind: str, s: str, t: str, scope: str, rule_id: Optional[str] =
|
||||
if not all([kind, s, t]):
|
||||
raise ValueError(f"Incomplete data for edge ID: kind={kind}, src={s}, tgt={t}")
|
||||
|
||||
# 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!
|
||||
# Der String enthält nun alle distinkten semantischen Merkmale
|
||||
base = f"edge:{kind}:{s}:{t}:{scope}"
|
||||
|
||||
# Wenn ein Link auf eine spezifische Sektion zeigt, ist es eine andere Relation
|
||||
if target_section:
|
||||
base += f":{target_section}"
|
||||
|
||||
# Nutzt den URL-Namespace für deterministische Reproduzierbarkeit
|
||||
return str(uuid.uuid5(uuid.NAMESPACE_URL, base))
|
||||
|
||||
def _edge(kind: str, scope: str, source_id: str, target_id: str, note_id: str, extra: Optional[dict] = None) -> dict:
|
||||
|
||||
Reference in new issue
Block a user