What's a good way to organize/create a dictionary to store terms that are specific to a subject?

I know that there were some questions on this forum regarding adding your own terms to a dictionary or having a dictionary plugin. I’m more concerned about how to best organize my files and links that would make sense in my specific circumstance.

I’m using Obsidian for my class notes, particularly for biology courses. First, I’ll create long ‘class notes’ based on the lecture slides and prof comments. Then, I’ll go through those class notes and refactor different segments into their own notes with the appropriate metadata (ex., having a note that describes a specific membrane protein with YAML frontmatter that says type: membrane protein). This makes sense to me since I can embed those notes into the original ‘class note’, run dataview queries to see general categories of proteins, and connect these notes to various class concepts.

My issue is that there are many key terms that I would like to define and keep that definition on hand for later. Most of these definitions are half a sentence long at most, so I worry about having too many ‘ultra short’ notes in my class folder (storage space and ease of navigation are important for me).

I’m relatively new to Obsidian and PKMs in general. Has anyone found a good strategy that is applicable to class notes? If you believe having a note for each definition is the answer, do you have tips on how I should organize them so that I don’t hate myself later when there’s 100+ definitions files in the folder?

2 Likes

Hi there,
my procedure for dealing for key terms and their definitions is to add them in the body of the same note where the term is mentioned. What I do is something like this:

term:: DNA
definition:: Deoxyribonucleic Acid

this is just one term, but you can add as many as you want in the same note using the term/definition pair convention.

Then, what I do to collect all of the key terms is using a datavaviewjs script to scan all the notes and create a table with the terms and their definitions. Here is the script:

function getLinkToDoc(key) {
	// return the file path of the selected note
	let pagePath = app.plugins.plugins.dataview.api
		.pages(`"/"`)
		.where(p => !p.file.name.includes("Research"))
		.where(p => !p.file.name.includes("dummy"))		
		.where(page => {
			if (page.file.name === key) {
				return page.file.name;
			}
		}).file.path
	return pagePath[0]
}


const flattened = [];

// load the arrays with name of note, terms and definitons
dv.pages('"/"')
	.where(b => b.term)
	//.where(p => !p.file.name.includes("Research"))
	//.where(p => !p.file.name.includes("dummy"))		
	.map(p => {
		// create arrays
		p.term = dv.array(p.term)
		p.definition = dv.array(p.definition)
		
		for (let i = 0; i < p.term.length; i++) {
			// push values to array. p.file.name is the name of the note
			flattened.push(
				{term: p.term[i], 
				 definition: p.definition[i],
				 filename: p.file.name
				 }
			)
		}
		}
	);

let dataArray = [];
let matched = [];

// convert array to a dataview data array
dataArray = dv.array(flattened)
// Group by title and sorted ascending alphabetically
let dataGroups = dataArray
	.groupBy(p => p.filename)
	.sort(p => p.filename, 'asc')

// console.log(dataGroups)

for (let g of dataGroups) {
	// iterate through groups
	// convert note name  from g.key to a file link
	const linkToDoc = dv.fileLink(getLinkToDoc(g.key), false, [g.key])
	dv.header(6, linkToDoc)
	// match the page title in g.key to the page title in the array
	matched = dataArray.where(p => p.filename == g.key)
		dv.table(['Term', 'Definition'], matched
			 .map(a => [a.term, a.definition])
			)
}

The output would look to something like this. I use this script in particular for collecting research papers terms in only one place, like a glossary. I love that I can even use Latex equations there.

I borrowed the idea from this post.

Because this script generates a view I put it together with other similar scripts in notes under the folder “Views”, but you could really put it anywhere in your vault folder structure.

Hope this is what you are looking for.

2 Likes

Hi msfz751, could you provide more details on how to set up provided script into Obsidian, please? I would much appreciate it.

Do note that if/when you define multiple terms in any given note the term and the definition is are not connected. If you have a typo in either field name, you’ll get misaligned terms and definitions.

This is due to all of these belonging to the page scope. A much safer option would be to have these term definitions within a list or task scope.

My preferred variant would be to use tasks since you then can use dataview queries to collate the definitions into lists, which automatically provides a link back to the definition (since tasks do that by default). See this thread for more information on this topic.

So I would use something like:

- [k] (term:: DNA) - (definition:: Deoxyribonucleic Acid)

Which renders as the following when using the dark Minimal theme:
image

And to list all definitions, I’d use a query like:

```dataview
TASK
WHERE status = "k"
```
7 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.