From 5602be49610fac3db55b50cbc631b9672a0ec678 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Tue, 6 May 2025 17:54:40 +0200 Subject: [PATCH 1/5] adjust the code to add a new set for datacite --- src/zbmath_rest2oai/get_sets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/zbmath_rest2oai/get_sets.py b/src/zbmath_rest2oai/get_sets.py index 6d1ea865..750fec61 100644 --- a/src/zbmath_rest2oai/get_sets.py +++ b/src/zbmath_rest2oai/get_sets.py @@ -10,7 +10,8 @@ def get_sets(): mscs = {'JFM': 'JFM: Jahrbuch für Mathematik', 'openaire': 'openaire Required set for OpenAIRE, cf.' + 'https://guidelines.openaire.eu/en/latest/literature' - + '/use_of_oai_pmh.html'} + + '/use_of_oai_pmh.html', + 'datacite': 'Datacite: for metadata supported with Doi and arXiv identifiers'} for result in results: code = result['code'][:2] mscs[code] = code + '-XX:' + result['short_title'] From cce1575f9ac58ce824610e3e7a7a73511b7a2ab1 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Tue, 6 May 2025 18:17:28 +0200 Subject: [PATCH 2/5] a function to filter the records ( doi and arxiv ) for datacite and add them to the set --- src/zbmath_rest2oai/getAsXml.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/zbmath_rest2oai/getAsXml.py b/src/zbmath_rest2oai/getAsXml.py index 5dfc7388..948939c0 100644 --- a/src/zbmath_rest2oai/getAsXml.py +++ b/src/zbmath_rest2oai/getAsXml.py @@ -69,6 +69,14 @@ def add_software(result): return zbmath_url.startswith("https://zbmath.org/software/") +def datacite_records(result: dict) -> bool: + links = result.get("links", []) + for link in links: + if link.get("type") in ("doi", "arxiv") and link.get("identifier"): + return True + return False + + def extract_tags(result): tags = [] for msc in result.get('msc', []): @@ -88,6 +96,9 @@ def extract_tags(result): if add_software(result): tags.append('openaire') + if datacite_records(result): + tags.append('datacite') + return tags From 9187dfecdcaeab1f16fbb46f1dd1f906b1e565b9 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Tue, 6 May 2025 18:30:40 +0200 Subject: [PATCH 3/5] adjust the mscs to have a better scripting for each set --- src/zbmath_rest2oai/get_sets.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/zbmath_rest2oai/get_sets.py b/src/zbmath_rest2oai/get_sets.py index 750fec61..9121ccf0 100644 --- a/src/zbmath_rest2oai/get_sets.py +++ b/src/zbmath_rest2oai/get_sets.py @@ -7,11 +7,17 @@ def get_sets(): headers = {'Accept': 'application/json'} r = requests.get(URL, headers=headers) results = r.json()['result'] - mscs = {'JFM': 'JFM: Jahrbuch für Mathematik', - 'openaire': 'openaire Required set for OpenAIRE, cf.' - + 'https://guidelines.openaire.eu/en/latest/literature' - + '/use_of_oai_pmh.html', - 'datacite': 'Datacite: for metadata supported with Doi and arXiv identifiers'} + mscs = { + 'JFM': 'JFM: Jahrbuch für Mathematik', + 'openaire': ('openaire Required set for OpenAIRE, cf.' + 'https://guidelines.openaire.eu/en/latest/literature' + '/use_of_oai_pmh.html'), + 'datacite': ( + 'Datacite: for metadata supported with Doi and ' + 'arXiv identifiers' + ) + } + for result in results: code = result['code'][:2] mscs[code] = code + '-XX:' + result['short_title'] From cdb8f5f66bdbd45677fedf997b8a595258a91656 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Tue, 6 May 2025 18:40:15 +0200 Subject: [PATCH 4/5] adding datacite to the tags in the unittest --- test/test_extract_tags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_extract_tags.py b/test/test_extract_tags.py index 85cac908..89896f61 100644 --- a/test/test_extract_tags.py +++ b/test/test_extract_tags.py @@ -12,7 +12,7 @@ def test_jfm_doc(): 'https://api.zbmath.org/v1/document/_structured_search?page=0&results_per_page=10&zbmath%20id=2500495', headers=headers) real_tags = extract_tags(r.json()['result'][0]) - assert real_tags == ['11', 'JFM'] + assert real_tags == ['11', 'JFM', 'datacite'] @staticmethod def test_software(): From 5b82ba92bf4dc8cab48afab569c4475ab95fa8c8 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Tue, 6 May 2025 18:44:28 +0200 Subject: [PATCH 5/5] update the length of sets from 65 to 66 in the unittest --- test/test_get_sets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_get_sets.py b/test/test_get_sets.py index e4142544..3140293d 100644 --- a/test/test_get_sets.py +++ b/test/test_get_sets.py @@ -7,5 +7,5 @@ class PlainXmlTest(unittest.TestCase): @staticmethod def test_getSets(): real_sets = get_sets() - assert len(real_sets) == 65 + assert len(real_sets) == 66 assert real_sets['14'] == '14-XX:Algebraic geometry'