diff --git a/etc/mappings.py b/etc/mappings.py index a394fb438..7ed8ef798 100644 --- a/etc/mappings.py +++ b/etc/mappings.py @@ -67,6 +67,7 @@ 'pycsw:OrganizationName': 'organization', 'pycsw:SecurityConstraints': 'securityconstraints', 'pycsw:ParentIdentifier': 'parentidentifier', + 'pycsw:URI': 'uri', 'pycsw:TopicCategory': 'topicategory', 'pycsw:ResourceLanguage': 'resourcelanguage', 'pycsw:GeographicDescriptionCode': 'geodescode', diff --git a/pycsw/core/config.py b/pycsw/core/config.py index ab8ac7768..9eebfd657 100644 --- a/pycsw/core/config.py +++ b/pycsw/core/config.py @@ -144,6 +144,7 @@ def __init__(self, prefix='csw30'): 'pycsw:PublicationDate': 'date_publication', 'pycsw:OrganizationName': 'organization', 'pycsw:SecurityConstraints': 'securityconstraints', + 'pycsw:URI': 'uri', 'pycsw:ParentIdentifier': 'parentidentifier', 'pycsw:TopicCategory': 'topicategory', 'pycsw:ResourceLanguage': 'resourcelanguage', diff --git a/pycsw/core/metadata.py b/pycsw/core/metadata.py index bd9692f0d..a2bb1e6f9 100644 --- a/pycsw/core/metadata.py +++ b/pycsw/core/metadata.py @@ -1399,6 +1399,10 @@ def _parse_iso(context, repos, exml): _set(context, recobj, 'pycsw:Language', md.language or md.languagecode) _set(context, recobj, 'pycsw:Type', md.hierarchy) _set(context, recobj, 'pycsw:ParentIdentifier', md.parentidentifier) + if hasattr(md, 'dataseturi') and md.dataseturi not in [None,'']: + _set(context, recobj, 'pycsw:URI', md.dataseturi) + elif md_identification and hasattr(md_identification, 'uricode') and len(md_identification.uricode) > 0: + _set(context, recobj, 'pycsw:URI', ','.join(md_identification.uricode)) _set(context, recobj, 'pycsw:Date', md.datestamp) _set(context, recobj, 'pycsw:Modified', md.datestamp) _set(context, recobj, 'pycsw:Source', md.dataseturi) diff --git a/pycsw/core/repository.py b/pycsw/core/repository.py index d074d4a94..e17e81579 100644 --- a/pycsw/core/repository.py +++ b/pycsw/core/repository.py @@ -807,6 +807,7 @@ def setup(database, table, create_sfsql_tables=True, postgis_geometry_column='wk Column('keywordstype', Text, index=True), Column('themes', Text, index=True), Column('parentidentifier', Text, index=True), + Column('uri', Text, index=True), Column('relation', Text, index=True), Column('time_begin', Text, index=True), Column('time_end', Text, index=True), diff --git a/pycsw/ogc/api/records.py b/pycsw/ogc/api/records.py index 49ea2c12a..6e79886a5 100644 --- a/pycsw/ogc/api/records.py +++ b/pycsw/ogc/api/records.py @@ -1293,6 +1293,14 @@ def record2json(record, url, collection, mode='ogcapi-records'): 'href': f'{url}/collections/{collection}/items/{record.identifier}' }) + if hasattr(record, 'uri') and record.uri not in [None,'']: + record_dict['links'].append({ + 'rel': 'alternate', + 'name': 'URI', + 'description': 'original URI of the record', + 'href': record.uri + }) + record_dict['links'].append({ 'rel': 'collection', 'type': 'application/json', diff --git a/tests/functionaltests/suites/cite/data/cite.db b/tests/functionaltests/suites/cite/data/cite.db index abb962db5..c4cbe60c3 100644 Binary files a/tests/functionaltests/suites/cite/data/cite.db and b/tests/functionaltests/suites/cite/data/cite.db differ