diff --git a/content/post/2017-02.md b/content/post/2017-02.md index f96194810..70e6c9902 100644 --- a/content/post/2017-02.md +++ b/content/post/2017-02.md @@ -100,3 +100,14 @@ UPDATE 58193 ``` - Seems to work fine! +- I noticed a few items that have incorrect DOI links (`dc.identifier.doi`), and after looking in the database I see there are over 100 that are missing the scheme or are just plain wrong: + +``` +dspace=# select distinct text_value from metadatavalue where resource_type_id=2 and metadata_field_id=220 and text_value not like 'http%://%'; +``` + +- This will replace any that begin with `10.`: + +``` +dspace=# update metadatavalue set text_value = regexp_replace(text_value, '(^10\..+$)', 'https://dx.doi.org/\1') where metadata_field_id IN (select metadata_field_id from metadatafieldregistry where element = 'identifier' and qualifier = 'doi') and text_value like '10.%'; +``` diff --git a/public/2017-02/index.html b/public/2017-02/index.html index d0c73a997..022ed9ecd 100644 --- a/public/2017-02/index.html +++ b/public/2017-02/index.html @@ -92,7 +92,7 @@ Looks like we’ll be using cg.identifier.ccafsprojectpii as the field name "headline": "February, 2017", "url": "https://alanorth.github.io/cgspace-notes/2017-02/", - "wordCount": "629", + "wordCount": "713", "datePublished": "2017-02-07T07:04:52-08:00", @@ -286,8 +286,19 @@ UPDATE 58193 +
dspace=# select distinct text_value from metadatavalue where resource_type_id=2 and metadata_field_id=220 and text_value not like 'http%://%';
+
+ + + +
dspace=# update metadatavalue set text_value = regexp_replace(text_value, '(^10\..+$)', 'https://dx.doi.org/\1') where metadata_field_id IN (select metadata_field_id from metadatafieldregistry where element = 'identifier' and qualifier = 'doi') and text_value like '10.%';
+
+ diff --git a/public/index.xml b/public/index.xml index 5c0867aa6..497b0e0d9 100644 --- a/public/index.xml +++ b/public/index.xml @@ -134,7 +134,18 @@ UPDATE 58193 <ul> <li>Seems to work fine!</li> -</ul> +<li>I noticed a few items that have incorrect DOI links (<code>dc.identifier.doi</code>), and after looking in the database I see there are over 100 that are missing the scheme or are just plain wrong:</li> +</ul> + +<pre><code>dspace=# select distinct text_value from metadatavalue where resource_type_id=2 and metadata_field_id=220 and text_value not like 'http%://%'; +</code></pre> + +<ul> +<li>This will replace any that begin with <code>10.</code>:</li> +</ul> + +<pre><code>dspace=# update metadatavalue set text_value = regexp_replace(text_value, '(^10\..+$)', 'https://dx.doi.org/\1') where metadata_field_id IN (select metadata_field_id from metadatafieldregistry where element = 'identifier' and qualifier = 'doi') and text_value like '10.%'; +</code></pre> diff --git a/public/post/index.xml b/public/post/index.xml index e47b59d34..b87480216 100644 --- a/public/post/index.xml +++ b/public/post/index.xml @@ -134,7 +134,18 @@ UPDATE 58193 <ul> <li>Seems to work fine!</li> -</ul> +<li>I noticed a few items that have incorrect DOI links (<code>dc.identifier.doi</code>), and after looking in the database I see there are over 100 that are missing the scheme or are just plain wrong:</li> +</ul> + +<pre><code>dspace=# select distinct text_value from metadatavalue where resource_type_id=2 and metadata_field_id=220 and text_value not like 'http%://%'; +</code></pre> + +<ul> +<li>This will replace any that begin with <code>10.</code>:</li> +</ul> + +<pre><code>dspace=# update metadatavalue set text_value = regexp_replace(text_value, '(^10\..+$)', 'https://dx.doi.org/\1') where metadata_field_id IN (select metadata_field_id from metadatafieldregistry where element = 'identifier' and qualifier = 'doi') and text_value like '10.%'; +</code></pre> diff --git a/public/tags/notes/index.xml b/public/tags/notes/index.xml index ef79635c9..2ca5f9727 100644 --- a/public/tags/notes/index.xml +++ b/public/tags/notes/index.xml @@ -133,7 +133,18 @@ UPDATE 58193 <ul> <li>Seems to work fine!</li> -</ul> +<li>I noticed a few items that have incorrect DOI links (<code>dc.identifier.doi</code>), and after looking in the database I see there are over 100 that are missing the scheme or are just plain wrong:</li> +</ul> + +<pre><code>dspace=# select distinct text_value from metadatavalue where resource_type_id=2 and metadata_field_id=220 and text_value not like 'http%://%'; +</code></pre> + +<ul> +<li>This will replace any that begin with <code>10.</code>:</li> +</ul> + +<pre><code>dspace=# update metadatavalue set text_value = regexp_replace(text_value, '(^10\..+$)', 'https://dx.doi.org/\1') where metadata_field_id IN (select metadata_field_id from metadatafieldregistry where element = 'identifier' and qualifier = 'doi') and text_value like '10.%'; +</code></pre>