User Tools

Site Tools


More about Classifiers (Greenstone 2)

I've added a new type of classification to my collection. How do I create and add the navigation bar images?

Visit this page and follow the instructions. Note: this is only necessary for Greenstone v2.62 and earlier (newer versions use CSS to generate the navigation bar automatically).

I've added a new type of classification to my collection. How do I translate the navigation bar labels (2.71 and later)?

By default, the Title of a classifier is used as the button label in the navigation bar. The Title given to a classifier depends on the options used when creating it. In general, the -buttonname option will be used first, or the -metadata option if no buttonname is specified. The library looks for alternative text or translations in the macro files. If the Title is XXX, if the macro _labelXXX_ is defined, then this will be used for the label. If it is not defined, then the Title will be used as is. _textXXX_ and _textdescrXXX_ are used for the roll over text and help text on the about page. Provide translations of these macros to get translations of the label and help text.

How can I do Unicode collation for my classifier?

GenericList is the only classifier that supports non [a-z0-9] metadata values. It will handle creating horizontal lists using different scripts. Support for Unicode collection has been added to GenericList since 2.73. To set this up, you need to do the following:

  • Make sure you're using Greenstone 2.73 or later.
  • Download the file and put this in your system Perl "lib/Unicode/Collate" directory (Unix) or in the Greenstone "bin/windows/perl/lib/Unicode/Collate" folder (Windows).
  • Specify the "-sort_using_unicode_collation" option for your GenericList.
  • Rebuild the collection.

How do I use dynamic classifiers?

Only available for Greenstone version 2.81 and later. This feature is not available from GLI yet, you'll need to edit the collect.cfg file by hand.

  • Edit the collection's collect.cfg file (make sure its not open in GLI first) and add the line

infodbtype sqlite

  • Rebuild the collection to create an sqlite database instead of the gdbm database. This can be done from GLI. Then close the collection in GLI.

Dynamic classifiers are created at runtime, so no more rebuilding is required for classifier modifications.

To add a classifier, edit the collect.cfg file and add a line like dynamic_classifier Subjects "dc.Subject"

The first option, Subjects is the name of the classifier: this is the identifier for format statements, and the name that appears in the navigation bar. This is not translatable yet. The second option "dc.Subject" is the options for the classifier. The first part specifies the metadata that it should be built on.

Further options to the classifier include

  • -split_using_hierarchy_separator X
  • -group_by_first_character
  • -use_hlist_at_top
  • -split_greenstone_dates
  • -sort_documents_by Y

These need to be added to the classifier specification inside the quotes, for example

dynamic_classifier Subjects "dc.Subject -split_using_hierarchy_specifier | -use_hlist_at_top"

After each change you can go directly to the classifier web page and refresh to see your changes.

Formatting the dynamic classifier

Formatting is done in the same way as for standard classifiers, with format statements. The format statements are specified based on the classifier name, for example, SubjectsVList and SubjectsHList (instead of CL1VList etc).

In addition, dynamic classifiers can optionally use a few new format statements:

  • SubjectsDocumentNodes: if this is specified, the SubjectsVlist and SubjectsHList are only used for classifier nodes, and SubjectsDocumentNodes will be used for document nodes. This avoids the need for {If}{[numleafdocs],} tests everywhere.
  • SubjectsHeader: will be displayed above the classifier
  • SubjectsFooter: will be displayed below the classifier

Preserving the original directory structure of your collection for browsing

The situation: You have a nested folder structure which you have dragged and dropped into Greenstone, and you want to have this folder available for browsing in the built collection.

To achieve this:

  • Open the GLI application (Greenstone librarian interface).
  • If you had already created it, open your existing collection–the one with the folder structure–in GLI.

Otherwise create such a collection by dragging and dropping your nested folder structure into the right-hand panel of GLI's Gather tab.

Next you'll be creating metadata that specify a relative directory path, so that the folder structure is mirrored in the browsing classifier:

  • Click on the Design tab. In the left-hand pane, select Browsing Classifiers. Choose to add a Hierarchy classifier from the drop down box in the right-hand pane.
  • Configure the Hierarchy classifier you've just added by clicking on the Configure Classifier button at the bottom:
  • set its "separator" field to: [\\\/|\\\\]
  • in the "metadata" field, choose a metadata field that you think makes sense to specify the folder structure in. For example, you may choose dc.Subject and Keywords. In the example collection I created, I just picked dc.Resource Type.
  • Click on the Enrich tab.

We're going to assign the directory structure as metadata now.

  • In the left-hand panel, browse to each of the innermost subfolders: the folders that contain the actual files. Perform the following for each of these innermost FOLDERS:

Click to select this folder and set the metadata for the field you chose in (4) above to be the relative directory path to this folder.

For instance, assume that the metadata field you wanted to set was dc.Resource Type. If one of the innermost folders you were working with was labelled "1ASCii" and was nested inside the folder structure Encodings/Ascii/, then you'd go down into the 1ASCii folder and type "Encodings/Ascii/1ASCii" as the value for the dc.Resource Type metadata. This is because the folder 1ASCii was nested inside folder Ascii which was located in Encodings.

  • If you've provided the directory path for each of the inner folders in the chosen metadata field, then click on the Create tab and press the Build Collection button.
  • Once built, preview the Collection by pressing the Preview Button.
  • In the web browser that opens, click on the link of the browing classifier for which you added the Hierarchy classifier. For instance, if the dc.Resource Type metadata was associated with the Hierarchy Classifier (as in the example in (6) above), then you'd click on the classifier "types" and browse down to see the files.
en/user_advanced/more_about_classifiers_gs2.txt · Last modified: 2023/03/13 01:46 by