Remove linking to wikipedia as a noda repository in wikidata fetcher

Close #21
This commit is contained in:
Joshua Ramon Enslin 2024-07-19 00:49:04 +02:00
parent 58d3569718
commit f220a77ad7
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -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 = [
"<p>Si vous disposez d'ouvrages ou d'articles de référence ou si vous ",
'<p><b>En pratique&#160;:</b> <a href="/wiki/Wikip%C3%A9dia:Citez_vos_sources#Qualité_des_sources" title="Wikipédia:Citez vos sources">Quelles sources sont attendu',
'<pVous pouvez partager vos connaissances en laméliorant (',
@ -62,14 +62,14 @@ final class NodaWikidataFetcher {
'<p><span class="geo noexcerpt"',
];
const RETRIEVAL_MODES_ACCEPTED = [
public const RETRIEVAL_MODES_ACCEPTED = [
'list',
'add',
'keep',
'replace',
];
const RETRIEVAL_MODES_DEFAULT = 'list';
public const RETRIEVAL_MODES_DEFAULT = 'list';
/** @var 'list'|'add'|'keep'|'replace' */
private string $_retrievalMode = self::RETRIEVAL_MODES_DEFAULT;
@ -789,12 +789,6 @@ final class NodaWikidataFetcher {
}
$updatePersinstStmt->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(),