Since this Topic is reawakened
I was looking into this in the past, and some aspects recently, I have used various filters to identify a table and its rows as any filter including the case with a given tag, then finding what non-system fields are in use on all tiddlers (rows) in that table, thus we have a table.
The idea is to make sure one can handle missing fields, just assume they are there with missing values.
If implemented appropriately a whole range of tables can be defined from a single filter and finding the columns therein OR from a predefined list.
- Of course we could also create a tiddler called a table
tiddler-type=tablethat has a field containing a filter for the rows and a list of required fields/columns useful when creating a new record/tiddler - In fact the same record/tiddler can appear in multiple tables via this approach so
I would thus hope that an SQL Like query can be executed against any or all tiddlers without any special structures, starting with a flat table.
The next step is then to allow fields/columns to contain one or more values which are themselves titles to other rows/tiddlers ie a foreign key. That is a subset of fieldnames (within a table or multiple tiddlers) will contain links to other rows/tiddlers. We then need our filters or SQL Queries to know how to Join such tables together.
- Relink helps us maintain referential integrity if a key is renamed
- We can assume the result of such queries will generate multi-value rows/lists that may have/need more information than we want to see, a “working table”.
- So then we need a report layer that nominates what to display from the above “working table”.
Ideally I see the idea of fields that contain key(s) becoming part of field-handling not an SQL or table tool because they are useful in general.
- This work is what I call “relationship handling”
The key area I am currently exploring is creating index tables (in a tiddler) that can contain two titles/keys to relate two tiddlers to each other and also hold a small amount of information about that relationship such as created or relationship start/end time stamps. Of course this can be moved into a tiddler for each relationship, but there are many cases where this will be unnecessary.