johanwk / elot

Emacs Literate Ontology Tool
GNU General Public License v3.0
7 stars 3 forks source link

Elisp to identify ontology context at point #37

Closed johanwk closed 5 months ago

johanwk commented 5 months ago

Provide a way to identify basic properties of the ontology governing a point in a document.

Probably this can be kept in a :properties: drawer.

This can be used, e.g., in tempo templates that introduce (org sections that define) new resources. The default prefix will be provided automatically.

Here's one possible way. In the top-level heading, containing subtrees that define an ontology, add the following to the property drawer. By coincidence, the Pizza ontology has pizza both as ontology localname and as prefix.

:ID: pizza
:ELOT-context-type: ontology
:ELOT-context-localname: pizza
:ELOT-default-prefix: pizza

To retrieve these is simple.

(org-entry-get-with-inheritance "ELOT-default-prefix")
"pizza"

Using the ID property to identify much about the ELOT context would be pointless, since ID is commonly used. However, ELOT-context-NN is certainly going to be unique. In a future extension, ELOT-context-type might be reused, e.g., with ottr-library or other kinds of content with some supporting functions.

johanwk commented 5 months ago

Added functions elot-context-type, elot-context-localname, elot-default-prefix