Skip to content

Commit fc2f752

Browse files
committed
OARec: emit default keywords as bare keywords, not themes/concepts
1 parent dac4516 commit fc2f752

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

pygeometa/schemas/ogcapi_records/__init__.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,27 @@ def write(self, mcf: dict, stringify: str = True) -> Union[dict, str]:
184184
mcf['contact'])
185185

186186
LOGGER.debug('Checking for keywords')
187-
for value in mcf['identification']['keywords'].values():
187+
for key, value in mcf['identification']['keywords'].items():
188188
theme = {'concepts': []}
189189

190190
keywords = get_charstring(value.get('keywords'), self.lang1,
191191
self.lang2)
192192

193-
for kw in keywords[0]:
194-
theme['concepts'].append({'id': kw})
193+
if key == 'default':
194+
record['properties']['keywords'] = [kw[0] for kw in keywords]
195+
continue
195196

196-
if 'vocabulary' in value:
197-
if 'url' in value['vocabulary']:
198-
theme['scheme'] = value['vocabulary']['url']
199-
elif 'name' in value['vocabulary']:
200-
theme['scheme'] = value['vocabulary']['name']
197+
else:
198+
for kw in keywords[0]:
199+
theme['concepts'].append({'id': kw})
200+
201+
if 'vocabulary' in value:
202+
if 'url' in value['vocabulary']:
203+
theme['scheme'] = value['vocabulary']['url']
204+
elif 'name' in value['vocabulary']:
205+
theme['scheme'] = value['vocabulary']['name']
201206

202-
record['properties']['themes'].append(theme)
207+
record['properties']['themes'].append(theme)
203208

204209
LOGGER.debug('Checking for licensing')
205210
if mcf['identification'].get('license') is not None:

sample.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ identification:
2626
fr: abstract in French
2727
edition: 1.8.0
2828
dates:
29-
creation: 2011-11-11
30-
publication: 2000-09-01T00:00:00Z
29+
creation: 2000-09-01T00:00:00Z
30+
publication: 2001-11-11
3131
keywords:
3232
default:
3333
keywords:

0 commit comments

Comments
 (0)