Ontology Source References

This document records the shared helpers for parsing and creating ontology source references in Python and C#.

Canonical Formats

Document source references use the following forms:

doc://<document_id>
doc://<document_id>?p=<element_id>

Knowledge-graph source references use the following forms:

kg://<entity_id>
kg://<entity_id>/<source_label>.<source_attribute>

The optional KG qualifier identifies the source label and attribute that produced the reference. Consumers that only need to load the Neo4j entity must use the base <entity_id> and ignore the qualifier.

Python Helper

Location: PythonServer/src/services/ontology_source_helper.py

Key functions:

Python callers should use these helpers instead of manually splitting kg:// references.

C# Helper

Location: ThalabusWeb/Utilities/KnowledgeGraphSourceHelper.cs

KnowledgeGraphSourceHelper.Parse() accepts a KG source reference and returns (EntityId, AttributeName):

The Knowledge Graph source-details handler uses this helper to resolve a qualified source link to the entity side panel and focus the referenced attribute.