Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blog post describes a mechanism to add keyword from thesaurus as queryable #14

Merged
merged 3 commits into from
Aug 18, 2024

Conversation

pvgenuchten
Copy link
Contributor

No description provided.

Copy link
Member

@tomkralidis tomkralidis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very useful post @pvgenuchten ! See minor change requests.


## Populate the parameter from record imports

We have 2 options here, either manage the population of the column within the database as part of an insert trigger on the `record.themes` field. Alternatively update `pcsw/core/metadata.py` so the column is populated when records are imported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pcsw/core/metadata.py -> pycsw/core/metadata.py

@@ -0,0 +1,77 @@
---
layout: post
title: Keywords from thesaurus as Queryable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title: Using keywords from a thesaurus as queryables

publish_date: 2024-09-18 14:59:00-0400
---

## Keywords from thesaurus as Queryable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using keywords from a thesaurus as queryables


A common convention in catalogues is the use of keywords from a dedicated thesaurus. The assignment of these keywords can then later be used to filter or query the catalogue by these terms. To achieve this use case in pycsw, some configuration needs to be tailored. This blog post indicates the changes needed for this scenario.

For this example we'll use a keyword from the [INSPIRE Themes](http://inspire.ec.europa.eu/theme) thesaurus. We will define a new queryable `inspiretheme`, which will be populated with the relevant keyword (if present).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Which of the parameters are queryable is defined in `pycsw/core/repository.py`.

'inspiretheme': self.dataset.inspiretheme,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap in a python code block/fence:

'inspiretheme': self.dataset.inspiretheme,


## Add parameter to record results?

Keywords are already published in records, so there is generally no need to extend the record with the new parameter. If needed you can do so in `pycsw/ogc/api/records.py#Line=1150`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If needed you can do so in pycsw/ogc/api/records.py#Line=1150. -> If needed you can do so in pycsw/ogc/api/records.py (line 1150).

t.thesaurus['uri'] == 'http://inspire.ec.europa.eu/theme')))]))
```

## Add parameter to OGCAPI - Records facets
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add parameter to OGCAPI - Records facets -> Add parameter to OGC API - Records facets


## Add parameter to OGCAPI - Records facets

Facets enable to further limit search results. Keywords from thesauri are very usefull to add as facet. Add the paremeter to `default.yml`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usefull -> useful

@tomkralidis tomkralidis merged commit 91301af into geopython:gh-pages Aug 18, 2024
1 check passed
@tomkralidis
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants