# Wikidata Support in the Creation of Rich Semantic Metadata for Historical Archives
## 3 Mapping from the Wikidata Semantic Model to HERO
### Knowledge Base Access  
The Knowledge Base Access step is aimed at retrieving the best matching entity for each pair of labels in \(L^{C}\) by querying external knowledge bases. Since we are interested in providing matches grounded in the Wikidata space, we exploit two additional resources for which a mapping to Wikidata exists (queries to Wikidata have been performed through the MediaWiki API: www.wikidata.org/w/api.php, accessed on 23 March 2021): BabelNet [14] (queries to BabelNet have been performed through the Java API: babelnet.org/guide, accessed on 23 March 2021) and Wikipedia (en.wikipedia.org, accessed on 23 March 2021; queries to Wikipedia have been performed through the MediaWiki API: en.wikipedia.org/w/api.php, accessed on 23 March 2021). The rationale underlying the decision to leverage multiple resources instead of using Wikidata only is that by performing the same query on multiple resources that share the  
Figure 5: Picture representing the automatic matching strategy. The three steps, namely Label Extraction, Knowledge Base Access, and Scoring are depicted by starting from the HERO _Questioning_ label. same vocabulary, we can, in principle, obtain different rankings for the same entities, according to the different sorting criteria implemented by different resources. Additionally, if the same entity is retrieved from multiple resources by using the same labels, we can reasonably consider the result as more reliable: the more resources provide the same entity by means of the same query, the more reliable should be the result. Since we are interested in computing the best matching entity for each label pair <\(l^{C}\)\({}_{em}\), \(l^{C}\)\({}_{\mu}\)> contained in \(L^{C}\), we perform six different queries, one for each resource and language, in order to obtain six different result rankings. We can represent the query to a knowledge base with the function \(Q\)(\(KB\), \(label\)), where \(KB\) is the resource and \(label\) is the English or Italian label from \(L^{C}\). For example, the query to Wikipedia with the label _interrogation_ can be represented as \(Q\)(_Wikipedia, interrogation_). Let us consider the HERO _Questioning_ class, for which the Label Extraction step returns the set \(L^{Questioning}\) = {_!_interrogation_, _interrogatorio_, _!questioning_, _interrogatorio_}. If we consider the first pair of labels _!_interrogation_, _interrogatorio_? as input for the Knowledge Base Access step, we perform six different queries, three for the English labels and three for the Italian labels, obtaining the following results (as regards Wikipedia, for the sake of brevity, we only report the first two results, referred to with the title of the corresponding Wikipedia pages; all the query results are ordered lists):  
* \(Q\)_(Wikipedia, interrogation) = [Interrogation, Interrogation_(_TV_series)];
* \(Q\)_(Wikipedia, interrogatorio) = [Interrogatorio, Interrogatorio_(_ordinamento_italiano)];
* \(Q\)_(Wikidata, interrogation) = [Q327018, Q60753100, Q6056617, Q6056611];
* \(Q\)_(Wikidata, interrogatorio) = [Q327018, Q56323357, Q3800554];
* \(Q\)_(BabelNet, interrogation) = [bn:00032094n, bn:00047209n, bn:00047208n];
* \(Q\)_(BabelNet, interrogatorio) = [bn:00032094n, bn:22438476n, bn:00023955n]._  
The query to a knowledge base KB provides results that lie in the space \(S^{KB}\) of entities belonging to the queried knowledge base. For example, \(Q\)(_Wikipedia, interrogation) returns an ordered list whose elements are Wikipedia entities. Since we are interested in obtaining entities in the Wikidata space, we defined a mapping function \(M\) that maps each Wikipedia or BabelNet list of entities to the corresponding Wikidata ones: M:S\({}^{\text{Wikipedia}}\) u S\({}^{\text{BabelNet}}\) \(\rightarrow\) S\({}^{\text{Wikidata}}\). In practice, \(M\) exploits the equivalence links to Wikidata entities possibly provided by Wikipedia and BabelNet: Wikipedia pages offer such links in the section titled \"In other projects\", while BabelNet synsets provide them in their sources set.