How to list all of the Things that point to this Thing

Tags:
When you build a complex Querki Space, you usually wind up with Things pointing to other Things -- that is, you wind up adding Link or Tag Properties from one Thing to another. For example, in the common example of a CD Catalog Space, you have Albums pointing to Artists: you create an Artist once, and then have a pointer from each Album for that Artist.
When you are displaying the Album, it's easy to list all of the Artists for that Album:
[[Artists -> _bulleted]]
But say you're trying to write the Default View for the Artist, and you want to show all of the Albums that Artist has put out. How do you do that? This is where the _refs and _tagRefs functions come in.
The answer is currently a bit different depending on whether the pointer Property is a Tag or a Link. (This is a bug -- eventually, we plan to use the same function for both -- but you need to deal with it for now.)
If the Property is a Link, you use the _refs function, with the name of the Property. So in the Artist's Default View, we would say:
[[Artists._refs -> _bulleted]]
What is this doing? Well, just as Artists in the first example means "all of the Things linked in my Artists Property", Artists._refs means "all of the Things that point to me through the Artists Property".
If this Thing is pointed to by Tags, it's a bit looser:
[[_tagRefs -> _bulleted]]
_tagRefs isn't specific to a particular Property -- it simply lists all of the Things that point to this one.
These functions are crucial to using Querki well: they allow you to put your pointers only in one direction, but then querying them from the other side, so you don't have to duplicate information. You'll find that this makes your Spaces easier to manage, and avoids getting into trouble things get out of synch with each other.

Back to Recipes