I am making a worldbuilding vault for a novel. In my notes I have a note type “place” - every important place in the world has it’s note. Some places have a “superior place” as a frontmatter property.
For example a “Tree A” has a superior place “Forest B”, which has a superior place “Geo area C”, which is has a superior place “Continent D”
I only put the first superior place into the properties.
For each “place” note i want an overview of all sub-places. For 1st degree sub-place I can easily query
dataview
table WITHOUT ID file.link AS place,
FROM "Places"
WHERE contains(superior_places,[[]])
but thats as far as I got.
I want to list all the stuff on Continent D even though they are not linked directly.
I do not want to use any specific folder or note names in the query, because I link this (or similar) snippet on every note using dataviewjs → dv.paragraph.
If the degree isn’t too many to type out, you could do:
TABLE
WHERE
contains(superior_places, [[]])
OR contains(superior_places.superior_places, [[]])
OR contains(superior_places.superior_places.superior_places, [[]])
OR contains(superior_places.superior_places.superior_places.superior_places, [[]])
That assumes superior_places is a text or list property whose value(s) is a link to a note (or null).
If some of the superior_places values within the chain are any regular text (instead of a link to a note), I think this will manually type-safe it:
TABLE
WHERE
contains(superior_places, [[]])
OR contains(link(superior_places).superior_places, [[]])
OR contains(link(link(superior_places).superior_places).superior_places, [[]])
OR contains(link(link(link(superior_places).superior_places).superior_places).superior_places, [[]])
Mind (and please forgive) any typed-on-mobile typos.
If you’re looking to reach more degrees than you’re will to type out, you might want to turn to DataviewJS or Bases, which have functions to reduce the repetition. (Dataview might too, though I don’t recall offhand.)