Skip to content

Commit

Permalink
Oarec themes keywords (#1024)
Browse files Browse the repository at this point in the history
* OARec: fix themes/concepts structure

* OARec: check for conformsTo on detection
  • Loading branch information
tomkralidis authored Sep 30, 2024
1 parent 3ef21df commit f42e6e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pycsw/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ def _parse_json_record(context, repos, record):

recobj = None

if 'http://www.opengis.net/spec/ogcapi-records-1/1.0/req/record-core' in record.get('conformsTo', []):
if 'conformsTo' in record:
LOGGER.debug('Parsing OGC API - Records record model')
recobj = _parse_oarec_record(context, repos, record)
elif 'stac_version' in record:
Expand Down
13 changes: 9 additions & 4 deletions pycsw/ogc/api/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,14 @@ def record2json(record, url, collection, mode='ogcapi-records'):

# todo; for keywords with a scheme use the theme property
if record.topicategory:
themes = []
themes.append({'concepts': [record.topicategory],
'scheme': 'https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_TopicCategoryCode'})
themes = [{
'concepts': [],
'scheme': 'https://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_TopicCategoryCode'
}]

for rtp in record.topicategory:
themes['concepts'].append({'id': rtp})

record_dict['properties']['themes'] = themes

if record.otherconstraints:
Expand Down Expand Up @@ -1229,7 +1234,7 @@ def record2json(record, url, collection, mode='ogcapi-records'):
try:
ogcapi_themes.append({
'scheme': theme['thesaurus'].get('url', theme['thesaurus'].get('title', '')),
'concepts': [c for c in theme.get('keywords_object', []) if c not in [None, '']]
'concepts': [{'id': c} for c in theme.get('keywords_object', []) if c not in [None, '']]
})
except Exception as err:
LOGGER.exception(f"failed to parse theme of {record.identifier}: {err}")
Expand Down

0 comments on commit f42e6e5

Please sign in to comment.