Skip to content

Commit

Permalink
add uri reference which is populated from dataseturi or uricode
Browse files Browse the repository at this point in the history
  • Loading branch information
pvgenuchten committed Oct 3, 2024
1 parent 6bb4520 commit 2763400
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions etc/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions pycsw/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions pycsw/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pycsw/core/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 8 additions & 0 deletions pycsw/ogc/api/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Binary file modified tests/functionaltests/suites/cite/data/cite.db
Binary file not shown.

0 comments on commit 2763400

Please sign in to comment.