Skip to content

Commit 3042655

Browse files
committed
AV-2560: Add field to groups for setting EU data theme
1 parent 48ea767 commit 3042655

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

ckan/ckanext/ckanext-ytp_main/ckanext/ytp/dcat.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,13 @@ def graph_from_dataset(self, dataset_dict, dataset_ref):
467467
g.add((theme, RDF.type, SKOS.Concept))
468468
g.add((dataset_ref, DCAT.theme, theme))
469469

470+
# Optional EU data theme
471+
eu_theme_url = group_dict.get('eu_theme')
472+
if eu_theme_url:
473+
eu_theme = URIRef(eu_theme_url)
474+
g.add((eu_theme, RDF.type, SKOS.Concept))
475+
g.add((dataset_ref, DCAT.theme, eu_theme))
476+
470477
group_titles = (t for t in list(get_dict(group_dict, 'title_translated').values()) if t)
471478
for title in group_titles:
472479
g.add((theme, SKOS.prefLabel, Literal(title)))

ckan/ckanext/ckanext-ytp_main/ckanext/ytp/schemas/group.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
"label": "Description",
3737
"display_snippet": null
3838
},
39+
{
40+
"field_name": "eu_theme",
41+
"label": "EU data theme",
42+
"preset": "eu_theme",
43+
"required": false
44+
},
3945
{
4046
"field_name": "image_url",
4147
"label": "Image URL",

ckan/ckanext/ckanext-ytp_main/ckanext/ytp/schemas/presets.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,30 @@
261261
"display_snippet": "date.html",
262262
"validators": "scheming_required isodate from_date_is_before_until_date convert_to_json_if_date"
263263
}
264+
},
265+
{
266+
"preset_name": "eu_theme",
267+
"values": {
268+
"form_snippet": "select.html",
269+
"display_snippet": "select.html",
270+
"validators": "scheming_required scheming_choices",
271+
"choices": [
272+
{"value": "http://publications.europa.eu/resource/authority/data-theme/ECON", "label": "Economy and finance"},
273+
{"value": "http://publications.europa.eu/resource/authority/data-theme/AGRI", "label": "Agriculture, fisheries, forestry and food"},
274+
{"value": "http://publications.europa.eu/resource/authority/data-theme/GOVE", "label": "Government and public sector"},
275+
{"value": "http://publications.europa.eu/resource/authority/data-theme/ENER", "label": "Energy"},
276+
{"value": "http://publications.europa.eu/resource/authority/data-theme/ENVI", "label": "Environment"},
277+
{"value": "http://publications.europa.eu/resource/authority/data-theme/EDUC", "label": "Education, culture and sport"},
278+
{"value": "http://publications.europa.eu/resource/authority/data-theme/JUST", "label": "Justice, legal system and public safety"},
279+
{"value": "http://publications.europa.eu/resource/authority/data-theme/REGI", "label": "Regions and cities"},
280+
{"value": "http://publications.europa.eu/resource/authority/data-theme/INTR", "label": "International issues"},
281+
{"value": "http://publications.europa.eu/resource/authority/data-theme/HEAL", "label": "Health"},
282+
{"value": "http://publications.europa.eu/resource/authority/data-theme/SOCI", "label": "Population and society"},
283+
{"value": "http://publications.europa.eu/resource/authority/data-theme/OP_DATPRO", "label": "Provisional data"},
284+
{"value": "http://publications.europa.eu/resource/authority/data-theme/TECH", "label": "Science and technology"},
285+
{"value": "http://publications.europa.eu/resource/authority/data-theme/TRAN", "label": "Transport"}
286+
]
287+
}
264288
}
265289
]
266290
}

0 commit comments

Comments
 (0)