geosolutions-it / geonode-rndt

Geonode-RNDT is a Django App to let GeoNode be able to expose the metadata compliant to the RNDT standard
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Thesauri: update model #11

Open etj opened 3 years ago

etj commented 3 years ago

Thesaurus table (update)

We need to support an href referencing the thesaurus; it's stored into the rdf:about field.

We need to move into the DB the config currently kept in SETTINGS (see https://docs.geonode.org/en/master/admin/thesaurus/#configure-a-thesaurus-in-geonode). This is an excerpt from the current doc:

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.

We'll add:

Warning: the change about moving the settings from the SETTINGS file into the DB is breaking backcompatibility, so we'll have to change the logic accordingly:

ThesaurusLabel (create)

Contains localized version of the thesaurus title

mattiagiupponi commented 3 years ago

Constraint added unique_together = (("thesaurus", "lang"),) for model ThesaurusLabel

etj commented 3 years ago

Some RDF may report only localized titles:

<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="it">Registro dei dati di interesse generale per il RNDT</dc:title>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">Register of the reference data sets for RNDT</dc:title>

while other RDF may report only the generic title:

<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">Conditions Applying To Access and Use</dc:title>

We want to deal with any combination of cases.

In the model, we have 2 fields for the Thesaurus title:

In the case we only have localized titles (the ones with xml:lang), we shall take one of them to populate the default title. We'll have a new setting (e.g. THESAURUS_DEFAULT_LANG) which tells us which language should be chosen. If the thesaurus title is not provided in such a language, we'll take the first localized title found.

E.g.: Only localized defined, THESAURUS_DEFAULT_LANG=it:

<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="it">Registro dei dati di interesse generale per il RNDT</dc:title>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">Register of the reference data sets for RNDT</dc:title>

will result in

e.g.2: All entries provided

<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">General title</dc:title>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="it">Italian title</dc:title>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">English title</dc:title>

will result in

e.g.3: Only general title provided

GEMET - INSPIRE themes, version 1.0 will result in - Thesaurus.title=GEMET - INSPIRE themes, version 1.0
mattiagiupponi commented 3 years ago

In some rdf the field altLabel is not available. For avoid loads errors we should implement the altLabel in this way:

If the altlabel exists we will take it, otherwise preflabel[DEFAULT_LANG] or preflabel[0] --> ThesaurusKeyword.altLabel