Allow BNE IDs starting with XX
This commit is contained in:
parent
f5673c69fd
commit
9e44fcac49
|
@ -62,6 +62,8 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||||
'edition humboldt digital' => self::editionhumboldtdigital,
|
'edition humboldt digital' => self::editionhumboldtdigital,
|
||||||
'gnd' => self::gnd,
|
'gnd' => self::gnd,
|
||||||
'GND' => self::gnd,
|
'GND' => self::gnd,
|
||||||
|
'http://d-nb.info/gnd' => self::gnd,
|
||||||
|
'http://d-nb.info/gnd/' => self::gnd,
|
||||||
'grobsystematik' => self::grobsystematik,
|
'grobsystematik' => self::grobsystematik,
|
||||||
'iconclass' => self::iconclass,
|
'iconclass' => self::iconclass,
|
||||||
'lcsh' => self::lcsh,
|
'lcsh' => self::lcsh,
|
||||||
|
@ -85,6 +87,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||||
'ulan' => self::ulan,
|
'ulan' => self::ulan,
|
||||||
'viaf' => self::viaf,
|
'viaf' => self::viaf,
|
||||||
'wikidata' => self::wikidata,
|
'wikidata' => self::wikidata,
|
||||||
|
'wikipedia' => self::wikipedia,
|
||||||
'Wikipedia' => self::wikipedia,
|
'Wikipedia' => self::wikipedia,
|
||||||
default => throw new MDpageParameterNotFromListException("Unknown noda repository: '" . $input . "'"),
|
default => throw new MDpageParameterNotFromListException("Unknown noda repository: '" . $input . "'"),
|
||||||
};
|
};
|
||||||
|
@ -287,6 +290,21 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @param string $id ID to validate.
|
||||||
|
* @param string[] $prefixes Prefixes to strip off.
|
||||||
|
*
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
private static function validateBneId(string $id, array $prefixes):string|false {
|
||||||
|
|
||||||
|
return self::validateGndId($id, $prefixes);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a GND ID, returning a string or false.
|
* Validates a GND ID, returning a string or false.
|
||||||
*
|
*
|
||||||
|
@ -409,7 +427,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||||
self::allgemein => filter_var($id, FILTER_VALIDATE_URL),
|
self::allgemein => filter_var($id, FILTER_VALIDATE_URL),
|
||||||
self::aat => self::validateNumericId($id, ['https://vocab.getty.edu/page/aat/']),
|
self::aat => self::validateNumericId($id, ['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::bne => self::validateNumericId($id, ['http://datos.bne.es/persona/']),
|
self::bne => self::validateGndId($id, ['http://datos.bne.es/persona/']),
|
||||||
self::bnf => self::validateNumericId(rtrim($id, 't'), ["https://catalogue.bnf.fr/ark:/12148/cb"]), // cb11960399t is a valid entry, too (general)
|
self::bnf => self::validateNumericId(rtrim($id, 't'), ["https://catalogue.bnf.fr/ark:/12148/cb"]), // cb11960399t is a valid entry, too (general)
|
||||||
self::cona => self::validateNumericId($id, ['https://vocab.getty.edu/page/cona/']),
|
self::cona => self::validateNumericId($id, ['https://vocab.getty.edu/page/cona/']),
|
||||||
self::editionhumboldtdigital => self::validateGndId($id, ['https://edition-humboldt.de/register/personen/detail.xql?normid=http://d-nb.info/gnd/']),
|
self::editionhumboldtdigital => self::validateGndId($id, ['https://edition-humboldt.de/register/personen/detail.xql?normid=http://d-nb.info/gnd/']),
|
||||||
|
|
|
@ -39,10 +39,12 @@ final class MDNodaRepositoryTest extends TestCase {
|
||||||
self::assertNotFalse(MDNodaRepository::loc->validateId("http://id.loc.gov/authorities/names/n2022014604"));
|
self::assertNotFalse(MDNodaRepository::loc->validateId("http://id.loc.gov/authorities/names/n2022014604"));
|
||||||
self::assertNotFalse(MDNodaRepository::loc->validateId("n2022014604"));
|
self::assertNotFalse(MDNodaRepository::loc->validateId("n2022014604"));
|
||||||
|
|
||||||
|
|
||||||
self::assertNotFalse(MDNodaRepository::lcsh->validateId("https://id.loc.gov/authorities/names/sh2022014604"));
|
self::assertNotFalse(MDNodaRepository::lcsh->validateId("https://id.loc.gov/authorities/names/sh2022014604"));
|
||||||
self::assertNotFalse(MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/names/sh2022014604"));
|
self::assertNotFalse(MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/names/sh2022014604"));
|
||||||
self::assertNotFalse(MDNodaRepository::lcsh->validateId("sh2022014604"));
|
self::assertNotFalse(MDNodaRepository::lcsh->validateId("sh2022014604"));
|
||||||
|
|
||||||
|
self::assertNotFalse(MDNodaRepository::bne->validateId("http://datos.bne.es/persona/XX5034943"));
|
||||||
|
self::assertNotFalse(MDNodaRepository::bne->validateId("XX5034943"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user