Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add uri reference which is populated from dataseturi or uricode #1029

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading