From 2807f179ba82a5e34711ab959c4c73f1bb61edf2 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 14 Mar 2019 22:15:10 +0200 Subject: [PATCH] Update notes for 2019-03-14 --- content/posts/2019-03.md | 25 +++++++++++++++++++++++++ docs/2019-03/index.html | 33 ++++++++++++++++++++++++++++++--- docs/sitemap.xml | 10 +++++----- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/content/posts/2019-03.md b/content/posts/2019-03.md index 4f1b102fd..7475a31a9 100644 --- a/content/posts/2019-03.md +++ b/content/posts/2019-03.md @@ -154,6 +154,31 @@ if(isBlank(value), 'PLANT PRODUCTION & HEALTH', value + '||PLANT PRODUCTION & HE - CGSpace had the same issue with blank items like earlier this month and I restarted Tomcat to fix it - Create a pull request to change Swaziland to Eswatini and Macedonia to North Macedonia ([#414](https://github.com/ilri/DSpace/pull/414)) - I see thirty-six items using Swaziland country metadata, and Peter says we should change only those from 2018 and 2019 + - I think that I could get the resource IDs from SQL and then export them using `dspace metadata-export`... +- This is a bit ugly, but it works (using the [DSpace 5 SQL helper function](https://wiki.duraspace.org/display/DSPACE/Helper+SQL+functions+for+DSpace+5) to resolve ID to handle): + +``` +for id in $(psql -U postgres -d dspacetest -h localhost -c "SELECT resource_id FROM metadatavalue WHERE resource_type_id=2 AND metadata_field_id=228 AND text_value LIKE '%SWAZILAND%'" | grep -oE '[0-9]{3,}'); do + + echo "Getting handle for id: ${id}" + + handle=$(psql -U postgres -d dspacetest -h localhost -c "SELECT ds5_item2itemhandle($id)" | grep -oE '[0-9]{5}/[0-9]+') + + ~/dspace/bin/dspace metadata-export -f /tmp/${id}.csv -i $handle + +done +``` + +- Then I couldn't figure out a clever way to join all the CSVs, so I just grepped them to find the IDs with dates from 2018 and 2019 and there are apparently only three: + +``` +$ grep -oE '201[89]' /tmp/*.csv | sort -u +/tmp/94834.csv:2018 +/tmp/95615.csv:2018 +/tmp/96747.csv:2018 +``` + +- And looking at those items more closely, only one of them has an *issue date* of after 2018-04, so I will only update that one (as the countrie's name only changed in 2018-04) - Run all system updates and reboot linode20 - Follow up with Felix from Earlham to see if he's done testing DSpace Test with COPO so I can re-sync the server from CGSpace diff --git a/docs/2019-03/index.html b/docs/2019-03/index.html index 3ca5bb7a7..b92ba8ea5 100644 --- a/docs/2019-03/index.html +++ b/docs/2019-03/index.html @@ -25,7 +25,7 @@ I think I will need to ask Udana to re-copy and paste the abstracts with more ca - + @@ -55,9 +55,9 @@ I think I will need to ask Udana to re-copy and paste the abstracts with more ca "@type": "BlogPosting", "headline": "March, 2019", "url": "https://alanorth.github.io/cgspace-notes/2019-03/", - "wordCount": "1300", + "wordCount": "1471", "datePublished": "2019-03-01T12:16:30+01:00", - "dateModified": "2019-03-12T22:47:45+02:00", + "dateModified": "2019-03-14T20:18:29+02:00", "author": { "@type": "Person", "name": "Alan Orth" @@ -320,7 +320,34 @@ UPDATE 44 +
  • This is a bit ugly, but it works (using the DSpace 5 SQL helper function to resolve ID to handle):
  • + + +
    for id in $(psql -U postgres -d dspacetest -h localhost -c "SELECT resource_id FROM metadatavalue WHERE resource_type_id=2 AND metadata_field_id=228 AND text_value LIKE '%SWAZILAND%'" | grep -oE '[0-9]{3,}'); do
    +
    +    echo "Getting handle for id: ${id}"
    +
    +    handle=$(psql -U postgres -d dspacetest -h localhost -c "SELECT ds5_item2itemhandle($id)" | grep -oE '[0-9]{5}/[0-9]+')
    +
    +    ~/dspace/bin/dspace metadata-export -f /tmp/${id}.csv -i $handle
    +
    +done
    +
    + + + +
    $ grep -oE '201[89]' /tmp/*.csv | sort -u
    +/tmp/94834.csv:2018
    +/tmp/95615.csv:2018
    +/tmp/96747.csv:2018
    +
    + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index a11768aee..60f5431bc 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -4,7 +4,7 @@ https://alanorth.github.io/cgspace-notes/2019-03/ - 2019-03-12T22:47:45+02:00 + 2019-03-14T20:18:29+02:00 @@ -214,7 +214,7 @@ https://alanorth.github.io/cgspace-notes/ - 2019-03-12T22:47:45+02:00 + 2019-03-14T20:18:29+02:00 0 @@ -225,7 +225,7 @@ https://alanorth.github.io/cgspace-notes/tags/notes/ - 2019-03-12T22:47:45+02:00 + 2019-03-14T20:18:29+02:00 0 @@ -237,13 +237,13 @@ https://alanorth.github.io/cgspace-notes/posts/ - 2019-03-12T22:47:45+02:00 + 2019-03-14T20:18:29+02:00 0 https://alanorth.github.io/cgspace-notes/tags/ - 2019-03-12T22:47:45+02:00 + 2019-03-14T20:18:29+02:00 0