Ignore wikidata claims without datavalue

This commit is contained in:
pietervdvn 2021-10-06 19:19:35 +02:00
parent b5d2b99ced
commit 8d52ef1106
3 changed files with 1860 additions and 8 deletions

View file

@ -47,8 +47,10 @@ export default class Wikidata {
const claimsList: any[] = entity.claims[claimId] const claimsList: any[] = entity.claims[claimId]
const values = new Set<string>() const values = new Set<string>()
for (const claim of claimsList) { for (const claim of claimsList) {
const value = claim.mainsnak.datavalue.value; const value = claim.mainsnak?.datavalueq?.value;
values.add(value) if(value !== undefined){
values.add(value)
}
} }
claims.set(claimId, values); claims.set(claimId, values);
} }

View file

@ -57,6 +57,10 @@ export default class ImageProviderSpec extends T {
expects("https://commons.wikimedia.org/wiki/Special:FilePath/File%3ABrugge_Leeuwstraat_zonder_nummer_Leeuwbrug_-_119334_-_onroerenderfgoed.jpg?width=500&height=400",{ expects("https://commons.wikimedia.org/wiki/Special:FilePath/File%3ABrugge_Leeuwstraat_zonder_nummer_Leeuwbrug_-_119334_-_onroerenderfgoed.jpg?width=500&height=400",{
image:"File:Brugge_Leeuwstraat_zonder_nummer_Leeuwbrug_-_119334_-_onroerenderfgoed.jpg" image:"File:Brugge_Leeuwstraat_zonder_nummer_Leeuwbrug_-_119334_-_onroerenderfgoed.jpg"
}, "WikimediaImageProvider") }, "WikimediaImageProvider")
expects("https://commons.wikimedia.org/wiki/Special:FilePath/File%3APapageno_Jef_Claerhout.jpg?width=500&height=400",{
"wikimedia_commons": "File:Papageno_Jef_Claerhout.jpg"
}, "WikimediaImageProvider")
}] }]

File diff suppressed because it is too large Load diff