"key: value" intext database syntax to collect pieces of information that are too small to make a note with YAML for each

Inspired by org-mode properties and columns, I propose an plugin idea of a syntax and query system to make a database out of inline entries.

The syntax may look like this:

:jogging:

  • start:
    ** date: 2022-10-04T0720
    ** place: South Park
  • end:
    ** date: 2022-10-04T0740
    ** place: North Park
  • duration: {dur(start.date, end.date)}
  • distance(km): 4.0

An entry has an ID (jogging) followed by properties structured hierarchically. It might be useful if a simple calculation is available inside an entry (but this is pretty optional).

TABLE from jogging, dur(start.date, end.date) AS TIME, distance(km) AS DISTANCE
WHERE distance(km) => 4

Entries would be collected and shown by dataview-like query. I think this function could be realized in a similar way to obsidian-tasks.

{DATE: 2022-10-04}

:meal:

  • name: udon
  • type: lunch
  • nutrition:
    ** kcal: 500
    ** pfc: (5, 10, 20)
    ** salt: 3
  • price(JPY): 400

Another use case collects basic information of each meal. Elements written in some specific way in the headline would be inherited.

TABLE nutrition.pfc[0] AS PROTEIN, price AS PRICE, nutrition.pfc[0]/price AS CP
WHERE (on OR after  <% start_of_month %>) AND (on OR before <% end_of_month %>)

This query shows the cost-performance (CP) of protein intake in a month with obsidian-templater though I’m not sure who wants to know that.

The intext database could be expanded to a daily timeline, a calculation of calories-in and -out, and a monthly balance sheet.

I’m waiting for your comments or advice.

You could just store your small entries in YAML as a list of objects.

In case anyone else was wondering, here’s how to represent @imanuel’s original frontmatter in @CawlinTeffid’s provided object syntax. I hadn’t used this syntax before, so this was interesting.

---
meal:
  name: udon
  type: lunch
  nutrition:  
    kcal: 500  
    pfc: [5, 10, 20]
    salt: 3
  price(JPY): 400
---

This resolves perfectly into a frontmatter object:

```dataviewjs
console.log(dv.current().meal)
```

image

You can also write it as a normal JSON object - meal: {type: "lunch"} etc, but I laid it out like the original request.

1 Like