It doesn't have to be a dictionary, I just used that formatting as an 
example 🤔 In fact it doesn't have to be an existing data structure at all, 
if there's a way for me to parse the raw text on my relationship tiddler 
(even if that means getting my hands dirty with Javascript).

On Thursday, February 6, 2020 at 8:32:05 AM UTC-6, Eric Shulman wrote:
>
> On Wednesday, February 5, 2020 at 7:57:41 PM UTC-8, Mooglegirl wrote:
>>
>> I have tiddlers for different characters in my story, and I want to 
>> define a list of pair relationships with accompanying comments, and then 
>> generate the relationships for a given character on the fly. For example, I 
>> might have some hidden tiddler with something like:
>>
>> alice:bob (brother/sister)
>> bob:carlos (friends)
>> bob:darren (rivals)
>> darren:alice (boyfriend/girlfriend)
>>
>>
> There is a fundamental flaw in your intended design:  in a 
> DictionaryTiddler, which contains key:value pairs, each key must be unique, 
> but in your example, you have two separate entries both with a key of "bob".
>
> To see the problem, try this on Tiddlywiki.com:
>
> 1) Create a tiddler (e.g., "MyData") containing the example content shown 
> in your post and set the type of the tiddler to 
> "application/x-tiddler-dictionary"
> 2) Create another tiddler (e.g., "MyTest") containing: {{MyData##bob}}
>
> Notice that only one result is shown: "darren (rivals)".
>
> To achieve the kind of design you want, you would have to make each key 
> value unique (e.g., "bob-friends" and "bob-rivals"), but then it would be 
> problematic to do a lookup for the "Bob" tiddler.  You would have to get 
> the list of all key names and remove any "-friends" and "-rivals" suffix to 
> find the desired key entries, and then restore those suffices when you want 
> to actually fetch the corresponding value for each matching key.  The 
> required code is complex and prone to errors in implementation.
>
> You might be able to address the problem by having separate 
> DictionaryTiddlers for each type of relationship.  Thus, you would have a 
> "Friends" tiddler containing "Bob:Carlos" and a "Rivals" tiddler containing 
> "Bob:Darren".  Of course, this has it's own complexities, in that you would 
> have to check every relationship tiddler to find and display any entries 
> for "Bob".
>
> -e
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/cbecb0a0-afbc-47fb-b445-4cb317efbc91%40googlegroups.com.

Reply via email to