Skip to content

Commit

Permalink
Merge ee42809 into fd54fcd
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyDo committed Sep 13, 2019
2 parents fd54fcd + ee42809 commit 339d01d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
26 changes: 26 additions & 0 deletions sql/migrations/2019-09-13/update_identifiers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BEGIN;
-- (BB-304) Update librarything author regex to allow for their disambiguation system (librarything.com/author/nyebill-1 and librarything.com/author/nyebill-2 for example)
UPDATE "bookbrainz"."identifier_type" SET "detection_regex" = '^(?:https?:\/\/)?(?:w{3}\.)?librarything\.com\/author\/(\S+)', "validation_regex" = '(\S+)$' WHERE "id" = '15';

-- (BB-220) Update ISNI detection regexp to allow for optional "www." in the address.
UPDATE "bookbrainz"."identifier_type" SET "detection_regex" = '^(?:https?:\/\/)?(?:w{3}\.)?isni\.org\/isni\/((?:\d ?){15}[X\d])' WHERE "id" = '13';


INSERT INTO "bookbrainz"."identifier_type" ("id", "label", "description", "detection_regex", "validation_regex", "display_template", "entity_type", "parent_id", "child_order", "deprecated")
VALUES
-- (BB-306)
('22', 'Archive.org ID', 'The ID for an archive.org text corresponding to a BookBrainz Edition', 'archive\.org\/details\/(\S+)', '\S+$', 'Placeholder Template', 'Edition', NULL, '0', 'f'),
-- (BB-305)
('23', 'OpenLibrary Author ID', 'The ID for an OpenLibrary Author corresponding to a BookBrainz Author.', 'openlibrary\.org\/authors\/(OL\d+?A)', 'OL\d+?A$', 'Placeholder Template', 'Author', NULL, '0', 'f'),
-- (BB-280)
('24', 'LCCN', 'The Library of Congress Control Number corresponding to a BookBrainz Edition', '(lccn\.loc\.gov\/([a-zA-Z]{0,3}\d{6,10})|([a-zA-Z]{1,3}\d{6,10}))', '^[a-zA-Z]{0,3}\d{6,10}$', 'Placeholder Template', 'Edition', NULL, '0', 'f'),
-- (BB-262)
('25', 'ORCID', 'Open Researcher and Contributor ID corresponding to a BookBrainz Author', '(?:ORCID:\s?|(?:https?:\/\/)?orcid\.org\/)?((?:\d{4}-){3}\d{3}[\dX])', '^(?:\d{4}-){3}\d{3}[\dX]$', 'Placeholder Template', 'Author', NULL, '0', 'f'),
-- (BB-193)
('26', 'OCN/Worldcat ID', 'OCLC Control Number corresponding to a BookBrainz Edition', '(?:https?://)?(?:w{3}\.)?worldcat\.org/title/.+/oclc/(\d+)', '^[1-9]\d*$', 'Placeholder Template', 'Edition', NULL, '0', 'f'),
-- (BB-194)
('27', 'Goodreads Author ID', 'Goodreads author ID that corresponds to a BookBrainz Author', '(?:https?:\/\/)?(?:w{3}\.)?goodreads\.com\/author\/show\/(\d+)(?:[-.]\w+)?', '^[1-9]\d*$', 'Placeholder Template', 'Author', NULL, '0', 'f'),
('28', 'Goodreads Book ID', 'Goodreads book ID that corresponds to a BookBrainz Edition', '(?:https?:\/\/)?(?:w{3}\.)?goodreads\.com\/book\/show\/(\d+)(?:[-.]\S+)?', '^[1-9]\d*$', 'Placeholder Template', 'Edition', NULL, '0', 'f')
;

COMMIT;
22 changes: 22 additions & 0 deletions src/client/components/pages/entities/identifiers-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import PropTypes from 'prop-types';
import React from 'react';


function IdentifierLink({typeId, value}) {
let link;
// All identifiers type IDs have been taken from database.
Expand Down Expand Up @@ -77,6 +78,27 @@ function IdentifierLink({typeId, value}) {
case 21: // @Wikidata ID: The ID for the Wikidata page corresponding to a BookBrainz Work.
link = `https://www.wikidata.org/wiki/${value}`;
break;
case 22:
link = `https://www.archive.org/details/${value}`;
break;
case 23:
link = `https://www.openlibrary.org/authors/${value}`;
break;
case 24:
link = `https://www.lccn.loc.gov/${value}`;
break;
case 25:
link = `https://www.orcid.org/${value}`;
break;
case 26:
link = `https://www.worldcat.org/oclc/${value}`;
break;
case 27:
link = `https://www.goodreads.com/author/show/${value}`;
break;
case 28:
link = `https://www.goodreads.com/book/show/${value}`;
break;
default:
return value;
}
Expand Down

0 comments on commit 339d01d

Please sign in to comment.