From f220a77ad7f84f2ba819a76c7f68c7983faadbd7 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Fri, 19 Jul 2024 00:49:04 +0200 Subject: [PATCH] Remove linking to wikipedia as a noda repository in wikidata fetcher Close #21 --- src/NodaWikidataFetcher.php | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/NodaWikidataFetcher.php b/src/NodaWikidataFetcher.php index bd991ad..179c0d7 100644 --- a/src/NodaWikidataFetcher.php +++ b/src/NodaWikidataFetcher.php @@ -12,17 +12,17 @@ declare(strict_types = 1); */ final class NodaWikidataFetcher { - const WIKIDATA_FETCH_HEADERS = [ + private const WIKIDATA_FETCH_HEADERS = [ 'User-Agent: museum-digital-bot GND-to-Wikidata PHP/' . PHP_VERSION, 'Accept: application/sparql-results+json', ]; - const LANGUAGES_MAIN_DESC = ['de', 'da', 'en', 'es', 'fr', 'hu', 'it', 'jp', 'nl', 'pt', 'ru', 'sv', 'sk', 'uk', 'zh']; - const LANGUAGES_TO_CHECK = ['ar', 'bg', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'ha', 'he', 'hi', 'hu', 'id', 'it', 'ja', 'ka', 'ko', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'sk', 'sw', 'ta', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'zh']; + public const LANGUAGES_MAIN_DESC = ['de', 'da', 'en', 'es', 'fr', 'hu', 'it', 'jp', 'nl', 'pt', 'ru', 'sv', 'sk', 'uk', 'zh']; + public const LANGUAGES_TO_CHECK = ['ar', 'bg', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'ha', 'he', 'hi', 'hu', 'id', 'it', 'ja', 'ka', 'ko', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv', 'sk', 'sw', 'ta', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'zh']; - const LANGUAGES_TO_CAPITALIZE = ["cs", "da", "de", "en", "es", "fr", "fi", "id", "it", "nl", "pl", "pt", "ru", "sv", 'sk', "tl", "tr"]; + public const LANGUAGES_TO_CAPITALIZE = ["cs", "da", "de", "en", "es", "fr", "fi", "id", "it", "nl", "pl", "pt", "ru", "sv", 'sk', "tl", "tr"]; - const P_IDS_NODA_TAGS = [ + private const P_IDS_NODA_TAGS = [ 'gnd' => 'P227', 'lcsh' => 'P244', 'aat' => 'P1014', @@ -43,7 +43,7 @@ final class NodaWikidataFetcher { "orcid" => "P496", ]; - const WIKIPEDIA_REMOVE_LITERALS = [ + private const WIKIPEDIA_REMOVE_LITERALS = [ "

Si vous disposez d'ouvrages ou d'articles de référence ou si vous ", '

En pratique : Quelles sources sont attendu', 'close(); - // Set link to Wikipedia in noda table - - NodaBatchInserter::linkNodaForPersinst($this->_mysqli_noda, $persinst_id, [ - new MDNodaLink(MDNodaRepository::wikipedia, $wikilink) - ], $erfasst_von); - // Update edit metadata $updatePersinstEditInfoStmt = $this->_mysqli_noda->do_prepare("UPDATE `persinst` SET `persinst_erfasst_am` = NOW(), @@ -1147,12 +1141,6 @@ final class NodaWikidataFetcher { $updateStmt->close(); unset($updateStmt); - // Write link to wikipedia to relevant noda DB table - - NodaBatchInserter::linkNodaForPlace($this->_mysqli_noda, $placeID, [ - new MDNodaLink(MDNodaRepository::wikipedia, $wikilink[$lang]) - ], $erfasst_von); - return true; } @@ -1463,10 +1451,6 @@ final class NodaWikidataFetcher { $this->_mysqli_noda->commit(); $this->_mysqli_noda->autocommit(true); - NodaBatchInserter::linkNodaForTag($this->_mysqli_noda, $tag_id, [ - new MDNodaLink(MDNodaRepository::wikipedia, $wikilink) - ], $erfasst_von); - // Update tag editing metadata $updateTagEditInfoStmt = $this->_mysqli_noda->do_prepare("UPDATE `tag` SET `tag_erfasst_am` = NOW(),