Add AVefi as norm data repository for tags
More information: https://www.av-efi.net/
This commit is contained in:
@@ -56,6 +56,7 @@ final class MDNodaRepositoriesSet extends MDValueSet {
|
|||||||
public const REPOSITORIES_TAG = [
|
public const REPOSITORIES_TAG = [
|
||||||
'aat',
|
'aat',
|
||||||
'ackerbau',
|
'ackerbau',
|
||||||
|
'avefi',
|
||||||
'allgemein',
|
'allgemein',
|
||||||
'col',
|
'col',
|
||||||
'bne',
|
'bne',
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
case allgemein; // General link to a good source
|
case allgemein; // General link to a good source
|
||||||
case aat;
|
case aat;
|
||||||
case ackerbau;
|
case ackerbau;
|
||||||
|
case avefi;
|
||||||
case bne;
|
case bne;
|
||||||
case bnf;
|
case bnf;
|
||||||
case col;
|
case col;
|
||||||
@@ -57,6 +58,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
'AAT-ID',
|
'AAT-ID',
|
||||||
'aat' => self::aat,
|
'aat' => self::aat,
|
||||||
'ackerbau' => self::ackerbau,
|
'ackerbau' => self::ackerbau,
|
||||||
|
'avefi' => self::avefi,
|
||||||
'bne' => self::bne,
|
'bne' => self::bne,
|
||||||
'bnf' => self::bnf,
|
'bnf' => self::bnf,
|
||||||
'col',
|
'col',
|
||||||
@@ -156,6 +158,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => 'allgemein', // General link to a good source
|
self::allgemein => 'allgemein', // General link to a good source
|
||||||
self::aat => 'aat',
|
self::aat => 'aat',
|
||||||
self::ackerbau => 'ackerbau',
|
self::ackerbau => 'ackerbau',
|
||||||
|
self::avefi => 'avefi',
|
||||||
self::bne => 'bne',
|
self::bne => 'bne',
|
||||||
self::bnf => 'bnf',
|
self::bnf => 'bnf',
|
||||||
self::col => 'col',
|
self::col => 'col',
|
||||||
@@ -199,6 +202,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => 'General', // General link to a good source
|
self::allgemein => 'General', // General link to a good source
|
||||||
self::aat => 'Art & Architecture Thesaurus (AAT)',
|
self::aat => 'Art & Architecture Thesaurus (AAT)',
|
||||||
self::ackerbau => 'Ackerbau-Thesaurus',
|
self::ackerbau => 'Ackerbau-Thesaurus',
|
||||||
|
self::avefi => 'AVefi',
|
||||||
self::bne => 'Biblioteca Nacional de España (BNE)',
|
self::bne => 'Biblioteca Nacional de España (BNE)',
|
||||||
self::bnf => 'Bibliothèque nationale de France (BNF)',
|
self::bnf => 'Bibliothèque nationale de France (BNF)',
|
||||||
self::col => 'Catalogue of Life',
|
self::col => 'Catalogue of Life',
|
||||||
@@ -242,6 +246,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => '',
|
self::allgemein => '',
|
||||||
self::aat => 'https://vocab.getty.edu/page/aat/',
|
self::aat => 'https://vocab.getty.edu/page/aat/',
|
||||||
self::ackerbau => 'https://term.museum-digital.de/ackerbau/tag/',
|
self::ackerbau => 'https://term.museum-digital.de/ackerbau/tag/',
|
||||||
|
self::avefi => 'https://hdl.handle.net/',
|
||||||
self::bne => 'http://datos.bne.es/persona/',
|
self::bne => 'http://datos.bne.es/persona/',
|
||||||
self::bnf => "https://catalogue.bnf.fr/ark:/12148/cb",
|
self::bnf => "https://catalogue.bnf.fr/ark:/12148/cb",
|
||||||
self::col => 'https://www.catalogueoflife.org/data/taxon/',
|
self::col => 'https://www.catalogueoflife.org/data/taxon/',
|
||||||
@@ -304,6 +309,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => 'https://www.google.de/search?q=' . urlencode($searchTerm),
|
self::allgemein => 'https://www.google.de/search?q=' . urlencode($searchTerm),
|
||||||
self::aat => 'https://www.getty.edu/vow/AATServlet?english=N&find=' . urlencode($searchTerm) . '&page=1¬e=',
|
self::aat => 'https://www.getty.edu/vow/AATServlet?english=N&find=' . urlencode($searchTerm) . '&page=1¬e=',
|
||||||
self::ackerbau => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|ackerbau',
|
self::ackerbau => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|ackerbau',
|
||||||
|
self::avefi => 'https://www.av-efi.net/search?query=' . urlencode($searchTerm),
|
||||||
self::bne => 'http://datos.bne.es/persona/' . urlencode($searchTerm),
|
self::bne => 'http://datos.bne.es/persona/' . urlencode($searchTerm),
|
||||||
self::bnf => 'https://catalogue.bnf.fr/resultats-auteur.do?nomAuteur=' . urlencode($searchTerm) . '+&filtre=1&pageRech=rau',
|
self::bnf => 'https://catalogue.bnf.fr/resultats-auteur.do?nomAuteur=' . urlencode($searchTerm) . '+&filtre=1&pageRech=rau',
|
||||||
self::col => 'https://www.catalogueoflife.org/data/search?q=' . urlencode($searchTerm),
|
self::col => 'https://www.catalogueoflife.org/data/search?q=' . urlencode($searchTerm),
|
||||||
@@ -422,6 +428,28 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an AVefi ID. AVefi IDs are not numeric.
|
||||||
|
*
|
||||||
|
* @param string $id ID to validate.
|
||||||
|
*
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
private static function validateAvefiId(string $id):string|false {
|
||||||
|
|
||||||
|
if (str_contains($id, 'https://www.av-efi.net/')) {
|
||||||
|
$id = str_replace('https://www.av-efi.net/res/', '', $id);
|
||||||
|
}
|
||||||
|
if (str_contains($id, 'https://hdl.handle.net/')) {
|
||||||
|
$id = str_replace('https://hdl.handle.net/', '', $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr_count($id, '/') !== 1) return false;
|
||||||
|
|
||||||
|
return $id;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a BNE ID, returning a string or false. The BNE is basically equalivalent to the
|
* Validates a BNE ID, returning a string or false. The BNE is basically equalivalent to the
|
||||||
* GND, just that the X character can be prepended to the number.
|
* GND, just that the X character can be prepended to the number.
|
||||||
@@ -778,6 +806,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
'https://vocab.getty.edu/page/aat/',
|
'https://vocab.getty.edu/page/aat/',
|
||||||
]),
|
]),
|
||||||
self::ackerbau => self::validateNumericId($id, ['https://term.museum-digital.de/ackerbau/tag/']),
|
self::ackerbau => self::validateNumericId($id, ['https://term.museum-digital.de/ackerbau/tag/']),
|
||||||
|
self::avefi => self::validateAvefiId($id),
|
||||||
self::bne => self::validateBneId($id, ['http://datos.bne.es/persona/', 'https://datos.bne.es/persona/']),
|
self::bne => self::validateBneId($id, ['http://datos.bne.es/persona/', 'https://datos.bne.es/persona/']),
|
||||||
self::bnf => self::validateBnfId($id),
|
self::bnf => self::validateBnfId($id),
|
||||||
self::col => self::validateColId($id),
|
self::col => self::validateColId($id),
|
||||||
|
|||||||
@@ -48,6 +48,34 @@ final class MDNodaRepositoryTest extends TestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data provider for validating AVefi IDs.
|
||||||
|
*
|
||||||
|
* @return Generator<string, array{0: string|false, 1: string}>
|
||||||
|
*/
|
||||||
|
public static function avefiIdForValidationProvider():Generator {
|
||||||
|
|
||||||
|
yield "Full URL, https" => ["21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8", "https://www.av-efi.net/res/21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8"];
|
||||||
|
yield "ID" => ["21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8", "21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8"];
|
||||||
|
yield "Broken input / XX503494safdsaf;3" => [false, "XX503494safdsaf;3"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure validating references to the AVefi works.
|
||||||
|
*
|
||||||
|
* @param string|false $expected Expected output.
|
||||||
|
* @param string $inputString Input string.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
#[DataProvider('avefiIdForValidationProvider')]
|
||||||
|
public function testAvefiIdValidation(string|false $expected, string $inputString):void {
|
||||||
|
|
||||||
|
self::assertEquals($expected, MDNodaRepository::avefi->validateId($inputString));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data provider for validating BNE IDs.
|
* Data provider for validating BNE IDs.
|
||||||
*
|
*
|
||||||
@@ -62,17 +90,6 @@ final class MDNodaRepositoryTest extends TestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Data provider for validating BNE IDs.
|
|
||||||
*
|
|
||||||
* @return Generator<string, array{0: string|false, 1: string}>
|
|
||||||
*/
|
|
||||||
public static function bnfIdForValidationProvider():Generator {
|
|
||||||
|
|
||||||
yield "Broken input / duplicate https" => [false, "https://catalogue.bnf.fr/ark:/12148/cbhttps://catalogue.bnf.fr/ark:/12148/cbhttps://catalogue.bnf.fr/ark:/12148/cb104183522"];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure validating references to the BNE works.
|
* Ensure validating references to the BNE works.
|
||||||
*
|
*
|
||||||
@@ -88,6 +105,17 @@ final class MDNodaRepositoryTest extends TestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data provider for validating BNE IDs.
|
||||||
|
*
|
||||||
|
* @return Generator<string, array{0: string|false, 1: string}>
|
||||||
|
*/
|
||||||
|
public static function bnfIdForValidationProvider():Generator {
|
||||||
|
|
||||||
|
yield "Broken input / duplicate https" => [false, "https://catalogue.bnf.fr/ark:/12148/cbhttps://catalogue.bnf.fr/ark:/12148/cbhttps://catalogue.bnf.fr/ark:/12148/cb104183522"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data provider for validating GND IDs.
|
* Data provider for validating GND IDs.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user