You can use SQL commands in Déjà Vu X3 to add a subject attribute to terms that don't have one, in a Termbase.
Déjà Vu X3 does not store the name of a subject in a Termbase; instead, it stores the subject's code number. When you open a Termbase in Déjà Vu X3, it looks this number up to find the name of the subject, and then displays that name. Therefore, when you modify a Termbase using SQL, you must use the subject's code number in the commands you use, rather than the subject's name.
How to find a subject's code
You can see the list of subjects that Déjà Vu X3 uses by accessing to menu option File>Options, and the selecting the Subjects tab:
There you can see the list of subjects that Déjà Vu X3 uses, showing their names and the subject code for reach. Find the subject you want to add, and take note of its code.
The Subject attribute
If you are adding a subject to terms in a Termbase that does not have any subject information at all, it is likely that the Termbase does not a definition for the Subject attribute. If the Termbase does not have the Subject attribute defined, you will not be able to add subject information for individual terms effectively.
Therefore, you must check that the Termbase you are working with has the Subject attribute defined, and add the definition yourself if it is not there. To do so:
- Open the Termbase in Déjà Vu X3.
- In the Home section of the Ribbon, click Properties.
- The Termbase Properties dialog appears. Select the Attributes tab.
- Here you can see if the Subject attribute is defined. The image above shows a properly defined Subject attribute. If you find that, you can close the Termbase Properties dialog.
- If the Subject attribute is not defined, you can add a new attribute, using the same definitions shown in the image above. To learn how to add a new attribute to a Termbase, read this article.
The SQL commands
How to run SQL commands on a Termbase
To see how to use the SQL commands to make changes in a Termbase, read this article.
The SQL commands
Type and run the following statements, one at a time, into the Execute SQL dialog:
|INSERT INTO Attributes (LemmaID) SELECT ID FROM Lemmas WHERE ID NOT IN (SELECT LemmaID FROM Attributes WHERE AttrTypeID IN (SELECT ID FROM AttrTypes WHERE Token = 'subject'));|
|UPDATE Attributes, AttrTypes SET Attributes.AttrTypeID = AttrTypes.ID WHERE AttrTypeID = 0 AND Token = "subject";|
|UPDATE Attributes SET TextValue = 'CodeOfNewSubject' WHERE TextValue = '' AND AttrTypeID IN (SELECT ID FROM AttrTypes WHERE Token = 'subject');|
Be aware that:
- The 'CodeOfNewSubject' should be the subject number of the subject you wish to add.
- The apostrophes (') have to be vertical, rather than the curly ones that Word and other word processors use; otherwise you may get a syntax error.