[Tshwanelex-l] Multiple Dictionaries From One Database

David Joffe david.joffe at tshwanedje.com
Fri Jun 28 18:33:20 EDT 2013


Hi,

I've tried to write up some full and detailed instructions for 
setting up 'Masks', cf. below (and the attached) - I'm also updating 
the included 'sample' that comes with TLex to have this more 
detailed explanation. Instructions below.

Hopefully someone else might find it useful too.

It is a bit 'long-winded' to set up initially, but it is pretty 
useful/powerful once set up. I'll admit the Masks feature has not 
been well-documented enough in the past .. usually we've helped 
users set it up.

 - David

------
This sample demonstrates the "multiple dictionaries from one 
database" functionality in TLex.

This database contains two 'editions' - a 'full edition', and a 
smaller 'pocket edition' derived from the full edition. One entry is 
used to generate two possible output versions (i.e. the two editions 
constitute two different "views" of the same underlying entry data). 
Each edition has its own set of styles, and thus its own 'look'. The 
styles also define whether or not particular fields are entirely 
hidden in an edition; for example, the "Pronunciation" field is 
hidden in the Pocket edition.

You can press Ctrl+P (or use "Format/Toggle current style set") to 
switch between the two 'views' (editions), or click on the name of 
the edition in the top right of the Preview Area.

There are generally two different 'methods' in which fields can be 
selected to be hidden for each edition. You can use either one 
method or the other, or both methods combined, depending on your 
requirements.

The first method is for if you want to hide ALL instances of a 
particular field throughout the dictionary for a specific edition. 
For example, the "Pronunciation" field is always hidden in this 
sample for the Pocket edition only. This method does not require the 
"Masks" feature. To do this, go to "Format/Styles", select the 
"Output (display) order" tab along the tab, select the "StyleSet" 
corresponding to the 'edition' (you need at least one StyleSet per 
edition), then, select the (parent) element of the field you want to 
hide at the left, then select the field (attribute) to be hidden in 
the "Child element/attribute" list, then tick or untick the 
"Visible" checkbox as desired.

The second method is if you want to selectively hide SOME instances 
(within entries) of a particular field for a specific edition only, 
e.g. if you want certain usage examples visible in the Pocket 
edition, but you want other usage examples to be hidden. This can be 
done using the Masks feature of TLex, for any element type, and is 
demonstrated in this sample on the "Sense" element, to exclude 
chosen senses from the Pocket edition. In the "draw" entry, for 
example, sense 2 has been 'excluded' from the Pocket edition - 
merely by ticking its "Sense::Exclude" box under "Attributes (F2)". 
(This requires the "Masks" to be configured first - this is 
explained briefly below.)

Note that TLex also 'intelligently' recalculates the automatic 
numbering for elements that are "masked out" - in this example, 
sense 3 automatically becomes sense 2 in the Pocket edition.

Finally, one can also choose "abbreviated" labels for the Pocket 
edition under "Format (F4)". (Abbreviated sets of labels can be 
configured in the 'DTD editor' - see the User Guide section 
"Attribute Lists".)

CONFIGURING MASKS

Note you can repeat 'STEP 2' to 'STEP 4' here to set up Masks on 
however many elements you want - e.g. you could mask out usage 
examples on a per-edition basis, definitions, translation 
equivalents, senses, etc. In this explanation there are also only 
two editions, a 'Full' and 'Pocket' edition, but you can create as 
many as you like.

STEP 1: Create 'StyleSets' for each edition

- Open your document in TLex (or tlTerm, tlDatabase etc.)
- Go to 'Format / Styles' to open the Styles dialog
- Under the "Style sets" list, click "Edit sets of styles"
- If you already see a 'Pocket' styleset in this list (e.g. if 
you're embarking from the sample), then you can skip the rest of 
these instructions in "STEP 1".
- If you don't already have a 'Pocket' styleset in this list, then 
select an existing set of styles (by default there will usually be 
only one here, named 'Default styles'), and click "Clone"
- Enter the name 'Pocket', and click OK
- You should now have two style sets in the list, 'Default styles' 
and 'Pocket'
- Select 'Default styles' and click the 'Rename button', then change 
the name to 'Full', and click OK

You should now have two sets of styles, one for a 'Full edition' and 
one for a 'Pocket edition'.

STEP 2: Add an 'Exclude' attribute (field) that will be used to 
actually select which information to 'mask' out

- Go to 'Dictionary / Customise DTD'
- Select the element at the left for which you want to be able to 
selectively exclude instances (e.g. 'Sense', or e.g. 'Lemma' if you 
want to selectively exclude entire entries)
- Click the "Add attribute" button at the right
- Enter the new attribute name "Exclude", or "ExcludeFrom" (this 
name can be anything, but 'Exclude' or 'ExcludeFrom' are good, as 
they help describe what it does) and click OK
- Make sure the Exclude attribute is selected in the list of 
attributes, and then (at the bottom of the dialog) change its "Data 
type" from "Text" to "Select from list (multiple)"
- You will get a warning about changing the attribute type - make 
sure you've selected the new Exclude attribute, then click 'Yes'
- You will get a prompt about creating a new list. If you're setting 
up masks for the first time, just click "OK" here to "Create new 
list". (If you've already been through these steps to create an 
Exclude list, then you can just select that existing list here.). 
The list will contain a list of 'editions'.
- Now select the "Attribute lists" tab at the top of the DTD 
customisation dialog
- Select the new "Exclude" list in the list of lists. With the 
"Exclude" list selected, do:
- Click the "Add new list item" button. Enter new list item name 
"Full" and click "OK"
- Click the "Add new list item" button. Enter new list item name 
"Pocket" and click "OK"

You should now have a new F2 checkbox list attribute named 
'Exclude', with two list items for its list - one for each edition, 
i.e. 'Pocket' and 'Full'.

Note that the "Masks" do not work by selecting what we want to 
include, but by selecting what we want to exclude/hide for a given 
edition - hence the name 'Exclude'.

STEP 3: Set up the actual 'Masks'

This step basically 'links' each edition's 'style set', to its 
corresponding edition list item in the 'Exclude' list, as a TLex 
'Mask'. (Don't worry if you don't fully understand what is happening 
here - just try follow the steps closely, and thereafter you should 
be able to just tick the excluded information under 'Attributes 
(F2)' while editing.)

- Go to 'Format / Styles'
- Select the 'Masks' tab at top right of the Styles dialog
- Select the 'Pocket' styleset under the list titled "Style sets"
- Click the "Add" button below the list
- Select the "Exclude" list from the 'Select a list' dialog that 
appears
- Then on the right hand side area of the Masks configuration 
window, it will now display a list of the items in the Exclude list, 
namely 'Full' and 'Pocket', with checkboxes at each - tick the 
'Pocket' checkbox (meaning, for the 'Pocket' style set, we want 
exclude i.e. 'mask out' elements/entries where 'Pocket' is ticked 
under F2)

- Now select the 'Full' style set under the list titled "Style sets"
- On the right hand side area of the Masks configuration window, 
tick the 'Full' checkbox (meaning, for the 'Full' style set, we want 
exclude i.e. 'mask out' elements/entries where 'Full' is ticked 
under F2)

- Click the "Close" button at the bottom of the "Styles" dialog

STEP 4: Hide the 'Exclude' attribute from the Preview Area and 
output

Since the newly created 'Exclude' attribute at "STEP 2" is also just 
a 'normal' field, it will by default be visible in the Preview Area 
and in the exported output. This is usually not desirable. So for 
the final step, we just need to hide this attribute.

The attribute hidden/visible state is chosen separately for each 
'set of styles', so we need to do it twice, once for the 'Full' 
edition style set, and once for the 'Pocket' edition style set.

- Go to 'Format / Styles'
- Select the 'Output (display) order' tab at the top

- Select the 'Full' style set under 'Style sets'
- Select the 'Lemma' element in the list at the left (or 'Sense', or 
whichever element it was you selected at STEP 3)
- Select the 'Exclude' 'Attribute' in the 'Child element/attribute' 
list
- Untick the 'Visible' checkbox

Then, repeat for the 'Pocket' style set:

- Select the 'Pocket' style set under 'Style sets'
- Select the 'Lemma' element in the list at the left (or 'Sense', or 
whichever element it was you selected at STEP 3)
- Select the 'Exclude' 'Attribute' in the 'Child element/attribute' 
list
- Untick the 'Visible' checkbox

Finally, click the "Close" button at the bottom to close the Styles 
dialog.

You can now start masking out information on a per-edition basis as 
you edit. Remember the toggle option 'Format / Preview all sets of 
styles' to enable/disable real-time preview of ALL editions, and you 
can use the Ctrl+P 'Format / Toggle current styleset' command to 
switch between edition 'views' (or select the current edition from 
the top right of the Preview Area).




On 24 Jun 2013 at 8:01, Geoff TOISTER wrote:

Date sent:	Mon, 24 Jun 2013 08:01:42 +0300
From:	Geoff TOISTER <gat178 at 012.net.il>
To:	tshwanelex-l at mailman.yale.edu
Subject:	[Tshwanelex-l] Multiple Dictionaries From One Database

> 
> The sample file 'Multiple Editions Sample using Masks' illustrates two aspects of building 
>                              multiple dictionaries from one database:
> 1.  Hiding a specific field (e.g. pronunciation) in one edition while displaying it in another.
> 2.  Excluding chosen senses from one edition while displaying them in another.
>                    However, I want to exclude complete entries (i.e. 
> LemmaSign+LemmaDisplay+Sense+Definition+etc.) from one edition while displaying them in 
>                                                              another.
> I have tried to do this by copying the DTD of the sample file into a pilot file and modifying it so 
> that the 'Exclude' attribute was assigned not only to the 'Sense' element, but to the 'Lemma' 
> element as well. This was unsuccessful, as it merely added (in the preview area) 'Pocket' to 
>            those entries slated for exclusion, but did not hide them.
> Can anyone tell me what I am doing wrong and what is the correct procedure?
> ~~~~~~~~~~~~~~~
> Geoff Toister
> www.gt-lex.weebly.com 
> This message has been scanned by AVG anti-virus
> ~~~~~~~~~~
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.2904 / Virus Database: 3199/6434 - Release Date: 
> 06/23/13


-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  Multiple Editions Sample using Masks.tldict
     Date:  29 Jun 2013, 0:28
     Size:  59225 bytes.
     Type:  Unknown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Multiple Editions Sample using Masks.tldict
Type: application/octet-stream
Size: 59225 bytes
Desc: not available
Url : http://mailman.yale.edu/pipermail/tshwanelex-l/attachments/20130629/b9d2f98c/attachment-0001.obj 


More information about the Tshwanelex-l mailing list