Obsidian Ontology Manager is a Python automation tool for any who maintain strict, axiomatic knowledge bases.
It treats Markdown notes as objects in a compiled graph. Instead of manually naming files, this script generates filenames based on their metadata and relationship to other nodes (Owners, Superclasses, Parts). When a file's "Recursive Title" changes, the script renames the file and automatically refactors every Wikilink in the vault to maintain integrity.
- Logic-Based Naming: Filenames are not static; they are compiled from
NamingTagsthat traverse the relationship graph. - Recursive Pathing: A file can name itself by fetching data from its Owner, its Owner's Super, or any arbitrary depth in the graph (e.g.,
OS1N). - Referential Integrity: Renames are propagated globally. If
Note Ais renamed toNote B, all instances of[[Note A]]in your vault are updated to[[Note B]]. - Inheritance: Nodes without explicit Owners can inherit ownership from their
SupersorPartOfparents. - Orphan Detection: Generates a dashboard (
Owner.md) listing nodes disconnected from the graph.
The script relies on YAML frontmatter. If no NamingTags are present, the file simply uses its Title attribute (Default Behavior).
---
attributes:
Title: "Absciss"
Owner: "[[Ordered Pair(Set)]]"
Supers:
- "[[Relation (Set)]]"
NamingTags: # Logic to construct the full filename
- "-1ON"
---This is how i like to distinguish them
- Title: what ever word you want to be as the ground or base for the note final title
- Owner: a link to another note O, Hypothetcly if the current note would dissappear from existence Note O would not get effected. Ex: (Owner - Owned) (Human - Human Body) (Ordered Pair - Absciss) (Light - Ligth Reflection Phenomenon)
- PartOf: a link to another note P, Hypothetcly if the current note would dissappear from existence Note P would have no meaning. Ex: (Emerging - Part) (Human Body - Hand) (Proper Class - Set) (Atom - Electron)
- Supers: a list of links, that the current note is inhiriting. (Child - Parent) (Flat Bone - Rib) (Relation - Set) (Elementry Boson - Photon)
The core engine of this script is the NamingTags parser. It constructs a title by placing segments before (-) or after (+) the file's intrinsic Title.
[Sign][Position][Path...][Terminator]
- Sign: *
-: Prefix (placed before the Title).+: Suffix (placed after the Title).
- Position: An integer (
1,2,3...) determining distance from the center.- Note: Position
0is reserved for the file's ownTitle. -1is immediately before the title;-2is before-1.
- Note: Position
- Path (Recursive): A chain of steps to find the target node.
O: Go to Owner.S+Index: Go to Superclass at specific index (e.g.,S0is first super,S1is second).P+Index: Go to PartOf at specific index.- Chaining: You can chain these.
OS1means "Go to my Owner, then go to their 2nd Super."
- Terminator: What data to extract from the target node.
N: Name (The target's rawTitleattribute).T: RTitle (The target's fully compiled Recursive Title).
If the File Title is [TITLE], the positions fill as follows:
... [-2] [-1] [TITLE] [+1] [+2] ...
- Title:
Tissue - Owner:
[[Pathophysiology. Body]](Title: "Body") - NamingTag:
-1ON:-1: Prefix, immediate left,O: Go to Owner (Pathophysiology. Body),N: Get Name ("Body").
- Result:
Body Tissue.md
- Title:
Carpal - PartOf:
[[Human Wrist(Joint)]](RTitle: "Human Wrist") - Supers:
[[Body. Tunnel]](RTitle: "Body") - NamingTags:
-1OT: Prefix (-1), Owner (O), Recursive Title (T) -> "Human"+1S0T: Suffix (+1), First Super (S0), Recursive Title (T) -> "Body"
- Result:
Human Carpal Tunnel.mdNote: Since their is no owner the owner is taken from the first PartOf
- Owner:
[[Taxonomy. Human]](RTitle: "Human") - Supers:
[[Pathophysiology. Body]](RTitle: "Body") - NamingTags:
-1OT: Prefix (-1), Owner (O), Recursive Title (T) -> "Human"+1S0T: Suffix (+1), First Super (S0), Recursive Title (T) -> "Body"
- Result:
Human Body.md
- Dependencies:
pip install python-frontmatter
- Setup: Place
.pyin the root of your Obsidian vault. - Run:
python .py