From f8b39f382c0af5b93bf60325b73c241a8876d8d2 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Thu, 17 Oct 2024 19:17:47 +0200 Subject: [PATCH 1/7] adjusting the xslt for codemeta properties --- xslt/software/xslt-software-Codemeta.xslt | 70 ++++++++++++++--------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/xslt/software/xslt-software-Codemeta.xslt b/xslt/software/xslt-software-Codemeta.xslt index d067db45..ea59b964 100644 --- a/xslt/software/xslt-software-Codemeta.xslt +++ b/xslt/software/xslt-software-Codemeta.xslt @@ -1,9 +1,8 @@ - - - + + @@ -35,17 +35,23 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> + + + + + + - + - + - + @@ -56,11 +62,11 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> - - + + zbmath- - + @@ -101,16 +107,15 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> - - + + + + + + - - - - - @@ -150,9 +155,12 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> - + + schema:PropertyValue + - + + @@ -162,6 +170,14 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> + + schema:PropertyValue + + zbmath- + + + + @@ -169,9 +185,9 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> - + - + @@ -191,19 +207,21 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> - - - + + + + + - + - + From fa317f8bb898b17294c21898b6fa210a465a38bd Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Thu, 17 Oct 2024 19:35:30 +0200 Subject: [PATCH 2/7] adjusting some templates --- xslt/software/xslt-software-Codemeta.xslt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xslt/software/xslt-software-Codemeta.xslt b/xslt/software/xslt-software-Codemeta.xslt index ea59b964..4b535886 100644 --- a/xslt/software/xslt-software-Codemeta.xslt +++ b/xslt/software/xslt-software-Codemeta.xslt @@ -179,9 +179,9 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> - + - + @@ -223,9 +223,9 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> - + - + From 4250617d181ead666e30e13f3f5395ce2bbba6ca Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Thu, 17 Oct 2024 20:03:28 +0200 Subject: [PATCH 3/7] adding new template --- xslt/software/xslt-software-Codemeta.xslt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xslt/software/xslt-software-Codemeta.xslt b/xslt/software/xslt-software-Codemeta.xslt index 4b535886..10313eb5 100644 --- a/xslt/software/xslt-software-Codemeta.xslt +++ b/xslt/software/xslt-software-Codemeta.xslt @@ -27,6 +27,8 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> + + @@ -135,6 +137,11 @@ Made by Shiraz Malla Mohamad member of zbmath Team--> + + + + + From bc03e26a290a92d42921c065f9eb8405f69646c4 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Thu, 17 Oct 2024 20:05:10 +0200 Subject: [PATCH 4/7] adjusting the encoding of the outputfile --- src/zbmath_rest2oai/restApi_software_Json.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/zbmath_rest2oai/restApi_software_Json.py b/src/zbmath_rest2oai/restApi_software_Json.py index 1ceaae33..b2aced0e 100644 --- a/src/zbmath_rest2oai/restApi_software_Json.py +++ b/src/zbmath_rest2oai/restApi_software_Json.py @@ -51,13 +51,13 @@ def process_metadata(csv_file_path, api_url, output_path=None): # Save the modified JSON data to a file output_json_filename = 'output_with_swhid.json' - with open(output_path, 'w') as json_file: + with open(output_path, 'w',encoding='utf-8') as json_file: json.dump(data, json_file, indent=4 , ensure_ascii=False) print(f"Data successfully saved to {output_json_filename}") # Save the output log to a file # output_log_filename = 'process_log.txt' - with open(output_log_filename, 'w') as log_file: + with open(output_log_filename, 'w', encoding='utf-8') as log_file: for log_entry in output_log: log_file.write(log_entry + '\n') print(f"Log successfully saved to {output_log_filename}") @@ -67,7 +67,7 @@ def process_metadata(csv_file_path, api_url, output_path=None): csv_file_path = '../../test/data/software/swh_swmath.csv' # Path to your CSV file -api_url = 'https://api.zbmath.org/v1/software/825' # API URL, can be generalized for any software ID -output_path = '../../test/data/software/software_with_swhid.json' +api_url = 'https://api.zbmath.org/v1/software/4532' # API URL, can be generalized for any software ID +output_path = '../../test/data/software/software_with_swhid_2.json' output_log_filename = '../../test/data/software/logfile.txt' process_metadata(csv_file_path, api_url , output_path) \ No newline at end of file From 273bcd91a88417d158aaf0784d9db8435615f62d Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Thu, 17 Oct 2024 20:06:38 +0200 Subject: [PATCH 5/7] another result from the rest api for software metadata --- test/data/software/software_with_swhid_2.json | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 test/data/software/software_with_swhid_2.json diff --git a/test/data/software/software_with_swhid_2.json b/test/data/software/software_with_swhid_2.json new file mode 100644 index 00000000..6aaeffa4 --- /dev/null +++ b/test/data/software/software_with_swhid_2.json @@ -0,0 +1,143 @@ +{ + "result": { + "articles_count": 150, + "authors": [ + "Jr, Frank E Harrell" + ], + "classification": [ + "62", + "65", + "68", + "91", + "92", + "00", + "20", + "37", + "41", + "60", + "81", + "82", + "83", + "86", + "90", + "93", + "94" + ], + "dependencies": "R; Hmisc (≥ 3.7), survival (≥ 2.36-3)", + "description": "zbMATH Open Web Interface contents unavailable due to conflicting licenses.", + "homepage": "http://cran.r-project.org/web/packages/rms/", + "id": 4532, + "keywords": [], + "license_terms": "GPL (≥ 2)", + "name": "rms", + "operating_systems": null, + "orms_id": null, + "programming_languages": null, + "related_software": [ + { + "id": 771, + "name": "R" + }, + { + "id": 6377, + "name": "SAS" + }, + { + "id": 4364, + "name": "survival" + }, + { + "id": 8159, + "name": "glmnet" + }, + { + "id": 6029, + "name": "Stata" + }, + { + "id": 4490, + "name": "VGAM" + }, + { + "id": 11049, + "name": "ElemStatLearn" + }, + { + "id": 4557, + "name": "ggplot2" + }, + { + "id": 12561, + "name": "ordinal" + }, + { + "id": 18788, + "name": "SAS/STAT" + }, + { + "id": 11008, + "name": "BayesDA" + }, + { + "id": 19105, + "name": "bootstrap" + }, + { + "id": 19099, + "name": "brms" + }, + { + "id": 2892, + "name": "S-PLUS" + }, + { + "id": 4479, + "name": "MASS (R)" + }, + { + "id": 4074, + "name": "UCI-ml" + }, + { + "id": 8068, + "name": "timereg" + }, + { + "id": 4586, + "name": "KernSmooth" + }, + { + "id": 4351, + "name": "CRAN" + }, + { + "id": 20527, + "name": "ordinalNet" + } + ], + "source_code": "https://github.com/cran/rms", + "standard_articles": [], + "zbmath_url": "https://zbmath.org/software/4532" + }, + "status": { + "execution": "successful request", + "execution_bool": true, + "internal_code": "ok", + "last_id": null, + "nr_total_results": 1, + "nr_request_results": 1, + "query_execution_time_in_seconds": 0.10137176513671875, + "status_code": 200, + "time_stamp": "2024-10-17T17:48:07Z" + }, + "swhdeposit:deposit": { + "swhdeposit:reference": { + "swhdeposit:object": { + "@swhid": "swh:1:snp:3f97c8fa7714065b16fa022ae54522c6b783e3a3" + } + }, + "swhdeposit:metadata-provenance": { + "schema:url": "https://staging.swmath.org/" + } + } +} \ No newline at end of file From 614d57eb1fd641bbe5109ab2c2873194e19df87a Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Thu, 17 Oct 2024 20:07:23 +0200 Subject: [PATCH 6/7] the xml file of another software metadata including its swhid --- test/data/software/software_with_swhid_2.xml | 121 +++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 test/data/software/software_with_swhid_2.xml diff --git a/test/data/software/software_with_swhid_2.xml b/test/data/software/software_with_swhid_2.xml new file mode 100644 index 00000000..b8b13d8d --- /dev/null +++ b/test/data/software/software_with_swhid_2.xml @@ -0,0 +1,121 @@ + + + 150 + Jr, Frank E Harrell + 62 + 65 + 68 + 91 + 92 + 00 + 20 + 37 + 41 + 60 + 81 + 82 + 83 + 86 + 90 + 93 + 94 + + + + + + https://staging.swmath.org/ + + + R; Hmisc (≥ 3.7), survival (≥ 2.36-3) + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + http://cran.r-project.org/web/packages/rms/ + 4532 + GPL (≥ 2) + rms + None + None + None + + 771 + R + + + 6377 + SAS + + + 4364 + survival + + + 8159 + glmnet + + + 6029 + Stata + + + 4490 + VGAM + + + 11049 + ElemStatLearn + + + 4557 + ggplot2 + + + 12561 + ordinal + + + 18788 + SAS/STAT + + + 11008 + BayesDA + + + 19105 + bootstrap + + + 19099 + brms + + + 2892 + S-PLUS + + + 4479 + MASS (R) + + + 4074 + UCI-ml + + + 8068 + timereg + + + 4586 + KernSmooth + + + 4351 + CRAN + + + 20527 + ordinalNet + + https://github.com/cran/rms + https://zbmath.org/software/4532 + From cae54723240ffeffeeb3d451c54832457fecdef6 Mon Sep 17 00:00:00 2001 From: shirazos7 Date: Thu, 17 Oct 2024 20:16:32 +0200 Subject: [PATCH 7/7] adjusting the transformation of metadata --- test/data/software/Test_Result_Codemeta.xml | 225 ++++++++++---------- 1 file changed, 112 insertions(+), 113 deletions(-) diff --git a/test/data/software/Test_Result_Codemeta.xml b/test/data/software/Test_Result_Codemeta.xml index a5a7a05f..61fe74d8 100644 --- a/test/data/software/Test_Result_Codemeta.xml +++ b/test/data/software/Test_Result_Codemeta.xml @@ -1,9 +1,10 @@ - + - zbmath-825 + zbmath-825 @@ -12,31 +13,25 @@ https://staging.swmath.org/ - - - Developers - The Sage - - - Stein - William - - - Joyner - David - - - Kohel - David - - - Cremona - John - - - Eröcal - Burçin - + + Developers, The Sage + The Sage + Developers + Stein, William + William + Stein + Joyner, David + David + Joyner + Kohel, David + David + Kohel + Cremona, John + John + Cremona + Eröcal, Burçin + Burçin + Eröcal SageMath zbMATH Open Web Interface contents unavailable due to conflicting licenses. @@ -49,70 +44,81 @@ Open Source Interfaces None - 255 + + schema:PropertyValue + 255 + None - 05 - 11 - 14 - 20 - 68 - 00 - 01 - 03 - 06 - 12 - 13 - 15 - 16 - 17 - 18 - 19 - 22 - 26 - 28 - 30 - 31 - 32 - 33 - 34 - 35 - 37 - 39 - 40 - 41 - 42 - 43 - 44 - 46 - 47 - 49 - 51 - 52 - 53 - 54 - 55 - 57 - 58 - 60 - 62 - 65 - 70 - 74 - 76 - 78 - 80 - 81 - 82 - 83 - 85 - 86 - 90 - 91 - 92 - 93 - 94 - 97 - 2775 + + schema:PropertyValue + zbmath-825 + + + 05 + 11 + 14 + 20 + 68 + 00 + 01 + 03 + 06 + 12 + 13 + 15 + 16 + 17 + 18 + 19 + 22 + 26 + 28 + 30 + 31 + 32 + 33 + 34 + 35 + 37 + 39 + 40 + 41 + 42 + 43 + 44 + 46 + 47 + 49 + 51 + 52 + 53 + 54 + 55 + 57 + 58 + 60 + 62 + 65 + 70 + 74 + 76 + 78 + 80 + 81 + 82 + 83 + 85 + 86 + 90 + 91 + 92 + 93 + 94 + 97 + + + 2829 + Magma 540 @@ -155,42 +161,35 @@ SciPy 6293 - - + 7045592 - zbMATH Open Web Interface contents unavailable due to conflicting licenses. - zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. 2019 - 6418360 - zbMATH Open Web Interface contents unavailable due to conflicting licenses. - zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. 2015 - 6532438 - zbMATH Open Web Interface contents unavailable due to conflicting licenses. - zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. 2013 - 6462232 - zbMATH Open Web Interface contents unavailable due to conflicting licenses. - zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. 2013 - 6114556 - zbMATH Open Web Interface contents unavailable due to conflicting licenses. - zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. 2012 - 5785538 - zbMATH Open Web Interface contents unavailable due to conflicting licenses. - zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. 2010 - 5380273 - zbMATH Open Web Interface contents unavailable due to conflicting licenses. - zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. + zbMATH Open Web Interface contents unavailable due to conflicting licenses. 2008 - + https://zbmath.org/software/825