Skip to content
Emanuele Tajariol edited this page Oct 20, 2016 · 4 revisions

Update the DB

You need the files

geonode/base/migrations/0008_add_thesaurus_keywords.py
geonode/base/migrations/0009_resourcebase_tkeywords.py

which will update your DB schema.

Run the usual command

python manage.py migrate

to update the schema.

Loading a thesaurus

You can add a thesaurus into you GeoNode using the load_thesaurus command:

 python manage.py load_thesaurus --help

-d, --dry-run         Only parse and print the thesaurus file, without
                      perform insertion in the DB.
--name=NAME           Identifier name for the thesaurus in this GeoNode
                      instance.
--file=FILE           Full path to a thesaurus in RDF format.

In order add the inspire-themes thesaurus into a geonode instance, download it as file inspire-theme.rdf with the command

wget https://raw.githubusercontent.com/geonetwork/util-gemet/master/thesauri/inspire-theme.rdf

and then issue the command:

python manage.py load_thesaurus --file inspire-theme.rdf --name inspire_themes

The name is the identifier you'll use to refer to this thesaurus in your GeoNode instance.

If you only want to make sure that a thesaurus file will be properly parsed, give the --dry-run parameter, so that nothing wil be added to the DB.

Note: if the name starts with the string fake, the file will not be accessed at all, and some test keywords will be added to a fake new thesaurus. In this case the dry-run param will not be used.

Configure a thesaurus in GeoNode

After you loaded a thesaurus into GeoNode, it should be configured in the settings.py file (or in the local_settings) in this way:

THESAURI = [{'name':'THESAURUS NAME', 'required':True|False, 'filter':True|False,}, ...]
  • name: (mandatory string) the identifier you used in the load_thesaurus commands.
  • required: (optional boolean) if True, a keyword of this thesaurus is mandatory to complete the metadata. Currently not implemented.
  • filter: (optional boolean) if True, a faceted list of keywords of this thesaurus will be presented on the search page.

So, in order to set up the INSPIRE themes thesaurus you may set the THESAURI value as:

THESAURI = [{'name':'inspire_themes', 'required':True, 'filter':True}]

Auto complete

Each item in the THESAURI setting will create an autocomplete entrypoint, with URL ::

autocomplete/thesaurus_THESAURUSNAME

For instance, the sample inspire_themes thesaurus will create a service you can use in this way:

curl "http://SERVER_NAME/autocomplete/thesaurus_inspire_themes/?q=area"

<span data-value="403">Area management/restriction/regulation zones and reporting units</span>
Clone this wiki locally