fields inheritance

266 views
Skip to first unread message

damscal

unread,
May 12, 2021, 12:42:35 PM5/12/21
to TiddlyWiki
Trilium provides quite intuitive built-in ways to have Notes (the analogues to Tiddlywiki's tiddlers) dynamically and selectively inherit their Attributes from other Notes, as described here and here. In Trilium, Attributes are similar to Tiddlywiki's fields with extra built-in features.
Inheritance is convenient as it saves a lot of time when creating and organizing notes, plus it makes maintenance very straightforward.

Can/could Tiddlywiki achieve something similar?

PMario

unread,
May 12, 2021, 2:12:03 PM5/12/21
to TiddlyWiki
Sure, if someone would program it. ... BUT there is absolutely no support in the core atm. So nothing will work. Especially filtering would have a big problem.

TLDR;
IMO you should probably tell us, what exactly you want to inherit, so we can tell you how to implement it in "the TW way", which will be more efficient in the long run.

------------------------

From your links, it seems some "attributes" are "indirectly" inherited. eg:

parent has (key-a: value-a)
   |
   +-- child 1 .. will inherit (key-a: value-a) from parent
   +-- child 2 .. will inherit (key-a: value-a) from parent

If child 2 is moved to
test has (key-b: value-b)
   |
   +-- child 2 .. will inherit (key-b: value-b) from test

This behaviour can have some "nice" effects, if you know, that they exist. ... BUT it also "connects" 2 elements in a way, that they only can exist together without loosing information. ... That's not how TW is designed.

In TiddlyWiki, "a tiddler is a tiddler is a tiddler". ... So they should be usable, even if used or moved as a single unit.

We do have other mechanisms, that let us "connect" 2 tiddlers. .. Tags, New Here, New Journal here, links and transclusions ...

Tags are like "groups"

New xxx ... Some fields from a "template" tiddler are copied over to the new tiddler. ... This can be changed, if you create your own buttons.

[[links]] ... Are handled by the core in a special way, so showing "backlinks" can be fast.

{{transclusions}} ... connect 2 tiddlers in an "indirect" way. ... So they can live alone, but they are not "complete" if they are alone.

-mario

damscal

unread,
May 12, 2021, 3:59:45 PM5/12/21
to TiddlyWiki
Hi Mario, thank you for your reply-
I haven't thoroughly thought about the possible implementations in TW, but I've found Trilium's approach very intuitive and efficient to work with. I guess a similar approach, being able to dynamically inherit tags and other fields using template tiddlers, would make TW quicker and easier to manage, esp if the user hasn't a well defined mindset yet and need to change things all the time. Arguably I would guess it could actually be coherent to the philosophy of tiddlers ( https://tiddlywiki.com/#Philosophy%20of%20Tiddlers ), and perhaps a new exporting option could be added that would let the user choose whether to export tiddlers as they are, or to copy the inherited referenced information into the tiddlers that are being exported in order to make them self-consistent (kind of the analogue of copying symlinks targets or the symlink themselves when working with filesystems)

it could be off-topic, but incidentally I also found Trilium's attributes extra functionalities very useful, esp the ability to use them to define custom relations between different Notes, which is similar to what tiddlymap does but has several advantages, e.g. to query Notes based on their relations.

Soren Bjornstad

unread,
May 12, 2021, 7:25:39 PM5/12/21
to TiddlyWiki
I'm with PMario – I'm just not sure that this makes much sense in the TiddlyWiki idiom. It's like you're used to driving a car, and TiddlyWiki is a train, and looking at the train, you go, “But where are the rubber tires?” It just doesn't have rubber tires...but it still rolls just as well, it just works a different way. TiddlyWiki is almost completely non-hierarchical, so inheritance seems like a particularly bad fit.

> I also found Trilium's attributes extra functionalities very useful, esp the ability to use them to define custom relations between different Notes, which is similar to what tiddlymap does but has several advantages, e.g. to query Notes based on their relations.

If I'm understanding the ability to "query Notes based on their relations" correctly, this works exactly the same way in TW...just put the name of another tiddler or tiddlers in a field, and then use a filter. E.g., for a parent/child relationship where the child stores its parent in a 'parent' field:

[parent[MyTiddler]] – finds all children of MyTiddler
[parent[MyTiddler]related[MyOtherTiddler]tag[Source]] – finds all sources that are children of MyTiddler and related to MyOtherTiddler
[tag[Source]parent[MyTiddler]links[]] – finds all notes linked to by sources that are children of MyTiddler

(If you want to allow more than one tiddler to be in the field for relations, you would make the field contain a title list and use 'contains:parent` instead of just 'parent'.)

For standard inheritance, in TW you would normally just compose your filter to look for the parent tiddlers when determining what value a field has. I would probably need an example of how you use this to avoid giving you something really convoluted, so I'll pass on trying to provide one up front, but if there's something you're looking for let me know.

For copy inheritance, as PMario mentioned, you would create a custom button on the parent tiddler (or anywhere else you like) that prepopulates the fields. In fact this is more flexible because you can set the fields to whatever you like. For example, here's a button that would copy the tags and description of the current tiddler to the newly created tiddler, set the `year` field to the current year, and set the `url` field to the contents of some configured tiddler containing a base URL plus the title of the current tiddler.

<$button>
  <$action-sendmessage
    $message="tm-new-tiddler"
    title="New Child"
    tags={{!!tags}}
    description={{!!description}}
    url={{{ [{MyBaseUrl}addsuffix<title>] }}}
    year=<<now "YYYY">> />
  New Child
</$button>

TW Tones

unread,
May 12, 2021, 7:51:32 PM5/12/21
to TiddlyWiki
Folks,

My thoughts without working through all your comments (yet)

Inheritance is a concept, there are many ways to implement it, you do not need core changes, Inheritance can just be at creation, a smart new hear button will create a child from values in the parent, templates for new tiddler is also in effect one level of inheritance. Solutions where a set of values defines a "context" eg; work, project-name, client; allows new tiddlers to inherit a prior value. With this approach the relink plugin can be configured to support renames.

Now in these cases inheritance takes place in each node at creation or update. Using the KIN operator gives you access to the whole inheritance tree. 

Now if you wanted to determine inheritance without actual values in each tiddler you need to use a search/kin filter to find the value for each tiddler, every time you want that value. I am sure it can be done but I question the value. There may be some rare cases where it is a good approach, but more effectively if limited to particular fields and tiddlers, rather than weighing the wiki down with more calculations. The exception may be if you only need to inherit from a parent not deeper.

Another way to represent inheritance is rather than provide a field with a value, provide it with the code or filter necessary to find the value. If it contains a filter or macro use that to find the value otherwise use the actual value in a field. for example a field could contain a filter using the kin operator to find the value.

If you do not need to explore multiple levels to find the inherited values, and can quickly identify from where to inherit the value performance would be greatly improved.

Regards
Tones

damscal

unread,
May 13, 2021, 5:22:26 AM5/13/21
to TiddlyWiki
Thanks everyone for your useful contributions.

As I'm understanding, in TW users can set up forms of static or dynamic inheritance within WikiText and field values,
while field keys, tiddlers titles and tags can only be inherited statically
(for static inheritance I'd mean the information is copied into the new tiddler once at its creation, for dynamic inheritance I mean that the information is displayed through a reference)

As a relatively new user I'm finding unconvenient having to rely this much on static inheritance. Not having defined naming conventions yet, I have the need to change things often along the way, and I must do this manually. Even with something like Tiddler Commander, for me this kind of maintenance is currently being a major pain in using TW. Actually, I'd value the freedom coming from a knowledge base system which can easily (re)adapt to my always-changing mindset, instead of being forced to build an (incomplete) mindset in advance and being stuck with it. For this reasons I wish that field keys, tiddlers titles and tags would be dynamically inheritable.

Soren Bjornstad

unread,
May 13, 2021, 7:53:17 AM5/13/21
to TiddlyWiki
> As I'm understanding, in TW users can set up forms of static or dynamic inheritance within WikiText and field values,
while field keys, tiddlers titles and tags can only be inherited statically
(for static inheritance I'd mean the information is copied into the new tiddler once at its creation, for dynamic inheritance I mean that the information is displayed through a reference)

Yes and no. Indeed, by default, "dynamically inherited" things don't show up in the places you list...but since in TiddlyWiki you can dynamically access these things on the "parent" tiddler in filters or create a template that displays them on your tiddlers, there is usually no reason you need them to. It really would be very helpful if you could give an example use case.

As long as you have a clear idea of how you want to specify where things are inherited from, I would think modifying the tag display and the field browser to show these "inherited" fields, should you want to, would be a fairly easy change. As PMario pointed out, that wouldn't make them work in filters though – you'd still have to do the searches the same way there.

PMario

unread,
May 13, 2021, 9:20:16 AM5/13/21
to TiddlyWiki
On Thursday, May 13, 2021 at 11:22:26 AM UTC+2 damscal wrote:
Thanks everyone for your useful contributions.

As I'm understanding, in TW users can set up forms of static or dynamic inheritance within WikiText and field values,
while field keys, tiddlers titles and tags can only be inherited statically
(for static inheritance I'd mean the information is copied into the new tiddler once at its creation, for dynamic inheritance I mean that the information is displayed through a reference)

Have a look at the relink-plugin https://flibbles.github.io/tw5-relink/
It will help you to automatically "relink" the static "attributes" you may need

-mario

damscal

unread,
May 14, 2021, 11:43:55 AM5/14/21
to TiddlyWiki
On Thursday, May 13, 2021 at 1:53:17 PM UTC+2 Soren Bjornstad wrote:
> It really would be very helpful if you could give an example use case.

I'll try to:

1. Lets say, for instance, that I need to save some contacts info (like names, email addresses and so on). I'm going to create a tiddler for each person and populate them with fields to store their contacts info. I can use the Clone button to statically inherit field keys. But I'm always in a hurry so I'm not going to figure out a set of fields keys which is going to be future proof. Later at some point I'll have the need to rename some field keys (aka field names, not their values), add some, delete some others.

2. Same thing but with tags (relink can be used to rename them, but not to add or delete them)

atm to fix problems like these ones I'm using tiddler commander, but the whole thing is quite time consuming and prone to errors for me.
I think TW and its community are superb, yet I find it difficult to keep my wikis organized and consistent, which it slows down my workflow.
In contrast I've found Trilium's templates approach more intuitive and quick in this regard (note that templates are not based on hierarchy). Trilium is still not as mature and well referenced as TW though.
 
Any tips/useful references?

Soren Bjornstad

unread,
May 15, 2021, 7:21:48 PM5/15/21
to TiddlyWiki
So it's mostly about renaming things? That's an interesting use case. I guess I have never had the need to do that on a large scale. I wouldn't have expected inheritance to be capable of renaming a field like that, either.

I haven't used Tiddler Commander, but renaming a field doesn't really seem like it should be difficult, so perhaps something there could be improved or a new tool could be created. 

TW Tones

unread,
May 15, 2021, 7:53:59 PM5/15/21
to TiddlyWiki
Damcal

With respect I think you are mixing the design process with the user activity on your wiki. Cloning is a way of rapid duplication and edit, you would be far better served using a template or button to build your "instances" of a standard tiddler. Fortunately in tiddlywiki we can build tools to fix issues generated in the design phase, but these are best just one off corrections to the way your wiki is designed. If seems to me you are operating as a user a tiddlywiki where the design is not finished, this is in part why you feel you need shortcuts such as clone, because many of your processes are not as yet automated or simplified (through design).

To me the relink plugin is a great addition, but to rely on it, may suggest opportunities for redesign exist.

Tones

Damiano Scalise

unread,
May 16, 2021, 10:04:09 AM5/16/21
to tiddl...@googlegroups.com
@Tones

You are right in what you are saying, my understanding and designing capabilities of TW are limited.
A primary purpose of this discussion for me is to learn and understand more, and another main purpose is to provide user feedbacks to developers.


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/zDLrmjhDFOA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/01588939-d90c-4785-aff7-fb8aaa084ccfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages