Skip to content

Commit

Permalink
Include @id in JSON-LD output
Browse files Browse the repository at this point in the history
  • Loading branch information
marksparkza committed Nov 7, 2023
1 parent 3b06ac6 commit 6f396e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions odp/catalog/mims.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def create_published_record(self, record_model: RecordModel) -> PublishedRecordM
metadata={
'@context': 'https://schema.org/',
'@type': 'Dataset',
'@id': url,
'name': title,
'description': abstract,
'identifier': identifier,
Expand Down
7 changes: 5 additions & 2 deletions test/api/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def test_redirect_to(
'SchemaOrg.Dataset': {
'@context': 'https://schema.org/',
'@type': 'Dataset',
# '@id': dynamic,
'name': metadata_examples['SAEON.ISO19115']['title'],
'description': metadata_examples['SAEON.ISO19115']['abstract'],
'license': metadata_examples['SAEON.ISO19115']['constraints'][0]['rightsURI'],
Expand Down Expand Up @@ -255,8 +256,10 @@ def assert_metadata_record(schema_id):
expected_metadata['keywords'] = [
s['subject'] for s in metadata_examples['SAEON.DataCite4']['subjects']
]
expected_metadata['url'] = ('http://odp.catalog/mims/'
f'{example_record.doi if example_record.doi else example_record.id}')
expected_metadata['@id'] = expected_metadata['url'] = (
'http://odp.catalog/mims/'
f'{example_record.doi if example_record.doi else example_record.id}'
)
else:
if example_record.doi:
expected_metadata |= {'doi': example_record.doi}
Expand Down

0 comments on commit 6f396e4

Please sign in to comment.