First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.
What I’m trying to do
I have a large Document Base with extensive YAML frontmatter which works for the general flow of use.
However what I want to do for a specific situation is to add tags to these documents without changing the original documents …
Thinking of it in an object oriented programming way … it would be sub-classing the original document for the specific situation.
Is this something that is possible or will I have to keep a dupliucate copy of the documents that have had the tags added for my purpose?
Things I have tried
I have not tried anything since this is the first time I have attempted something like this and simply want to know if it is possible at this time.
Thanks for any help in advance,
What do you mean by not changing the document?
Do you just want to preserve the modified date? That can be edited by a command like “touch” in an external script.
Or do you mean the contents must remain unchanged? That’s not possible since a tag is content.
But if you can’t touch the documents, you could create a note called “TAG”, and link TO all the documents you want to mark. The TAG note would “collect” all the docs.
Then you can do queries based on links/backlinks.
The original document contents are not to be changed in this case.
Thus I cannot add a new tag that will be used to filtered the information as I want to (adding a tag to search on would be a trivial solution).
With this “other note”, I create a tag list with document titles? file names?
I then create a dataview in another document (the collection point) that queries this “other note”, using the tag/s I might have added to access the documents.
But how does that dataview then access the contents of the original documents?
Not sure how to edit my own reply, so replying to myself … I am going crazy … obviously.
@rigmarole you gave me just enough to think about to solve the problem on my own (at least the simple version).
For those looking for something similar, I solved this by
- create a document that contains YAML tags with enough information to describe the documents that you do not want changed.
- create your data views with an added WHERE clause that links to this tag document and accesses the tag list and compares those tags to the attribute of the original documents.
WHERE [[datafile]].tagname = "what you are looking for"
since my tag contains a list of attributes I am using something like
WHERE contains([[datafile]].tagname, "tagvalue")
Hope that helps others looking for something similar.
Glad that works.
I wasn’t talking about using “tags” per se. I meant creating a note that had a title that would act like a tag. Or more generally, just a categorization. (This is also similar to a Map of Content or MOC.)
For instance, create a note called “Apple Recipes”
Then all your apple recipe categorized notes - which you are not allowed to edit - would be linked inside the Apple Recipes note. The Apple Recipes note would be a hub of outgoing links.
Then you could use a Dataview query that would find all the notes that are linked FROM the “Apple Recipes” note.
WHERE contains(file.inlinks, [[Apple Recipes]])
Which is slightly ironic, since you just manually built up that very list. But you could include other filters and rules.
Perhaps vanilla search queries could handle outgoing links too. (Or was that a feature request??)
My current situation is that there is a collection of data (currently under a Data directory). There are approximately 300 files in that collection and they are categorised by using a folder hierarchy.
The issue was (not anymore for now) that the Data was essentially Read Only AND it was to be used in other locations without change - hence if I created 50 vaults with the same Data directory (working on not having to copy it right now) I would have to rely on those Documents being “as is” without extra information.
Periodically that Data directory would be updated with corrections, new additions, etc.
So the solution had to be independant of that Data in the sense of YAML and other related tags.
I have read/heard of MOCs a lot, and I may spend some time learning more about them and using them - I think I created a “version” of MOC but using tags instead of links.
So that led me to the question and hence the solution I came up with.
MOCs seem like they would allow me to format the layout of the “Data Note” with headings and different styles to give a better indication of what the Data Note is for.
If you are on Windows or MacOS, could you use filesystem tags? As far as I know, that wouldn’t alter the contents of files.
This isn’t an Obsidian solution, granted.
@Amontillado I am looking for an Obsidian only solution.
The usage of the Vault is supposed to be self-contained and then perhaps published to the Web internally. If I used external systems I have no guarantees about the OS it is running on.
Although I have found a solution that works (to some degree) it does not do everything I would like to see, however learning is half the fun.
What doesn’t work in your proposed solution?
It seems to be a feasible solution to make “shadow” files containing the tags outside of the original read-only files. And it shouldn’t be too hard to make some commands in QuickAdd or Templater, which would help you add/edit/open the shadow file.
And as you’ve suggested, you’re able to reference tags in another file based upon an original filename, either through
link(...).variable ( I think the latter also works).
Right now, I am using YAML attributes that are lists of things that are “being used” from that specific category.
I can create DataViews using the CONTAINS function to check if the document’s name is in the category list.
However what I would love to have is that a document named “How To Write An Essay” needs some changes (for whatever reason) but obviously they cannot be listed in the original document - let say paragraphs 3 and 5 need to be rewritten.
I would like someway of indicating that change has occurred but when a user looks at the document they see the updated version rather than the original.
Maybe you could use GIT for this kind of workflow?
Do you mean using GIT the source code “backup” system?
If so, that is a very interesting concept - a very interesting one.
Each project that shares the original data and changes it would have its own versioning system inbuilt etc. They would all start by checking out the original data sources from a “master” but then edit what they want when they want.
And if this is done only internally/locally then the machine itself would require GIT installed and the user would need training in GIT, however it could possibly work.
The problem is rolling back changes if the user does not know what they are doing. But yes … this is a fantastic idea.
Something to keep in my Development notes as a “what if … hey look at this … note”
You can use GIT as a “backup” system but it is a “versioning” system. Maybe you can combine it with a “master” like GitHub.
As you say, the real challenge is to implement an “easy to use” workflow. I think (?) - that’s no easy feed.
Well I think the key to it would be to create a “master” of the documents, then when the documents are downloaded to whatever application needs them they make a copy of the master.
The biggest concern I have is if the master is updated at any time, then the edits may or may not be still valid and they have a fork of data happening.
But interesting nonetheless.
I was actually thinking along the same lines yesterday, that they could possibly use git to achieve their goals.
My implementation would then use branches:
master branch would be used for the actual data, and changes to them
- Any time is needed to do another version, a branch is created, and whatever changes needed are done in that branch
- Furthermore, if changes are needed on the master branch, or one would want to work on another branch, one could easily switch b around and git would handle changs
- It would even be possible to realign a version branch to the master branch (but still keep the version changes) through rebasing a branch, if a vital change to the master data is wanted
In short git with branching (and rebasing) could meet your goals, even when editing the “original” files. And this without the need of “shadow” files. You would need to learn git though, and be familiar with branching and rebasing. As an extra bonus it would also give you the bonus of undoing/rewinding changes, aka a very good backup system.
@holroy … I only know git for my own basic development needs, I have never branched any applications I have written.
Looks like I will have to learn something new at some stage.
Currently I am cleaning up the master and storing it in a seperate location for now and will make a copy as needed, however I will need to make this more permanent as discussed.
I think you’ll actually find good tutorials on how to use git as discussed, if you look for code development using branches.
It’s quite common to use the master branch for the official version, and then use a branch for each feature/bug/… . And then use rebasing to realign your local branches according to major upgrades or contributions from others (which would be normal if working in a team).