Moving documents with annotations

I am not sure if the following is a bug or expected behavior. Here is the situation:

I have a series of PDF files in Database A. I have annotated and tagged these files. There is now annotation files in the “Annotations” group in Database A.

I now move the PDF files from Database A to Database B. The PDF files move correctly to Database B but the annotation files remain in Database A instead of moving to Database B.

It seems that these associated annotation files should also reside in the same database as the migrated files.

Is this expected behavior? Should it be expected behavior? Am I doing something wrong?

2 Likes

Yes, this is expected behavior.
If you don’t explicitly move the Annotation files, then logically they would stay put. They are separate files.

The files will still relate to each other through their UUIDs, but you can move them into the same database, if you’d like.

how do I see that they are related? without inserting a backlink manually, I cannot see the link from the annotation file to the pdf and viceversa. Where is this information/link saved in the pdf and in the annotation file?

I have been playing with annotations as well, I never used them in DTPO2 because, frankly, I didn’t know about them. Now as I go through the Help Doc, I’m learning and I can see how I would use them a lot.

This issue with the annotation not moving with the document when the doc is moved to a different database seems like a wrong design decision to me. If for instance I have a group of files in one database and I decide to split them off to another I would somehow have to go and find all the annotations for just those docs and move them manually. If I have lots of annotations, that sounds like a difficult and error prone task.

I did a test and I do see that the annotation still shows up in the annotation sidebar when I open the doc in the new database, but what if I decided I wanted to sync the new database to have access to it on another computer but don’t sync the original database that contains the annotations, I wouldn’t see the annotations on the other computer(s).

I could see this happening a lot if I annotate files while they are sitting in the Global Inbox, processing them with tags and annotations before filing them into another database.

I did see that the tags copied over to the new database so that is good.

3 Likes

I completely agree with jdharper. Though it’s true that there are two files from a technical perspective, the lay user should not care about these implementation details. Most users would treat these two files (the annotation file and associated document) as one logical entity and expect them to be available at the same time.

Does a use case exist for keeping these files separate?

3 Likes

Most users would treat these two files (the annotation file and associated document) as one logical entity and expect them to be available at the same time.

I wouldn’t say most users would expect this since the Annotation files have always been separate. This is not new behavior in DEVONthink 3, and we don’t have enough metric data to assess this for new users either.

The files are linked via their UUID, so they don’t have to be in the same database, and yes, this is by design. People have all kinds of methods of organization and this allows for such flexibility.

The Annotations are gathered into their own group and can be easily moved, as a group or as individual annotation files, wherever you’d like to move them.

2 Likes

Yes but the issue is that you might want to move some, not all annotation files, so there’s more book keeping. Maybe if there’s a checkbox in preferences for when moving entries across databases the annotations are also moved over? I would think in most cases annotations should actually follow any migration of files, it’s seldom you want to detach them.

1 Like

In DT2.n this is an easy job, because both the source and annotation note files are located within the same group, so moving both together is an easy job (those files just follow each other). In 3.0, it does make the process more difficult, coz users have to hunt the matching files from two/more different groups. A work around is to take this beta testing period to plan ahead on which items to be moved and doing the task in 2.n first.

1 Like

In Skim you can have PDF annotations in separate files. In the Finder, these are not recognised as connected and don’t move with the annotated file. In BibDesk (by the same developer team as Skim) when you autofile, it also moves connected Skim annotations. I always use the latter approach whenever possible, and would prefer a similar approach in DT3.

In any case it seems it should be easy to write an Applescript to move a file and associated annotations together.

Of course I have no idea what all different use cases people have but I really can’t think of a reason why one would want their annotation files separated from their source doc between two different databases. I’m sure someone has a reason for wanting it that way.

But since DT3 puts the annotations in a separate group effectively hiding them (which I like), it’s going to be much more difficult to manage annotation files when moving docs between databases. If I have hundreds/thousands of files in a db and want to move half of them for instance to another database, I would never be able to sort out which annotation files to move over with them.

One last note. I noticed just now that if, after creating an annotation, then I change the name of the source doc, the annotation file retains the original filename (but stays linked). So if I have changed my doc names, I can’t immediately recognize which annotation file I would need to move.

1 Like

Thanks for pointing this out. I saw that there is now an annotation symbol so one can easily see if a file has an annotation. Maybe this helps.

05

IIRC, there was a similar issue in DT2 years ago and the Annotation script template was amended by the developers to put annotations in the same group as the source, as the idea of having thousands of annotations in one group was not comfortable for some. (I may have remembered wrongly… but for years my annotations have behaved decently and stuck with their mother…)

The real issue at the moment is that the Annotation template is inbuilt and can’t be changed by users to make what is, AIUI, a simple enough change to the AppleScript to get the old behaviour back.

That’s perfectly understandable at this early beta stage, but I’m hoping that the inbuilt annotation template will be exposed to the user before full release-it will help a lot to make simple changes like this easy to do.

The 2.n way seems better coz we can always use smart group to filter the annotation notes within each group or consolidating all notes at our own choice.

agree. I personally (and so far) don’t see any advantage of forcing the annotations into that separate group. As you say, in DT2 you could always do that if you prefer. I prefer them next to the pdf, with the same name by the way.

1 Like

I only started using annotations with this beta release so no experience with the DT2 approach.

I store individual business cards as PDF files. I then create an annotation to the business card so I can add details related to that contact. When perusing that business cards, I don’t want to have to see two files for each contact.

Question - if I rename and/or move file and ultimately lose track of the name and/or location of the annotation file, how can I find out what the annotation file name and location is?

The annotation can be revealed via the popup menu in Tools > Inspectors > Annotations & Reminder.

1 Like

This script moves annotation records to the database of annotated records

-- Move annotation record to database of annotated record

tell application id "DNtp"
	try
		set theRecords to selected records whose annotation's database ≠ database of it
		show progress indicator "Moving annotations... " steps (count theRecords) with cancel button
		
		repeat with thisRecord in theRecords
			step progress indicator ((name of thisRecord) as string)
			set thisAnnotation to annotation of thisRecord
			move record thisAnnotation to (annotations group of database of thisRecord)
		end repeat
		
		hide progress indicator
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell
3 Likes

This Smart Rule script moves annotation records to the database of annotated records

Note: The script scope is all databases, the scope you’ve set in the Smart Rule has no effect.

-- Smart Rule - Move annotation record of every database to database of annotated record

-- Note: The script scope is all databases, the scope you've set in the Smart Rule has no effect.

on performSmartRule()
	tell application id "DNtp"
		try
			set theDatabaseResults to contents of every database whose annotation's database ≠ database of it
			
			repeat with thisDatabaseResult in theDatabaseResults
				repeat with thisAnnotatedRecord in (thisDatabaseResult as list)
					move record (annotation of thisAnnotatedRecord) to (annotations group of database of thisAnnotatedRecord)
				end repeat
			end repeat
			
		on error error_message number error_number
			if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
			return
		end try
	end tell
end performSmartRule

3 Likes

I agree with the assessment that this is a non-desirable behavior. I have stopped using annotations because I cannot move documents without a lot of extra work – and part of the strengths of DT3 is being able to categorize data objects – including moving them to other databases when needed!

Looks like the annotations are file-name based as well - so what happens when one renames a file and moves it?