Full text
Universidade do Minho Escola de Engenharia Departamento de Informática João Costeira Faria Gomes Exploration of documents concerning Foundlings in Fafe along XIX Century May 2022
Universidade do Minho Escola de Engenharia Departamento de Informática João Costeira Faria Gomes Exploration of documents concerning Foundlings in Fafe along XIX Century Master dissertation Integrated Master’s in Informatics Engineering Orientador Pedro Rangel Henriques Supervisores no local de trabalho Cristiana Araújo, Mónica Guimarães May 2022
i AUTHOR COPYRIGHTS AND TERMS OF USAGE BY THIRD PARTIES This is an academic work which can be utilized by third parties given that the rules and good practices internationally accepted, regarding author copyrights and related copyrights. Therefore, the present work can be utilized according to the terms provided in the license bellow. If the user needs permission to use the work in conditions not foreseen by the licensing indicated, the user should contact the author, through the RepositóriUM of University of Minho. License provided to the users of this work Attribution-NonCommercial CC BY-NC https://creativecommons.org/licenses/by-nc/4.0/
ii STATEMENT OF INTEGRITY I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Code of Ethical Conduct of the University of Minho. João Costeira Faria Gomes
AGRADECIMENTOS O desenvolvimento deste projeto foi um processo longo, onde muitos obstáculos tiveram de ser enfrentados. De forma a conseguir chegar à meta, o suporte de um conjunto de pessoas foi essencial, tanto no ponto de vista motivacional como numa perspetiva mais técnica. O objetivo desta pequena secção é destacar e agradecer essas pessoas, que diretamente ou indiretamente, tiveram um papel fulcral neste projeto. Inicialmente, o apoio incondicional da minha família e amigos, que sempre me ajudaram ao longo deste projeto e todo o percurso académico em geral. Estas pessoas foram uma das principais forças motivadoras, a apoiar nos melhores e piores momentos. Este apoio possuiu um papel preponderante na continuação deste projeto, em acreditar que seria capaz de ultrapassar os maiores obstáculos enfrentados, que em alguns momentos, pareciam impossíveis e desistir seria a opção mais fácil de seguir. O segundo grupo de pessoas que devo destacar são os meus orientadores, Pedro Rangel Henriques e Cristiana Araújo. O seu apoio e acompanhamento semanal, incluindo disponibilidade adicional fora de horas de trabalho, foi essencial num ponto de vista mais técnico, fornecendo aconselhamento sobre as decisões e etapas enfrentadas ao longo do desenvolvimento do projeto. De forma análoga, tenho de agradecer à Mónica Guimarães, representante da equipa do Arquivo Municipal de Fafe, que estabeleceu a ponte de comunicação com o arquivo. A sua ajuda foi essencial, fornecendo apoio técnico não numa perspetiva informática, mas numa perspetiva de arquivista e de utilizador final da aplicação. O seu conhecimento na área do domínio do projeto, facilitou a compreensão de qualquer dúvida existente e fornecimento da base documental necessária. Por último, um pequeno destaque ao Jean-Baptiste Lamy, elemento da equipa de desenvolvimento da tecnologia OWLReady. O seu apoio e recomendações técnicas foram cruciais na ligação entre a componente ontológica e o sistema global. iii
ABSTRACT The abandonment of children and newborns is a problem in our society. In the last few decades, the introduction of contraceptive methods, the development of social programs and family planning were fundamental to control undesirable pregnancies and support families in need. But these developments were not enough to solve the abandonment epidemic. The anonymous abandonment has a dangerous aspect. In order to preserve the family identity, a child is usually left in a public place at night. Since children and newborns are one of the most vulnerable groups in our society, the time between the abandonment and the assistance of the child is potentially deadly. The establishment of public institutions in the past, such as the foundling wheel, was extremely important as a strategy to save lives. These institutions supported the abandoned children, while simultaneously providing a safer abandonment process, without compromising the anonymity of the family. The focus of the Master’s Project discussed in this dissertation is the analysis and processing of nineteenth century documents, concerning the Foundling Wheel of Fafe. The analysis of sample documents is the initial step in the development of an ontology. The ontology has a fundamental role in the organization and structure of the information contained in these historical documents. The identification of concepts and the relationships between them, culminates in a structured knowledge repository. Other important component is the development of a digital platform, where users are able to access the content stored in the knowledge repository and explore the digital archive, which incorporates the digitized version of documents and books from these historical institutions. The development of this project is important for some reasons. Directly, the implementation of a knowledge repository and a digital platform preserves information. These documents are mostly unique records and due to their age and advanced state of degradation, the substitution of the physical by digital access reduces the wear and tear associated to each consultation. Additionally, the digital archive facilitates the dissemination of valuable information. Research groups or the general public are able to use the platform as a tool to discover the past, by performing biographic, cultural or socio-economic studies over documents dated to the ninetieth century. Keywords: Foundling Wheel, Ontology, Knowledge Repository, Digital Platform iv
RESUMO O abandono de crianças e de recém-nascidos é um flagelo da sociedade. Nas últimas décadas, a introdução de métodos contraceptivos e de programas sociais foram essenciais para o desenvolvimento do planeamento familiar. Apesar destes avanços, estes programas não solucionaram a problemática do abandono de crianças e recém-nascidos. Problemas socioeconómicos são o principal factor que explica o abandono. O processo de abandono de crianças possui uma agravante perigosa. De forma a proteger a identidade da família, este processo ocorre normalmente em locais públicos e durante a noite. Como crianças e recém-nascidos constituem um dos grupos mais vulneráveis da sociedade, o tempo entre o abandono da criança e seu salvamento, pode ser demasiado longo e fatal. A casa da roda foi uma instituição introduzida de forma a tornar o processo de abandono anónimo mais seguro. O foco do Projeto de Mestrado discutido nesta dissertação é a análise e tratamento de documentos do século XIX, relativos à Casa da Roda de Fafe preservados pelo Arquivo Municipal de Fafe. A análise documental representa o ponto de partida do processo de desenvolvimento de uma ontologia. A ontologia possui um papel fundamental na organização e estruturação da informação contida nos documentos históricos. O processo de desenvolvimento de uma base de conhecimento consiste na identificação de conceitos e relações existentes nos documentos. Outra componente fundamental deste projecto é o desenvolvimento de uma plataforma digital, que permite utilizadores acederem à base de conhecimento desenvolvida. Os utilizadores podem pesquisar, explorar e adicionar informação à base de conhecimento. O desenvolvimento deste projecto possui importância. De forma imediata, a implementação de uma plataforma digital permite salvaguardar e preservar informação contida nos documentos. Estes documentos são os únicos registos existentes com esse conteúdo e muitos encontram-se num estado avançado de degradação. A substituição de acessos físicos por acessos digitais reduz o desgaste associado a cada consulta. O desenvolvimento da plataforma digital permite disseminar a informação contida na base documental. Investigadores ou o público em geral podem utilizar esta ferramenta com o intuito de realizar estudos biográficos, culturais e sociais sobre este arquivo histórico. Palavras-Chave: Casa da Roda, Exposto, Ontologia, Base de Conhecimento,Plataforma Digital v
CONTENTS 1 introduction 1 1.1Motivation 1 1.2Objectives 2 1.3Research Approach 2 1.4Research Hypothesis 3 1.5Document Structure 3 2 child abandonment 4 2.1Present 4 2.1.1Baby Boxes 5 2.1.2Safe Haven 9 2.2Historical Context 9 2.2.1Foundling Wheel in Portugal 10 2.3Similar Projects 12 2.3.1Foundling Hospital 12 2.3.2Foundling Museum 13 2.3.3London Metropolitan Archives 13 2.3.4Program Voices Through Time: The Story of Care 14 3 foundling archive 15 3.1Document Analysis 15 3.2Ontology Contextualization 21 3.2.1Annotation of Documents 21 3.2.2Initial Ontology 22 3.3Application and Requirements 26 4 proposed system 29 4.1System Architecture 29 4.2Required Components 30 4.3Extraction From Documents 30 4.3.1Natural Language Processing 32 4.3.2Spacy Pipeline 34 4.4Knowledge Representation 35 4.4.1Semantic Web 36 4.4.2Introduction to Knowledge Representation Standards 37 4.4.3Semantic Application Components 39 4.5Web Application 43 vi
contents vii 5 development 46 5.1Dataset Development 46 5.1.1Data Extraction 47 5.1.2Data Cleaning 49 5.2Entity Extraction 50 5.2.1Entity Extraction Component 51 5.3Relation Extraction 53 5.3.1Pattern Based Relation Extraction 53 5.3.2Machine Learning Based Relation Extraction 57 5.3.3Final Notes on Relation Extraction 58 5.4Entity Linking 58 5.5Ontology Integration 60 5.5.1Ontology Development 60 5.5.2NLP Pipeline and Ontology Integration 67 6 foundling wheel virtual museum 69 6.1Web Platform Architecture 69 6.2Back-End Components 71 6.2.1Models and Storage Solution 71 6.2.2Pipeline Integration 77 6.3Front-End Components 78 6.3.1Technologies 78 6.4Navigation Example 79 6.5Summary 84 7 conclusion 85 7.1Future Work 87
1.2. Objectives 2 1.2 objectives The main objective is the development of a digital platform supported by a knowledge repository. In order to successfully accomplish the main objective of this project, a set of sub objectives was identified: • Development of an ontology, used to define the relationships between all the different concepts contained in the documents, • Development of a knowledge repository, used to store all the different instances of extracted entities and respective relations, • Development of a web platform, where users are able to access the digital documents, the knowledge repository, search according to different criteria and insert new information. 1.3 research approach To accomplish the main objectives of this project, the development phase was organized according to the following steps: • Bibliographic study of cutting-edge technologies used to complete each goal of this project. More specifically, the study of semantic web, natural languge processing, web development frameworks and storage solutions. • Analysis of sample documents. This step is fundamental in the organization of the data in two perspectives. Separate the different documents in different groups, for instance, documents concerning foundlings from the institutional management records. The second role is the identification of concepts, relations, entities and attributes. • Development of an ontology used to describe the knowledge, by structuring the information according to different concepts and respective relationships. • Development of a storage solution as a main knowledge repository. The database stores the information, modelled accordingly to the ontology. The concepts described in the ontology are converted into entities in the database. Since the concepts are entities, the relations between concepts in the ontology are expressed as relations between entities in the database. The attributes of each concept are defined by the columns of their respective table in database.
1.4. Research Hypothesis 3 • Development of the digital archive 1 , the web platform responsible for establishing the connection between the repository and the end user. After the last, if the result attained or the performance do not comply with the desired quality, the previous steps should be repeat until a satisfactory solution is reached. 1.4 research hypothesis From the identification of concepts and relations in the foundling wheel archive it is possible to develop a digital platform supported by a knowledge repository. 1.5 document structure The structure of this document follows the development process of the entire project, describing each step in a separate chapter. In Chapter 2, the child abandonment problematic is introduced, according to the historical and geographical context, by analysing both former and current approaches. After the historical contextualization, it is provided an overview of the current debate towards the reintroduction of anonymous abandonment mechanisms. Opposite groups discuss the legality, human rights violations and the effectiveness of these measures. This chapter is concluded with references to similar projects currently under development. Chapter 3provides an initial analysis of sample documents. These documents are analysed in two main perspectives, organizing documents according to their topic and an initial identification of concepts and relations. This step is the foundation for the development of an initial ontology and the knowledge domain. Chapter 4provides a description of the proposed solution. Initially, an overview of the system architecture is presented. The remainder of this chapter introduces concepts and technologies that support the development of this project. Furthermore a discussion on technology section and respective decisive factors. The structure of Chapter 5chronologically follows the development of this project. Initially, the extraction of information from documents is explored and this chapter culminates in the integration between the processing pipeline and the knowledge repository. Chapter 6focuses on the web application. The system architecture is explored and this chapter is concluded with a navigational example. To conclude, Chapter 7provides an overview of the entire project, result analysis, a discussion on the state of the project and future work. 1 Similar project supported by a knowledge repository. Official page available at: https://epl.di.uminho.pt/ ~gepl/GEPL_DS/UEF/, Accessed in October 2020.
2 CHILD ABANDONMENT The goal of this chapter is to contextualize the anonymous child abandonment, by analysing different social programs and strategies introduced to combat this problematic. The analysis is organized according to historical periods. Initially focuses on the current debate towards the reintroduction of anonymous child abandonment mechanisms in different parts of the world. Then contextualization is proceeded by focusing on the foundling wheel, a historical institution banned over a century ago. The historical contextualization is important to comprehend the effectiveness of social programs and to introduce the domain of this project, since the sources are archived nineteen century documents from foundling wheels. Towards the end of this chapter, similar projects currently under development are presented. 2.1 present Child abandonment is a problematic that occurs throughout history and across different societies around the world. In order to combat the abandonment problematic and support one of the most vulnerable groups, the study and introduction of public institutions to raise children, otherwise left behind on the streets, and social programs to support families in need, were fundamental measures to reduce the high child mortality rate consequent of the abandonments. More recently, developments in a multitude of fields were extremely important to further reduce the child abandonment problematic. The introduction of preventive measures, from the mass distribution of birth control methods to family planning, in general reduces the number of unplanned pregnancies and consequent number of abandonments. Simultaneously, the development of women’s rights and legalization of abortions 1 , present an alternative to control unwanted pregnancies. 1 Additional details on abortion, according to country and respective gestational limits, available at: https: //reproductiverights.org/worldabortionlaws, Accessed in December of 2021 4
2.1. Present 5 Abortions are illegal in 24 countries. 2 In the remaining countries, the legality of abortions varies according to different contexts, from only legal when woman’s life is at risk to fully legal abortion upon request, within gestational limits. Further development of social programs constitute a support system to assist vulnerable families. The decentralization of social-economic programs and focus on family-based support, keeps families together, instead of forcing families to abandon their children due to a lack of resources. Social factors and changes in attitudes towards sensitive topics, including illegitimacy, divorce or single parenthood, positively impacted the reduction of social and peer pressure towards mothers, enabler factors for the abandonment of children. Although these developments helped families at risk, the abandonment problematic is not solved, cases of child abandonment happen till this day3. Some countries are debating and reintroducing strategies to combat the anonymous child abandonment. In order to contextualize this problematic, in general, the anonymous child abandonment is illegal. Children rights declare that every person has the right of knowing their origins and establish relationships with their family. Regardless of potential criminal repercussions, children are abandoned in public places and this process is extremely dangerous in the perspective of potential infanticides. Therefore, the introduction of safer alternatives for the fully anonymous child abandonment are currently being studied. 2.1.1Baby Boxes Baby boxes, also referred as baby hatches or angel’s cradle, are modern mechanisms that preserve the anonymity of the family, while providing a safer abandonment process Cochrane and Ming (2013). This system consists of a box, usually fixed in one position similar to a mailbox and located next to emergency services, for instance, next to a hospital or maternity. The process of abandoning a newborn on a baby box consists in opening the door and placing them inside. By closing the door, the box is automatically locked, in order to protect the foundling from any outside element. From the inside perspective, the baby box is safe and offers all the survival conditions, with features including climate control and bedding. The combination of these conditions 2 Additional details on abortion restrictions around the world available in the news article: https://time.com/ 6173229/countries-abortion-illegal-restrictions/, Accessed in March 2022. 3 Newborn abandoned in a trash container in Lisbon, November 5th 2019. The exposed child was found in critical conditions by a homeless man. Full news report available in the following link: https://www.publico.pt/ 2019/11/05/sociedade/noticia/recemnascido-encontrado-caixote-lixo-lisboa-1892658 , Accessed in January 2021.
2.1. Present 6 results in a safe environment, providing the survival conditions for multiple hours, until the medical support arrives. In terms of technology, the box contains cameras and sensors used to alert the presence of a new arrival. These technologies are only used as an alert system, they are not used as a mechanism to track down the perpetrators of the abandonment. The authorities are immediately notified every time a newborn is placed inside the baby box, in order to assist them as soon as possible. Although the baby box offers all the survival conditions for a long period of time, the combination of the alert system with the closed proximity to the public emergency services results, on average, a five minutes elapse time between the abandonment and human support.4 2.1.1.1Approaches According to Geo Regions This section provides examples of countries that recently introduced the anonymous child abandonment mechanism baby box. This analysis focuses on the motivations that led to the introduction. 2.1.1.2Europe In Europe, approximately two hundred baby boxes were indroduced in the last decade. Germany, Switzerland, Poland and Czech Republic are few examples of those European countries. The goal is to combat the child abandonment epidemic.5 Since the year 2000, Germany introduced approximately eighty boxes across their territory. The main factor that led to the introduction of baby boxes in this country was the dramatic number of infanticides, resulting from the child abandonment epidemic. For instance, in the year 1999, three out of five abandoned babies died during the abandonment process or from collateral damages.6 2.1.1.3China Besides the European context, China is another country that recently introduced the baby box. 7 The main factor that led to the introduction was a concern by the authorities towards the alarming number of abandoned babies. 4 Data on the elapse time between the abandonment and rescue available in the following news report: https: //www.bbc.com/news/world-us-canada-46801838, Accessed in December 2020 5 News report on the widespread of baby boxes across Europe, available in the following link: https://www. theguardian.com/world/2012/jun/10/unitednations-europe-news, Accessed in December of 2020 6 Data from a hospital located in Hamburg, Germany. News report available at: https://www.bbc.com/news/ magazine-18585020, Accessed in December 2020 7 Details on the Chinese case available at: https://www.bbc.com/news/world-asia-china-26219171 , Accessed in December of 2020
2.1. Present 7 In China, per year around a thousand newborns are abandoned and two out of three babies die during the abandonment process.8 According to the official data, the vast majority of abandoned babies have health problems. Parents worried by the potential financial obligations, find the abandonment as the only viable option. The Chinese context has a distinguish factor, since the population control policies introduced may justify the disproportional gender bias found within the foundling population. In China, between the year 1976 and the year 2015, the one child policy was applicable. 9 The introduction of an upper limit on the number of descendants per couple, led to a gender discrimination during the abandonment process. Families preferentially kept a boy as their only child. The introduction of policies as the one child policy, may justify the disproportional number of females found within the Chinese foundling population. An important note is that the introduction of child abandonment mechanisms, for instance the baby box in China, does not equate to the legalization of anonymous abandonment. The baby boxes are a last resort solution to combat the raising number of infanticides consequent of the abandonments. 2.1.1.4Discussion on the Introduction of Baby Boxes The introduction of baby boxes is extremely controversial. Groups with opposing views, including human rights activist and politicians, discuss the resurgence of anonymous abandonment mechanisms. 2.1.1.5Against the Introduction of Baby Boxes The United Nations (UN) is against the introduction of baby boxes Ramesh (2012). One of the main factors that justifies their stance is the violation of key points of the children rights convention. More specifically, the fundamental right of children knowing their ancestry and the establishment of connections with their relatives. According to Maria Herczog, child psychologist and member of the United Nations Convention on the Rights of the Child (UNCRC) committee, the introduction of baby boxes represent an incentive to hidden pregnancies and childbirths without any medical support Ramesh (2012). There is no correlation between baby boxes and a decrease on the infanticides numbers. The solution is to support mothers under these circumstances.10 8 Statistics on the Chinese context available in the following news report: https://www.bbc.com/news/ world-asia-china-26219171, Acessed in December 2020 9 Additional details on the one child policy available at: https://en.wikipedia.org/wiki/One-child_policy , Accessed in December 2020 10 Maria Herczog interviwed by the BBC. News report available in the following page: https://www.bbc.com/ news/magazine-18585020, Accessed in December 2020
2.1. Present 8 Kevin Browne, of the Centre for Forensic and Family Psychology of University of Nottingham, completed a two-year study on baby boxes Ramesh (2012); Evans (2012). His study indicates that out of the twenty seven countries part of the European Union, eleven of these countries already introduced the baby box. One of the biggest issues pointed in his study is a significant number of the abandonments are committed by a male figure. The nonexistence of medical nor psychological support and the lack of an official abandonment process, can be abused by family members and pimps 11 . Without any official consultation nor consent from the mother’s part, the anonymity of the baby box offers a legal breach, abandonment against the mother’s will. Another topic pointed in his study is the integration of the baby boxes within the legal framework. In countries like Germany, every single citizen has the right of knowing their origins and establish relations with their family. The baby box breaks both of these laws. German ministers indicates that the solution is a legal reform, by including an exception to the confidential abandonment. Michalle Oberman, law professor at the University of Santa Clara, California, indicates that vulnerable groups, such as young or adolescent mothers, are extremely susceptible. The baby boxes may be interpreted as their only viable option Baker (2019). The combination of social shame towards teen pregnancy and the introduction of baby boxes, present a dangerous alternative to vulnerable young mothers, as an incentive hidden pregnancies and childbirth without any medical support. 2.1.1.6In Favor of the Introduction of Baby Boxes Supporters argue that the introduction of the baby box is important as a mechanism that saves lives. For desperate mothers, where the abandonment is the only viable option, baby boxes are a safe alternative, much safer than abandoning a newborn in a public place. Gabriele Stangl, from the Hospital of Waldfriede in Berlin, claims that baby boxes saves lives, which is more important than tracing the origin of the baby for a potential reconciliation with their family Evans (2012). In Berlin, baby boxes are placed next to the maternities and this close proximity reduces the elapse time between the abandonment and assistance by the medical staff. After the medical support, the baby enters the national adoptive system. The adoptions are final. In case of regret, the reconciliation with the biological family is only permitted before the completion of the adoptive process. 11 Interview with the BBC available at: https://www.bbc.com/news/magazine-18585020 , Accessed in December 2020
2.2. Historical Context 9 In the last decade, forty two babies were abandoned at the Hamburg Baby Box. Within this group, seventeen mothers contacted the institution and fourteen of them reconciled with their child.12 The Danish center for social science research (VIVE) 13 , after observing the introduction of baby boxes across Europe, conducted a study to analyze the effectiveness of the anonymous abandonment mechanisms and determine if Denmark should follow the footsteps of those European countries. Evidences suggest that baby boxes reduce the numbers of infanticides. For instance, according to the analyst Marie Jakobsen, since the year 2000, when Germany introduced the baby box, there were no infanticides registered in consequence of an anonymous abandonment Baker (2019). 2.1.2Safe Haven The safe haven law is another approach to combat the anonymous child abandonment problematic Baker (2019). In the United States, the abandonment of children in a public place is illegal. In order to combat this problematic, a new exception to the law was introduced, usually referred as safe haven. This law was introduced in the year 1999 in the state of Texas. 14 According to this law, it is possible to abandon a child in a restrictive group of public institutions, including hospitals, police stations or generally next to any public emergency service providers. In these restrictive areas, a child is safely abandoned, following a no question asked policy towards the perpetrator. Currently, 49 American states implemented the safe haven law and since 2004, more than one hundred babies were saved by baby boxes in Texas.15 Since these solutions are very effective, studies towards the expansion of anonymous child abandonment mechanism are currently being analysed. 2.2 historical context After introducing the current debate towards the adoption of laws and mechanics to handle the increasing abandonment numbers, this section focuses on the extinct and historical foundling wheel. 12 Data from a hospital located in Hamburg, Germany. News report available at: https://www.bbc.com/news/ magazine-18585020, Accessed in December 2020 13 Official VIVE webpage available at: https://www.vive.dk/en/about-vive/, Accessed in January 2021 14 News report that contextualizes the Texan introduction of safe haven laws. Available at: https://www.bbc.com/ news/world-us-canada-46801838, Accessed in December 2020 15 American and Canadian statistics on the introduction of the safe haven and baby boxes available at: https: //www.bbc.com/news/world-us-canada-46801838, Accessed in December 2020
2.2. Historical Context 10 The foundling wheel or foundling hospital are terms used to describe institutions that provided an anonymous and secure abandonment process. The abandonment process consists in placing the child on a wheel. 16 After executing a rotative motion, the child is left inside the institution, protected from the outside elements. Next to the wheel, usually a bell is placed in order to notify the presence of a new arrival. The first foundling wheels were introduced in the XII century in Europe. Usually, the wheel is an integral part of public institutions or catholic run. (Cochrane and Ming,2013) The main reasons behind the child abandonment in those historical periods were socialeconomic problems. Poverty and family without resources to support their children, before the existence of the foundling wheel, simply left them on the streets or doorsteps of affluent people. Another factor was strong religious believes. God had a protective role of the abandoned and exposed children. A common practice was abandoning the weaker children and keep the strongest in the family. 2.2.1Foundling Wheel in Portugal 2.2.1.1Introduction of the Foundling Wheel In the first half of the XVIII century, Portugal was suffering from an alarming number of child abandonment and infanticides. Families saw the child abandonment as the only viable option. Social programs were extremely scarce and insufficient to tackle the magnitude of this problematic. In order to face this dramatic situation, in 10 of May of 1783, Pina Manique declared the establishment of the foundling wheel and support of the exposed children in Portugal Brettell and Feijó (1991). 2.2.1.2Life on The Institution Right after the arrival, the foundling wheel had the role of assisting and supporting the abandoned child ion (1970). A common practice was giving the abandoned child to a wet nurse, which breastfeeds and raises the foundling. These nurses received money in exchange for their caretaker service. The development process of each foundling from their arrival to their adulthood and respective independence varied. Some foundlings spent the rest of their developing years with their nurse. While in opposition, some foundlings after finishing their breastfeeding year or the contractual 16 Contextualization of the foundling wheel in Portugal. News report available in the following webpage: https: //ionline.sapo.pt/artigo/663730/roda-dos-expostos-abandonar-um-filho-sem-que-ninguem-saiba-? seccao=Portugal_i, Acessed in December 2020
2.2. Historical Context 11 obligations with a nurse, returned to the institution. Within the latter group, some foundlings found a job and their employer took care of them. Other foundlings, according to their age and gender, learnt a profession or domestic work. Unfortunately, foundlings that were not able to learn or find a profession, usually children with disabilities, some eventually ended up going back to the streets.17 2.2.1.3Problems in the Institution The foundling wheel was introduced to control the alarming number of infanticides and improve the quality of life of the abandoned children. But these institutions originated another set of problems. The child mortality rate in these institutions was extremely high. Excessive administrative costs, lack of wet nurses willing to breastfeed newborns and nurses to raise abandoned children, drastically diminished the living conditions in the foundling wheel. Cases of multiple children sleeping in the same bed, delayed payments and health problems were common practices in these institutions. For example, the Real Casa dos Expostos, in Lisbon, at one point only had thirty one nurses available to raise one hundred and fifty two children Paulino (2017). All of these problems amplified the voices of critics. António Henriques Secco was extremely critical, claiming that the foundling wheel did not improve the life of the abandoned children. 2.2.1.4Termination of the Foundling Wheel During the decades of 1860 and 1870, a group of strategical changes in the governmental funds and legislation culminated in the termination of the foundling wheel in Portugal. In the governmental intervention in 1862 and the decree of 21 of November of 1867, the abolished of the foundling wheel was declared and these institutions were replaced by hospices Paulino (2017). The admission process in the hospices occurred during the day and required the identification of the parents. Admission had to be justified and exclusively accepted under certain circumstances, such as absent or death of the parents and for cases where the identity of the parents was truly unknown Paulino (2017). In order to combat the anonymous abandonment, rewards were given to whom disclosed information to the authorities, helping the identification process of the perpetrators. Twenty thousand reis were given in exchange for information (Paulino,2017). 17 Details on the life of the exposed children available at: https://ionline.sapo.pt/artigo/663730/ roda-dos-expostos-abandonar-um-filho-sem-que-ninguem-saiba-?seccao=Portugal_i , Accessed in December 2020
3.1. Document Analysis 18 Document Description Entrance Register New foundling record. Contains information such as the date of registration, clothes, baptism, name, godfathers, layette, description of signals (notes, jewelry, religious symbols) Departure Register Documents concerning foundlings leaving institution Medical Records Registries of medical support given to each foundling Vaccination Records Contains information such as registration number, name, age and date of vaccination Register of Expenses Documents about expenses and budget management of the foundling wheel Record of Nurses Registries of new nurses and wet-nurses that raise foundlings Payment to Nurses These documents include the name of the nurse, foundling personal details and payment information Foundlings given to Nurses Documents containing the name of the nurse, identifier of the foundling (name and number), initial and final date of services, table of payments/salary Foundlings given to their Mothers Registries of foundlings reconciling with their mothers and leaving the institution Record of Letters Registries of letters sent and received by the institution. For example the foundling wheel communication with the authorities, including the police, government or the church Movement of Foundling Movement of foundlings, for example to another institution. These documents contain information including the name of the foundling, identifier and name of the nurse. Table 1: Topic Based Document Classification The archivist were responsible for transcribing each document into a digital format, providing the results in a Microsoft Word format. These files are structured according to origin, a word file per institution. As a result, three main word documents were provided, one concerning the Foundling Wheel of Fafe, other the Foundling Wheel of Celorico de Bastos and the final Foundling Wheel of Cabeceiras de Bastos.
3.1. Document Analysis 19 Towards the structure of these documents, within each document books are described as a set of attributes attributes, for instance, in Figure 3a word document page is displayed, which includes the description of two books according to their attributes. Figure 3: Book Representation in a Word Document Furthurmore, these word files also contain transcriptions, which effectively are a digital representation of a book pages. As Figure 4suggests, one page of the physical book was rewritten in a word document. Additionally attributes were provided, including Cota, which is particular useful to link a transcription to the corresponding book.
3.1. Document Analysis 20 Figure 4: Transcription Representation in a Word Document Towards the total amount of documents, the archive provided one hundred and ten books and two hundred and four transcriptions. The range of the available transcriptions varied from zero to forty per book. Book instances without transcriptions were kept, since new transcriptions may be added further down the line. The process of digitizing the physical documents and incorporating them in a digital platform, provides an important role in the dissemination of the archive, but a desirable
3.2. Ontology Contextualization 21 outcome is an additional layer, a direct access to important pieces of information within each document. The goal is the development of a knowledge repository, where a set of entities and the relations between them are permanently stored. 3.2 ontology contextualization The ontology emphasize the relations between concepts, the structure of the knowledge domain. The ontology conceptualization is organized according to two stages. Initially sample documents are annotated, as an identification of process of the main concepts. Then the analysis is proceeded by defining meaningful relations between these concepts. This iterative process culminates in an initial representation of the knowledge domain, by defining the ontology in a light weight description language. 3.2.1Annotation of Documents The process of identifying concepts within a textual document was initialized resorting to the Doccano 1 text annotation tool. This tool runs on a local environment, where the interface is accessible via most internet Browsers. The annotation process consists in defining a set of entities and annotate sequences of characters with a label. The result of the annotation process is stored in a database, but it is possible to export them as a JSON Line (JSONL) file. Each line corresponds to a JSON object, containing the original text and a list of triples. These triples are composed of the label annotated and the position in the text, the initial and final character index. Figure 5displays a screenshot of a sample document annotated with Doccano tool. 1 Doccano is a free and open source textual annotation tool. Used to highlight and mark sequences of characters in a document, with a respective label. The application runs on a local environment, accessible via most internet Browsers. More information available in the official page: https://github.com/doccano/doccano , Accessed in February 2021
3.2. Ontology Contextualization 22 Figure 5: Annotated Document With Doccano Since the case study concerns the foundling wheel, this term was identified as the main concept. From this point, the identification of the remaining entities was an iterative process. The second group of concepts identified was references to the roles that a person assumes, from the perspective of the institution. Terms including foundling, nurse, clerk, councilor and all the different family hierarchy are a few instances of possible roles. Other fundamental group of concepts are the main life events of each foundling. Events including the registration or departure from the institution were identified. The identification of the concept event was followed by complementary concepts, such as dates or places. The final group of concepts identified were the layette and signals. 3.2.2Initial Ontology After identifying important concepts from documents, the process was proceeded via the identification of relationships between these concepts. The strategy used was the development of an ontology to define the knowledge domain, by identifying the relations through the analysis of the transcribed documents. The development of the ontology was completed resorting to the Ontology Description Language (OntoDL)(Fonseca et al.,2014;Pereira et al.,2016). The decision of choosing the OntoDL in opposition to other popular formats was the light-weight and simple notation. Another advantage provided is OntoDL automatically
3.2. Ontology Contextualization 23 exports the ontology defined in other industry standard formats, including OWL and graph description language (DOT) (Hamdan et al.,2019). The process of defining an ontology according to the OntoDL notation, consists in dividing the declarations in four main blocks, as shown in the Listing 3.1, the conceitos,individuos, relacoes and triplos (Araújo et al.,2020). 1Ontologia Ontology_Name 3conceitos { . . . } individuos { . . . } 5relacoes { ... } triplos { . . . } 7. Listing 3.1: Structure of an OntoDL File In the conceitos block, all the different concepts are declared, separated by commas. Attributes are added to each concept by defining them between square brackets. For example, the declaration Ball[color : string, radius : int] denotes the Ball concept with two attributes, a color attribute of the string type and an integer radius attribute. The individuos section, the identifiers of individuals are declared. These declarations are used during the process of defining instances of concepts. In the relacoes block, the relation identifiers are defined, indicating the domain and codomain between square brackets (this last indication is optional). For example, loves [domain: Person, codomain: Sport], introduces one relation named loves which requires as subject the concept Person (or an instance of it) and requires as object the concept Sport (or an instance of it). In the triplos block, relations are defined following the notation Subject= Predicate => Object. The subject is the domain of the relation and the object the codomain. The predicate specifies the relation between two concepts. Furthermore, the OntoDL specification provides reserved keywords to specify special relations. The keyword iof (instance of) is used to define instances of a concept. For example, Carl = iof => Person indicates that Carl is an instance of the concept Person. The keyword isa (is a) is used to define subclasses. For example, Car = isa => Vehicle indicates that the concept Car is a subclass of the concept Vehicle. A final note is that in the triplos block, the square brackets are used to group relations with the same domain. For example, the declaration Person=[loves=>Sport, owns=>Car] is equivalent to Person= loves=>Sport and Person=owns=>Car. The Listing 3.2describes the initial ontology developed in OntoDL.
3.2. Ontology Contextualization 24 1Ontologia Exposto 3conceitos { 5Casa_Da_Roda [nome: string , dataInicio : string , dataFim : string , Descricao : ⤦ Çstring , regulamento : string ] , Evento [ Data : string , tipo : string ] , 7Local [ Descricao : string ] , Pessoa [nome: string , funcao_pessoa : string , genero : string ] , 9Exposto [ id : int , historia : string ] , Sinal [ Descricao : string , tipo : string ] , 11 Enxoval , Item [ Descricao : string ] , 13 Imagem[ Folio : string , Referencia : string , Ficheiro : string ] } 15 individuos { 17 Bilhete , 19 Casa_de_Fafe 21 } 23 relacoes{ 25 participa [domain : Pessoa , codomain : Evento ] , composto [domain : Enxoval , codomain : Item ] , 27 possui [domain : Exposto , codomain : Sinal ] , pessoas_associadas [domain : Casa_Da_Roda , codomain : Pessoa ] , 29 ocorreu [domain : Evento , codomain : Local ] , localizada [domain : Casa_Da_Roda , codomain : Local ] , 31 reside [domain : Pessoa , codomain : Local ] , padrinho [domain : Pessoa , codomain : Pessoa ] , 33 madrinha [domain : Pessoa , codomain : Pessoa ] , pai [domain : Pessoa , codomain : Pessoa ] , 35 mae[domain : Pessoa , codomain : Pessoa ] } 37 triplos { 39 Pessoa =[ 41 participa => Evento , padrinho => Pessoa , 43 madrinha => Pessoa , pai => Pessoa , 45 mae => Pessoa ] ;
3.2. Ontology Contextualization 25 47 Exposto =[ 49 isa => Pessoa , possui => Sinal , 51 possui => Enxoval ] ; 53 Bilhete = iof => Sinal [ Descricao= ’ Bilhete que contem o nome do exposto ’ , ⤦ Çtipo= ’ Escrito ’ ] ; 55 Enxoval = composto => Item ; 57 Casa_de_Fafe =[ iof => Casa_Da_Roda [nome= ’Casa da Roda de Fafe ’ , dataInicio= ’ ’ , dataFim⤦ Ç= ’ ’ , Descricao= ’ ’ , regulamento= ’ ’ ] 59 ] ; 61 Casa_Da_Roda =[ pessoas_associadas => Pessoa , 63 localizada => Local ] 65 } . Listing 3.2: Ontology Defined in OntoDl As previously mentioned, OntoDL exports the ontology in multiple formats, including DOT. Graph visualizers, such as Graphviz 2 , are capable of rendering the ontology, while abstracting the underlying extensive ontology definition. This abstraction facilitates the communication with the archivists, by providing a common and easily understandable language. Figure 6is the result of rendering the previously defined ontology (Listing 3.2) via the Graphviz software. Figure 6: Graphical Ontology Representation 2 Open source graph visualizer, used to render graphs defined in DOT. More information available at: https: //graphviz.org/, Accessed November 2020
3.3. Application and Requirements 26 The definition of concepts and relations was supervised by Dr. Mónica Guimarães. Her expertise in the archival domain was fundamental in the process of defining a knowledge domain, based on the sample documents provided. 3.3 application and requirements After outlining the initial iteration of the knowledge repository, as described in Section 3.2.2, the requirements of the application and supporting components started to emerge. In order to substitute the physical access, the digital platform must simulate this process in a digital format. A user is able to see the all the available books and read them, effectively iterate through all the available transcriptions contained in a particular book. Furthermore, the knowledge base must be accessible. Similar projects supported by a knowledge repository, which provide an active role in the dissemination of historical documents, include Núcleo Português do Museu da Pessoa 3 ,Museu da Emigração e Comunidades (MEC) 4 and CortaColaEspia 5 (Martini,2018;Araújo,2016;Martini et al.,2016b,a;Araújo et al., 2018). For each entity, a page displays their respective relations and attributes in a readable format. The entities referenced in a page are linked to their own page. By developing a network of linked pages, the access to the knowledge repository is provided. Towards the possible end users of the application, generally two types of users were identified. A technical user base, for instance archivists or historians, and the general public, which may use the application for recreational purposes. Since these different groups of users have different motivations, the design of the application should reflect that, providing an equilibrium between technical functionalities and ease of use. As a result, the base design of the website should be fairly conventional, for instance inspired by popular social media platforms. A navigational bar is available on the top of every page, where important links and a search bar are included. Additionally, the technological nature of the digital platform, should improve the access to the information, by offering search, filtering and sorting functionalities. An important note is the restrictions introduced in the application. Although the general public may know additional information currently not present in the knowledge base, for security reasons, the modification of the knowledge base must be restricted to a small pool of users with special permissions. Opening the knowledge base for everyone requires monitoring resources, for instance moderators willing to analyse the modifications performed by the general public. For these users with special permissions, it is granted the access to additional buttons and respective forms, which perform the standard CRUD operations. In the 3Oficial webpage available at: https://npmp.epl.di.uminho.pt/index.html, Acessed in March 2022 4Oficial webpage available at: https://epl.di.uminho.pt/~ritafaria/MEC/index.php, Acessed in March 2022 5 Webpage with some of the projects analysed in https://epl.di.uminho.pt/~gepl/GEPL_DS/CORTACOLAESPIA/ case_studies.html, Acessed in March 2022
3.3. Application and Requirements 27 background, the entity and relation extraction components are activated and automatically insert the new content in the knowledge base. Since some operations require authentication, the application must provide the standard user management pages, including log in/log out, create a new account, update personal information and the mechanism to reset the password via email, in case the user is locked out of the account. In order to compile important functionalities, the following list describes the main requirements. The agreed functionalities were achieved after multiple meetings with the archivists. These meetings were essential to outline the main features of the application, while taking in consideration the time and resources constraints. • User management pages: –Create a new account, –Log-In by providing the credentials (email and password), –Log-Out from the current session, –Update personal information (username and email), –Password reset via email, • Functionalities for users with additional permissions: –Insert a new book and transcription via a user friendly interface, –Update a preexisting book or transcription, –Delete a preexisting book or transcription, –Insert information to the knowledge base, • Functionalities available to all users, including users without an account: –Page with the recent inserted and updated content (feed page), –Page with the entire archive, listing all the books contained in the archive, – Universal search bar over the attributes of each book and the content of the transcriptions, – Book page, with all the attributes that constitute a book and listing all the available transcriptions contained in each book. Additional a picture of the original book may be uploaded, – Read a book, by opening a book and within the book page, open each of the transcription, – Filter books from the entire archive, by choosing books where the content is in between a set of dates, and the results,
4.3. Extraction From Documents 34 Listing 4.1: Entity Extraction Script As the Listing 4.1suggests, with just a handful of lines, the combination of loading a standard language model and invoking high level functions, instantly provide fairly powerful results. The functionalities provided by the Spacy toolkit are not strict to a small set of immutable models. The toolkit itself provides the functionalities of adapting, retraining or build from scratch, any component or model. For instance, replace the standard complex tokenizer by a simpler white space recognizer or adapt the sentence fragmentation component. Furthermore, it is possible to insert new components, which updates the model to perform new tasks previously unavailable. For instance, insert a Relation Extraction (REL) component to a model not trained to perform that particular task. The main idea to retain is the possibility of adapting a pre existing model or simple develop a blank language model from scratch, both approaches are available. The approach proposed in this project is taking as much advantage as possible of the pre built Spacy models and functionalities. Instead of building an entire new model, the standard large Portuguese model 12 is adapted strictly where adjustments are necessary. The goal is utilize available natural language processing technologies, adapt and reshape a pre existing Portuguese base model, in order to automate the annotation of named entities from documents. 4.3.2Spacy Pipeline As previously mentioned, the Spacy module provides a wide range of models for more than 60 natural languages, including Portuguese. A Spacy model, in a practical sense, it is a natural language processing pipeline. This pipeline is composed of a set of components, each responsible for a particular NLP task. The input of the first step is a string, each component feeds the immediate adjacent component and the final output is a Spacy document object. Figure 9describes a general Spacy pipeline, color coding the different NLP taks. 12 Standard Portuguese language model. This project utilizes the large version, provided by the Spacy toolkit. Additional details on this base model available at: https://spacy.io/models/pt, Accessed in May 2021
4.4. Knowledge Representation 35 Figure 9: Spacy Pipeline13 The first step in pipeline is the tokenizer, responsible for fragmenting a text into tokens, usually a word. The rest of the pipeline is composed of a set steps, and the in Figure 9example, the last step shown is the Named Entity Recognizer (NER), responsible for identifying named entities. The pipeline is completely modular, a step can be disabled or modified, and the process of inserting a new component in the pipeline, usually corresponds to a new functionality. The proposed solution consists in adapting the NER component, in order to shape the Portuguese model to recognize a new set of named entities. The output of the pipeline, the Spacy document object, it is an iterable object, where each element is a token, and over each token, a range of methods are accessible. An important note is Spacy objects are immutable, for instance, filtering tokens from a document is a bad practice. Instead, these tokens should be filtered before the pipeline or the desired outcome stored in a new object. The main goal is to built and permanently store the new model. After accomplishing this task, the standard use case of processing information usually consists in loading the model, processing all the different textual documents through the model pipeline and extract the desired information from the resulting objects. 4.4 knowledge representation After introducing natural language technologies as a mechanism to extract information from documents (see Section 4.3) and an initial iteration of an Ontology, as described in Section 3.2, it is necessary to contextualize the knowledge representation in a web application, more precisely how to develop a semantic driven application. In the following sections, an introduction to the semantic web and respective standards is provided. After this initial contextualization, the supporting technologies used to effectively integrate the knowledge repository in the application are introduced. 13 Image source and additional details on the Spacy pipeline available at: https://spacy.io/usage/spacy-101# pipelines, Accessed in May 2021
4.4. Knowledge Representation 36 4.4.1Semantic Web In a simplistic manner, the internet can be interpreted as a group of pages with content. These pages may contain links, which connect one webpage to the next, effectively creating a network of pages. The main issue with this structure is most webpages are extremely human centric, in other words, most webpages were developed to be read and interpreted by humans. The information is scattered across the different elements within a web page and surrounded by text. Humans can easily read and interpret the meaning of the content, but in opposition, this format is not optimized for machines. The solution is the introduction of a standard and structured format, in order to organize the information in an easily machine understandable format, according to statements. These statements constitute a knowledge graph, and this internet is usually referred as the semantic web. Similarly to how a link connect one webpage to the next, the information follows a similar pattern. Each element contains a unique identifier, analogous to the unique URL that identifies a webpage. A relation simply is a link that connects one piece of information to the next, unlocking machines to interpret and extract meaning without heavy processing, in opposition of extracting information dispersed across blocks of text. The introduction of semantic web improves the internet usability by humans. Machines being able to connect different pieces of information and extract meaning from text, refine search engines results and data gathering systems. As an example, the Google search engine introduced in 2012 the Google knowledge graph 14 cards in their results. When a specific term is searched, a card with valuable information is displayed on the right-hand side. The content is the known related terms to the searched entity, accordingly to the Google knowledge graph. Date of birth or date of death of a person, are a few common examples of relations displayed in these cards. Figure 10 displays the Google card obtained after searching the Portuguese poet Camões on the Google search engine. 14 More information about the Google Knowledge Graph and respective cards available: https://en.wikipedia. org/wiki/Google_Knowledge_Graph, Accessed in December 2020
4.4. Knowledge Representation 37 Figure 10: Google Knowledge Graph Card 4.4.2Introduction to Knowledge Representation Standards The World Wide Web Consortium (W3C) 15 is the organization responsible for the development and maintenance of the standards used across the internet. When the semantic web was approaching, the introduction of a new standard to define and share knowledge was necessary. In the year 1997, W3C began the development of the new standard to describe semantics, the Resource Description Framework (RDF) 16 . This standard is one of the oldest standards introduced by the W3C in use today. 15 Official W3C webpage available at https://www.w3.org/, Accessed in October 2020 16 Additional details on the RDF standard available at: https://www.w3.org/RDF/, Accessed in October 2020
4.4. Knowledge Representation 38 4.4.2.1RDF RDF is the foundation for other more complex knowledge representation standards, introduced furthered down the line, similarly to how the HTML standard still is the fundamental element to display content on the internet till this day. Even modern full fledged web application, fundamentally display all the information in an HTML format. As previously mentioned, each piece of information on the semantic web is identified by a Universal Resource Identifier (URI). A relation between a pair of entities, in RDF is specified as a triple of elements, a subject-predicate-object triple. As an example the following sentence John likes to eat apples, the meaning can be expressed accordingly to a triple. John is the subject of the sentence, consequently, this entity is also the subject of the relation. In a similar manner, the term apple is the object of the relation. The predicate is the relation itself, the link between the subject and the object. In this particular example, a possible predicate is likes, or if the vocabulary allows a more specific term, likesToEat is another possible predicate. The knowledge graph is composed of these triples. By connecting additional triples such John likes Mary,John livesIn Spain and John studies Medicine, a network of information centered around John starts to emerge. 4.4.2.2RDFS The RDF Schema (RDFS) 17 is an extension of the RDF standard, but instead of being used to describe information in a triple format, this standard is used to describe vocabularies. As an analogy, the RDFS is the database schema, while RDF the tables with the content. The expressiveness of RDFS allows the definition of class entities, respective subclasses, properties, restrictions over the previously mentioned elements and the possibility of adding annotations. 4.4.2.3OWL The Ontology Web Language (OWL) 18 is another standard used to describe vocabularies, while providing a greater expressiveness in comparison to RDFS. Everything that is expressible with RDFS, it is also possible to be expressed with OWL, but an additional level is provided to refine the specifications. Initially, it is possible to define classes as disjoint. An instance of the class A cannot be simultaneously an instance of the class B, in case of disjointedness. In order to illustrate, for the musical instrument domain, the different musical instruments sub classes should be 17 Official website available at:https://www.w3.org/TR/rdf-schema/, Accessed in October 2020 18 Knowledge representation language, more information available at https://www.w3.org/OWL/ , Accessed in October 2020.
4.4. Knowledge Representation 39 defined as disjoints. A string instrument such as a guitar cannot be an instance of the class wind instruments simultaneously. The additional expressiveness allows properties restriction. For instance, a musical instrument should be classified as a string instrument, only if strings are part of the composition of the instrument. Furthermore it is possible to classify relations in OWL as functional, transitive, inverse and symmetric. A functional relation, for a particular subject, at most, has one object. For instance, the biological mother relation is functional, since it is impossible to define one person with two biological mothers. Ancestry is a good example to describe transitivity. For instance, John is father of Pete and Pete is father of Kate. Since John is ancestor of Pete and Pete ancestor of Kate, automatically John is also ancestor of Kate, her grandfather. Inverse properties denotes that for a relation from A to B, a relation from B to A must exist. For instance, the triple John hasParents Mary automatically has the inverse property Mary hasChild John. Symmetry is similar to inverse, but the relation from A to B, it is the same from B to A. For instance the relation siblings is symmetric. An important note is that OWL distinguishes object properties, relations between entities with a URI, and data properties, relation between a concept and a data-value attribute, elements without identifiers, such as an integer or a string. Further details on ontology development are available in the Horridge et al. (2009) guide. While an example ontology is defined, all the different concepts are carefully introduced. The example project was developed with Protégé, an open source ontology editor. 4.4.3Semantic Application Components In a previous Section 3.2.2, an analysis of sample documents culminated in the original iteration of the ontology. But some technical aspects remain unexplored, more precisely how to effectively store triples of information and how to manipulate them within an application context. In the following sections, the remaining components and technologies are carefully described. 4.4.3.1Semantic Application Components One of the main aspect of the knowledge repository is the storage solution, where different instances of entities and relation are permanently stored (del Mar Roldan-Garcia and Aldana- Montes,2005). A common solutions is storing all the different relations in a specialized database for semantic triples, a triple storage. This solution consumes more disk space than a relational databases and usually it is slower for very large datasets. The upside is these storage
4.4. Knowledge Representation 40 solutions are optimized for handling data in a triple format and export the results in semantic standards, including RDF. Other possible solution is storing the knowledge in a graph database. Neo4j 19 , Apache TinkerPop 20 , Titan 21 , GraphDB 22 are standard and readily available graph database implementations. In opposition of storing just the triples, the entire graph is permanently saved. Data manipulation requires a query language, and different databases provide different solutions. The standard query language for triples and knowledge bases is SPARQL 23 . This language has a similar notation to the SQL 24 query language and provides the possibility of retrieving data from multiple ontologies simultaneously, within the same query. Another unexplored aspect is the addition of reasoners in the knowledge repository. This component offers the possibility of deriving additional truths and automate the reclassification of concepts with class equivalences. Logical expressions are used to set the necessary conditions. This additional exploration introduced the remaining components of the knowledge repository. The definition of a well establish knowledge model, the ontology, and the integration of the processing pipeline, combines the process of extracting triples from documents and matching them accordingly to the ontology model. The rest of the knowledge repository is composed of a storage solution, a query language to manipulate the data and a reasoner to automate the reclassification process. 4.4.3.2Technology Selection As seen in Section 4.3, natural language processing technologies are available within a Python environment, and since the proposed approach is to utilize those technologies to extract the information from documents, the knowledge representation components should be compatible within the same environment. The goal is to mitigate potential integration issues. Furthermore, the Spacy toolkit provides a one stop solution to manage the entire annotation and extraction process. A desirable outcome is finding an integrated system to manage the entire semantic components. Protégé is a known and well establish knowledge management environment, but the goal is to manage the entire ontology within a Python 19 Official Neo4J webpage available at: https://neo4j.com/, Accessed in July 2021 20 Official TinkerPop webpage available at: https://tinkerpop.apache.org/, Accessed in July 2021 21 Distributed graph database, more information available at: https://titan.thinkaurelius.com/ , Accessed in July 2021 22 Semantic graph database. Additional details available in the official webpage: https://graphdb.ontotext.com/ , Accessed in July 2021 23 Additional details on the SPARQL query language available at: https://www.w3.org/TR/rdf-sparql-query/ , Accessed in July 2021 24 Additional details on the SQL query language available at https://www.iso.org/standard/63555.html , Accessed in July 2021
4.4. Knowledge Representation 41 environment. The main decisive factor was finding a technology where the functionalities of defining the ontology domain, storage, query and reasoning are available. Although Python provides multiple knowledge management packages, including the RDFlib 25 , the development was supported by OwlReady 26 , since it combines the entire semantic component as one integrated system. The ontology is defined by loading a standard OWL file or by directly defining the ontology in the Python environment. The development follows a design pattern similar to the object oriented paradigm. The class Thing is the superclass of all entities. In order to declare a new entity class, it must be declared as subclass of Thing or subclass of other previously defined entity. All of these definitions constitute the concept hierarchy of the Ontology. 1with onto : #Class Person is subclass of Thing 3class Person ( Thing ) : namespace = onto 5 #Class Foundling is subclass of Person 7class Foundling ( Person ) : namespace = onto Listing 4.2: Concept Declaration in OWLReady The relation definition is also class based, by defining it as subclass of ObjectProperty. The name of the class is the relation itself. Within the class body, the domain and range attributes set the subject and object of the relation respectively. with onto : 2# Triples ( Person , participatedIn , Event ) class participatedIn ( ObjectProperty ) : 4domain = [ Person ] range = [ Event ] 6inverse_property = attendBy Listing 4.3: Object Property Declaration Similarly, entity attributes are defined by declaring a subclass of DataProperty. The codomain is one of the available default types, including integers or string among other standard types. The OwlReady library is responsible for matching those types with the correspondent RDF element. 25 Python package to manipulate data in the RDF format. Persistency is provided via the BerkeleyDB triple storage solution. More information concerning the RDFLib and presistency available at: https://rdflib.readthedocs. io/en/stable/persistence.html, Accessed in July 2021 26 Latest Owlready documentation available at: https://owlready2.readthedocs.io/_/downloads/en/latest/ pdf/, Accessed in July 2021
4.4. Knowledge Representation 42 with onto : 2# Define datetime attribute class hasDate ( DataProperty ) : 4range = [ datetime . datetime ] Listing 4.4: Data Property Declaration Class restrictions and equivalences are set by defining a logical expression within the class definition. These expressions are utilized by the reasoner to deduce additional information. with onto : 2#A GodFather is a Male Person with at least one godson or goddaughter class Godfather ( Person ) : 4equivalent_to = [ Person & Male & hasGodchildren . some( Person ) ] Listing 4.5: Logical Expression for Class Equivalence As described, by extending the correct pre built Owlready classes and matching the correct attributes expected by Owlready, the knowledge domain is defined, following object oriented practices. All the different entities and relations instances, reside in a world object. A world is permanently stored in a SQLite3database27. Although SQLite is a relational database, the Owlready manages the storage solution similarly to a quadstore. Since the ontology requires constant small calls to the database, the storage solution must provide fast responses with low overload. As a result, the OWLReady development group decided to use SQLite3as the main storage solution. OWLReady offers multiple methods to manipulate the content. Since the ontology is defined accordingly to classes and the content is stored in a database, the knowledge component is manipulated similarly to a standard object oriented project, for instance, new entries by invoking a class constructor. Additionally, pre built methods including get_properties or get_inverse_properties, that return all the relations for a particular entity, remove the necessity of developing common queries. Another approach is the usage of SPARQL queries, since Owlready provides a query engine. Over a world object, the pre built Hermit reasoner is activated. The process of inferring additional knowledge and asserting the consistency of the ontology, consists in synchronize the reasoner. The inferred information is automatically added to the world object. An important note is the possibility of opening multiple worlds simultaneously, in order to separate the defined and inferred content in different worlds. For reasoning purposes, it is 27 OWLReady forum post, made by a member of the development team, justifying the usage of SQLite3as the main storage solution, in opposition of a standard triple storage. Webpage available at: http://owlready.306. s1.nabble.com/connection-to-triplestore-td512.html, Accessed in October 2021
4.5. Web Application 43 possible to set a world as opened or closed. Open world reasoning assumes that the non explicitly declared knowledge as unknown. In order to state false statements, they must be explicitly declared. In opposition, closed world reasoning assumes that the unknown is false. Figure 11 describes the entire OWLReady architecture. As the figure suggests, all components are fully integrated and accessible in a Python environment. Figure 11: OwlReady Architecture (Lamy,2017) 4.5 web application A standard practice in web development is the usage of web frameworks, which provide additional resources, for instance database management or templates engine, within the same environment. One of the main aspects taken in consideration is the integration with the extraction and repository components. Since those components are compatible within a Python environment, the framework selection was restricted to that particular environment, the goal is to mitigates potential integration issues or increase the complexity of the architecture. Within a Python environment, well established web frameworks are available, including Django 28 and Flask 29 . Although both frameworks support the development of web appli- 28 Official Django framework page: https://www.djangoproject.com/, Accessed in June 2021 29 Official Flask framework page: https://flask.palletsprojects.com/en/2.0.x/, Accessed in June 2021
5.2. Entity Extraction 50 Initially, the process of cleaning the data involved the usage of standard spellcheckers available in a Python environment 2 . But the oddly placed punctuation inside words and the gap between former and current Portuguese provided disappointing results. For instance, a word replaced by another word with a completely different meaning and tokenization issues, resulting from the odd punctuation and white spaces. To overcome these issues, misspelled words were analysed. Since the documents provided are constrained to a small domain and most documents follow similar patterns, the same spelling issues and missing characters were frequently found. A possible solution is simply replacing that small pool of common errors by the correct form, instead of training or building a complex auto correct and spellchecking system. The approach of simply finding and replacing common errors for this specific domain, provided positive results. The replacement table is stored in a two column CSV file, the first column stores the incorrect form and the second column the version with the correct spelling. When a close match is found, for instance after ignoring case sensitivity and comparisons against the lemmatized form, the incorrect tokens are replaced. 5.2 entity extraction For the specific domain of this project, foundling wheels and hospices, the desired entities are centered around these institutions, since they are the source of the archive. The process of defining the important entities to be extracted from each document, was supervised by the archivists. After meetings and respective discussion process, the following list compiles the agreed entities that should be extracted: • Pessoa - Identify a person contained in a document. This label marks the name of a person, • Funcao Pessoa - Role of a person in this particular context. Terms such as foundling, nurse, priest or all the different family relationships referenced in a document are a few examples of possible instances, • Evento - Events described in the documents. The analysed documents contain a wide range of referenced events such as the entrance of a foundling in the institution, birth, baptisms, adoption, reclaims by the biological family or death of a person. Events are extremely important to study the life story of each person, • Item - Items or belongings of each foundling. Usually this label denotes the items that constitute the layette, 2 Pyspellchecker, ContextualSpellCheck and Hunspell were the spellchecking packages tested. More information available at: https://pypi.org/project/pyspellchecker/ , https://pypi.org/project/ contextualSpellCheck/ and https://pypi.org/project/hunspell/, Accessed in April 2021
5.2. Entity Extraction 51 • Local - Label used to identify locations. This entity is extremely important for example to denote where each event occurred, such as the place of birth, • Identificador - Identifier of each foundling. Each institution marks each foundling with a unique number, • Data - Dates, entities used to identify two main elements: the year of the identifier and the date of a particular event, such as date of birth, date of death or date of entrance in the institution, • Instituição - Institutions referenced in the documents, such as a foundling wheel or hospices. After defining the entity set, the next step is effectively extract these elements from each document. 5.2.1Entity Extraction Component As previously mentioned, it is necessary to reshape the standard NER component, in order to extract a new set of entities. The entire process was initialized with the development of a training dataset, a set of annotated examples. Previously, the transcriptions were extracted from word documents and the resulting clean document were temporarily stored in a pure textual format. These documents were annotated with the Doccano, similarly to the concept identification process shown in Section 3.2.1, but this time the process was repeated over a newer and larger dataset, more specifically, thirty clean transcripts were annotated. Although this is a relatively small number for a training dataset, during the development of this component, not all transcriptions were available and some transcriptions must be reserved to analyse the system behavior when it is faced with unseen data. In order to develop the trainable NER component, multiple approaches are available, from the development of an entire system from scratch to the adaptation of a pre existing system. In the third version of the Spacy toolkit, Spacy projects were introduced. In a simplistic manner, a Spacy project is a system to structure and organize the different components of a project, accordingly to a well defined folder and file dependencies, commands line tools and a range of other pre-built components. An analogy is a web development framework, where by instantiating a new project, a project folder with some groundwork is automatically initialized. Since Spacy is oriented for the development of NLP powered applications, it is possible to instantiate not only a new blank Spacy project, but also a new project specialized to perform known standard natural language tasks, where the underlying machine learning models
5.2. Entity Extraction 52 are provided. One of the available pre built Spacy projects is a trainable NER project. The proposed solution consists in adapting the standard trainable component of the processing pipeline to identify entities from the foundling wheel domain. The modifications mostly consisted in adapting the trainable component to the Portuguese language, adapt the machine learning parameters and match the Doccano output format to the expected by the trainable component. The output of this process is a new Portuguese based model, with an updated entity recognizer. The new language model is permanently stored and the entity extraction process consists in loading the updated language model and process each document through the updated pipeline. All the identified entities are accessible in the .ents attribute, available in every document after being processed by the pipeline. Towards the results obtained, an empirical analysis was made via processing transcriptions, including unseen documents, through the updated model. The results were analysed resorting to a visualization tool provided by Spacy. As an example, Figure 12 shows a transcription after being processed through the pipeline. Figure 12: Entities Automatically Identified in a Transcription The automatic entity recognition provided positive results, even though the training dataset was fairly small. The main issues found were unreadable tokens being wrongly labeled, which must be ignored, and numbers being wrongfully labeled. To overcome the latter issue, a small set of patterns were developed to correct the wrongfully identified entities. For instance a pattern that labels a number followed by the word reis as dinheiro and the token Nº followed by a number as id_exposto.
5.3. Relation Extraction 53 5.3 relation extraction After accomplishing the the entity extraction, the goal is to expand the processing pipeline by automating the identification of meaningful relations between named entities. Relation extraction is an active research area in the natural language domain, and the available solutions are generalized into two main approaches. The first and more traditional approach is a pattern based solution. This extensive approach usually consists in a group of patterns, such as regular expressions, to find matches in a text. Similar approaches include token level analyses, for instance filtering bigrams or trigrams and filtering the predicate-subject-object from sentences. The second main approach is a machine learning based solution. Similarly to the process of training the entity recognizer, state of the art NLP technologies train a model to extract relations between named entities. In this project, both possibilities were carefully inspected, and in the end, both approaches were followed. Initially, the proposed solution followed a pattern based extraction. Since all the named entities were automatically annotated and the format of most documents is fairly structured, the relation extraction task was a viable solution. The goal was to develop a relation extraction component without the intensive model training and additional pipeline components. Unfortunately, this solution did not provide the expected results, and the development process was stuck in this stage. The main difficulty found was the development of patterns capable of extracting relations between fairly distant entities within a document. To overcome this issue, a machine learning based solution was followed, a similar approach to the entity recognition. Although the machine learning solution was capable of extracting relations between named entities, towards the end of the development cycle, the pattern based solution was revisited, resulting a set of better results. In conclusion, a pattern based and a machine learning based solution were developed to extract relations from documents. In the following sections, the different approaches are described. After analysing both cases, a discussion on the proposed solution and the model currently in use. 5.3.1Pattern Based Relation Extraction The pattern based solution is a combination of the matcher and the dependency matcher, parsers provided by the Spacy toolkit. The regular expression concept is a good entry point to understand these parsers. A regular expression is a pattern used to match a section of a text. For instance, the regular
5.3. Relation Extraction 54 expression [0-9]{9}matches numbers with nine digits, expression useful to extract the civil id number of a Portuguese citizen. The matcher works in a similar manner to regular expressions. A pattern consists in describing token level rules to be matched in a Spacy document. The advantage provided by this tool is the possibility of developing patterns not only at the textual level, but also developing patterns over the attributes accessible by a token. Attributes such as Part Of Speech (POS), lemmatized form, shape, morphological analysis and named entity label are just a few examples of possible components to be match with a pattern. To illustrate a matcher use case, the goal is to extract places that a person likes or visited. A valid approach if filtering the name of a person by the part of speech, more specifically, filter proper nouns and pronouns. The destination is labeled as LOC or GPE by the standard entity recognizer. For relations, the lemma removes the variations caused by the tense, aspects and mood of verbs. This patter could be written as following: pattern = [ 2{ "POS" : { "IN" : [ "PROPN" , "PRON" ] } } , # f i l t e r Proper Nouns and Pronouns { "LEMMA" : { "IN" : [ " like " , " love " , "go" ] } } , #any form of the verb like , love ⤦ Çand go 4{ "POS" : "ADJ" , "OP" : " ? " } , # optional adposition { "ENT_TYPE" : { "IN" : [ "LOC" , "GPE" ] } } # named entity labeled as Location 6] Listing 5.3: Matcher Pattern Example The pattern shown in Listing 5.3should match the following sentences: John likes Spain, He loved France or Mary went to Portugal. As the previous example suggests, with a fairly compact pattern, a wide range of relations are extracted from a document. In opposition, writing the equivalent pattern with text level regular expressions is a difficult task, since it is required to handle all the different forms of a verb, specifying the possible locations and extensive list of valid names. The dependency matcher is a similar to the standard matcher, but provides a different approach to link sequences of matched tokens. A Spacy model provides a dependency parser component, which develops a tree of words from a sentence, structured accordingly to the syntactic dependency. For instance, Figure 13 contains a dependency tree of a sentence. As the Figure 13 suggests, the verb visited is the root of the tree.
5.3. Relation Extraction 55 Figure 13: Dependency Tree of a Sentence The dependency matcher is a combination of the standard matcher and the dependency tree. Instead of matching adjacent tokens, the pattern matches the tokens accordingly to the structure of the tree. The navigation through the tree is set by Semgrex operators 3 . These operators set the depth of the comparison, for instance, comparisons against the immediately precedent token, direct relation between two tokens or navigate through the entire subtree. The proposed solution consists in finding patterns that link two named entities. Each entity is interpreted as an anchor, and according to the label of the named entity, the matcher finds the respective relation. As a concrete example, two important entities in this project are the Pessoa, used to denote the name of a person, and the entity Evento, which marks important events. For every person found in the subtree of the event, the system automatically infers them as a participant. For example, Listing 5.4describes the pattern that looks for people within the subtree of an event, the participants. pattern = [ 2{ "RIGHT_ID" : " evento " , 4"RIGHT_ATTRS" : { "ENT_TYPE" : " Evento " } } , 6{ "LEFT_ID" : " evento " , 8"REL_OP" : ">>" , "RIGHT_ID" : " participa " , 10 "RIGHT_ATTRS" : { "ENT_TYPE" : " pessoa " } } 12 ] matcher . add( " evento_pessoa " , [ pattern ] ) Listing 5.4: Dependency Matcher Example 3 Additional details on the Semgrex operators and supported relations available at: https://nlp.stanford.edu/ nlp/javadoc/javanlp/edu/stanford/nlp/semgraph/semgrex/SemgrexPattern.html, Accessed in June 2021
5.3. Relation Extraction 56 Listing 5.5describes a standard matcher pattern, which matches contiguous tokens. This pattern links an identifier and a person. Optionally, the pattern may associate a date attribute to the identifier, in order to extract sequences such as Nº8de 1867. 1pattern = [ { ’ENT_TYPE ’ : ’ id_exposto ’ } , 3{ "POS" : "ADP" , "OP" : " ? " } , { ’ENT_TYPE ’ : " data " , "OP" : " ? " } , 5{ "POS" : "PUNCT" , "OP" : " ? " } , { ’ENT_TYPE ’ : ’ pessoa ’ } 7] matcher . add( " id_exposto " , [ pattern ] ) Listing 5.5: Matcher Example The remainder of the relation extraction process consists in the development of patterns to extract other meaningful relations. The following list compiles the main patterns. Each relation is described accordingly to the domain and codomain entity label. •Função Pessoa - Pessoa : Person and their role, •Função Pessoa - Local and Pessoa - Local : Location or residency of a person, •Função Pessoa - ID and Pessoa - ID : Personal identifier, •Função Pessoa - anoID and Pessoa - anoID : Personal identifier year component, •ID - anoID : Identifier and year of the identifier relation, •Evento - Data : Date of an event, •Evento - Local : Location of the event, •Evento - Pessoa : Participant of the event, • Data - Local : Location and date association, pattern used to indirectly extract event locations, •Instituição - Local : Location of the institution, • Local - Local : Connects sub locations. For instance, a locations with a street, city and country. Each pattern developed contains a unique label, used for automatically infer the nature of the relation. The matcher is invoked with all the available patterns and the output is an iterable object with all matches. For instance, the Função Pessoa - Pessoa relation is labeled as
5.3. Relation Extraction 57 fp_pessoa. During the process of iterating through all the matches, when a relation matched by this pattern is found, that particular label is accessible and the nature of the relation is automatically inferred, without additional processing. 5.3.2Machine Learning Based Relation Extraction The process of developing a relation extraction component follows a similar approach to the identification of named entities from Section 5.2.1. As previously described, Spacy provides a set of pre built projects, extremely adaptable and capable of solving standard natural language tasks. One of the available pre built projects is a trainable relation extraction component, based on a bioinformatics example 4 . The goal is to adapt and incorporate the relation extraction component in the pipeline of this project. The development process was initiated with the standard large Portuguese linguistic model, previously modified to identify a new set of entities. This model is not capable of extracting relations, since a Relation Extraction (REL) component is not available in the processing pipeline. As a result, the relation extraction component is inserted after the entity extraction, since the goal is to extract relations between named entities. Updating the model consists in inserting the REL in the pipeline, training the newly added component and permanently store the updated model. Similarly to the entity extraction, a new dataset with samples of positive relations is required for training purposes. In order to access the previously identified entities and ensure the usage of the same tokenizer during the annotation and training process, a Jupyter notebook replaced the Doccano annotation tool. The annotations are exported as a JSONL file, a line for each document with a list of entities pairs, linked by a particular label. The updated model contains the retrained NER and the newly added REL component. By processing a document through the pipeline, the identification of named entities and respective relations is automated. 4 More information on the base relation extraction model available at: https://github.com/explosion/projects/ tree/v3/tutorials/rel_component, Accessed in June 2021
5.4. Entity Linking 58 5.3.3Final Notes on Relation Extraction In order to automate the relation extraction from documents, a pattern (Section 5.3.1) and machine learning (Section 5.3.2) approach were explored. In this section, both alternatives are briefly analysed by taking in consideration the trade-offs of each approach. In the end of this section, the solution currently in use is introduced. The pattern based is a simple solution, providing positive results since the structure of most documents is fairly similar. The main disadvantage is the dependency tree is sentence bound, as a result, it is not possible to related elements beyond the sentence limits. In opposition, the machine learning approach offers cross sentence extraction. The main disadvantages is the training process requires large datasets, with a lot of positive examples, which it is beyond the current state of the archive with circa 200 documents. Due to time constraints, one of the solutions had to be chosen, developing a hybrid solution or improving the machine learning component was not viable. Ultimately, the pattern based approach was chosen. Although cross sentence relations are not automatically extracted by the dependency tree matcher, the matcher approach provided better a set of better results in a direct comparison against the machine learning approach. In order to overcome the sentence bound limitation, additional patterns were developed. These patterns contain optional punctuation, to extract relations between elements close to the end of a sentence and the beginning of the next (as seen in Listing 5.5). Furthermore, the pattern based solution provides on the fly adjustments. In the later stages of the development process, a new pattern is easily added or updated, without retraining the entire model nor providing a large dataset to train a new relation type. 5.4 entity linking The final component of the information extraction process is solving possible ambiguities. Over a document, it is fairly common for an entity to be referenced multiple times. The system should be able to determine that all of those references, in reality, are instances of the same entity. For example, a simple document composed of two sentences: John was born in Scotland and John was born in 2021. Both Johns are an instance of the same entity. By acknowledging that these pieces of information are referencing the same person, the system starts to connect the dots, developing knowledge over a particular entity. The opposite scenario also provides ambiguities issues, since similar terms are used to describe distinctive entities. For instance, references to people with the same first name or a document comparing Paris, France to Paris, Texas.
5.4. Entity Linking 59 In this particular project, the entities impacted the most by the ambiguity issue are the locations and people. Most of the remaining concepts are attributes in the knowledge repository. Wrongfully linking independent entities introduces inconsistencies in the knowledge repository. Simultaneously, not providing sufficient linkage, introduces repetition in the knowledge domain and a lack of interconnectivity. The goal is to establish a balance, automatically linking entities without compromising the consistency of the knowledge repository. Spacy provides an entity linker and machine learning based approaches 5 . The goal is the development of a dataset composed of attributes that characterize each entity. A model is trained in order to match unambiguous entities to a unique identifier, according to context. Although this approach is a viable solution, some obstacles were faced. A dataset with all the locations found in the sample documents was developed and used to train the model. The main issue found was an insufficient number of training examples. For locations such as the residency of a person, that only appear a handful of times, the system was not capable of matching them to any identifier. Recurring municipalities such as Cabeceiras de Basto,Celorico de Basto or Fafe, were the only few learnt the locations. Another issue is the world is open. Since the goal is to develop a web application where new information is constantly inserted, unknown entities are an issue. The system is not capable of performing the entity linking task over untrained entities, where their attributes and context are unknown to the model. The development of periodic training mechanisms and updated datasets to contextualize recently unlinkable entities are beyond the scope of this project. Additionally increases the complexity of the system. The proposed solution was the develop a simple system to solve ambiguities. The previous developed locations dataset 6 , was repurposed, with the development of a repository. The locations with known variabilities, for instance São Romão do Corgo,Corgo,São Romão and freguesia de S. Romão are stored as a reference to the same location. The attributes used to contextualize the entities for the training model, were repurposed as a location description. Every time a close match is found, the entity linking occurs, otherwise, a new location is instantiated in the repository. The document level ambiguity of personal names is solved with the development lists of possible candidates. The list of candidates is filtered according to the part of speech, morphological analyser and token level similarity. After the filtering process, if a candidate 5 ML based entity linking Spacy project available at: https://github.com/explosion/projects/tree/v3/ tutorials/nel_emerson, Accessed in July 2021 6 Dataset combines both current and former Portuguese geographical locations, Sources used: https:// www.csarmento.uminho.pt/site/s/arquivo-digital/item/94131 , https://www.codigo-postal.pt/ , https:// cabeceirasdebasto.pt/concelho-freguesias-alvite-passos , https://www.wikidata.org/ , Accessed in August 2021
5.5. Ontology Integration 66 •hasLifeStory - Additional description of a particular person, •hasReferences - Additional textual references to a particular entity, • hasRegulation - Textual attribute to denote regulations and other general rules of the institution, An important note is the date attributes were defined as a datetime object. Although most date references have no time reference, the Hermit reasoner in OWLReady does not support date only objects. As a result, all dates were defined as a datetime objects, automatically setting the time to zero hours, minutes and seconds. 5.5.1.3Class Equivalences The class equivalence is a logical expression that sets the minimum requirements or the sufficient condition for a concept classification. These conditions are used by the reasoner to automate the reclassification process, according to the currently known attributes and relations of each concept. In this particular project, every instance is initially set as generic as possible, since it is assumed that the newly added entity is unknown from the perspective of the repository. As an example a new person is always initially set as an instance of Person. After an instance is updated with new attributes or relations, a sufficient condition may be met, consequently the reasoner is activated every time the knowledge repository is updated. In order to illustrate the reclassification process, the evolution of a person instance is followed. Initially, the new person is defined as general as possible, simply as an instance of Person. The gender class contains two main equivalences: Person & hasGender.value("Male") and Person & hasGender.value("Female"). By providing a gender attribute and activating the reasoner, the person is reclassified, the result is both an instance of Person and their respective gender. Similarly, the classification of Mother and Father have the following respective equivalences: Person & Female & hasChildren.some(Person) and Person & Male & hasChildren.some(Person). When their descendent is detected by the reasoner, this person is also reclassified as a parent. The classifications Person Male Father and Person Female Mother are the possible outcomes of the followed example. Over the remaining available classes, similar equivalence expressions were defined. By combining the defined ontology, the logical equivalences and activating the reasoner after insertion, the reclassification of concepts according to the known attributes and relation is automated.
5.5. Ontology Integration 67 5.5.2NLP Pipeline and Ontology Integration The natural language pipeline automatically annotates information from documents and the ontology manages the information in a triple format. The remaining task is to integrate these separate components, link the results of the NLP pipeline to the correct ontology concept or attribute. After processing a document through the Spacy pipeline, the entities, relations and respective labels sets are available. The process of connecting the output of the Spacy pipeline and the ontology, consists in instantiate or load pre existing entities in the ontology, iterate over the newly extracted triples set and match the named label to the ontology concept constructor or relation predicate. An important note is some entities require additional processing before the insertion process in the ontology. Since this project deals with text, ambiguity is an extremely common issue. For instance, the entity recognizer is capable of identifying a date, but the ontology requires a valid datetime object. Since dates are written according to different formats, issues such as case sensitivity, misplaced or missing stopwords and written numbers, are not automatically parsed by the datetime object. Similarly, the identifier is written in different variants, for instance, número 1,número um,nº 1or Nº um are possible representations. The ontology expects an integer value. Additionally, a set of words may be used to express a concept or relation with the same meaning. For instance, the event death in Portuguese may be written as morte or faleceu. Similarly, different ecclesiastical titles, such as priest or abbot, from the point of view of the ontology, are an instance of a generic religious figure. The proposed solution to handle the parsing and ambiguity issues is a combination of different linguistic features from different packages. Initially, the Spacy package provides a morphological analyser. This component predicts for each token the part of speech, grammatical gender or the grammatical number, among other attributes. These predictions are useful to process additional content, for instance, infer the gender based on the grammatical gender of the first name. Additionally, Spacy provides a lemmatizer, used to solve grammatical number issues and tense–aspect–mood of verbs. The Hunspell was the second library used, which provides a spellchecker and an additional lemmatizer. The spellchecker is used to solve minor issues, for instance, spellcheck the name of a person or written numbers. In order to preserve the original content, personal names were not spellchecked during the cleaning process. But in the back-end of the gender guesser, the spellchecked form is used. Furthurmore, the additional token level lemmatizer is used as a backup tool. Since the Spacy lemmatizer takes in consideration the context of
5.5. Ontology Integration 68 the word in the document, in the case of bad predictions, the Hunspell lemmatizer is used instead. The functions responsible for parsing the attributes of concepts, combine all of the previously mentioned concepts. More specifically was developed a number, identifier, date and gender guesser. In order to solve ambiguous terms, the proposed approach uses the Fuzzywuzzy library. This tool provides a similarity score for a word, or set of words, against a defined set. Initially, for each Ontology concept, a set of acceptable terms is defined, similar to the process of defining a set of synonyms. The similarity between the extracted entity and the set of synonymous is calculated. If the similarity is eighty percent or higher, the application accepts that term as valid and the lemmatisation occurs. This is the fundamental step for matching the extracted named entities from the processing pipeline and the respective class constructor of concepts in the ontology. Fuzzywuzzy provides a range of matching algorithms 15 , including the Levenshtein Distance, but the main algorithm used is the partial ratio. The classification is calculated according to the ratio of the most similar sub-string. This algorithm was chosen because some entities are multi token. 15 Article describing the available matching algorithms in the Fuzzywuzzy package. Available at: https:// chairnerd.seatgeek.com/fuzzywuzzy-fuzzy-string-matching-in-python/, Accessed in April 2021
6 FOUNDLING WHEEL VIRTUAL MUSEUM The web application is the final component of the proposed solution, responsible for establishing the connection between the end user and the knowledge repository. As previously noted in Section 5.5.2, the relation extraction pipeline and ontology are fully integrated. The main objective is to expand these components by incorporating them in a web application and effectively materialize a platform supported by a knowledge repository. This chapter provides the description of the system architecture and culminates in a navigational example over the main webpages. 6.1 web platform architecture The application is semantic driven and by design must provide a user friendly interface to interact with the knowledge repository. When an end user accesses an area of the application containing entities, the currently known attributes and relations are displayed via a web browser. Additional details on the design and development of semantic driven applications available at (Hyvönen et al.,2004;Shekhar et al.,2013). Figure 14: Interaction With the Knowledge Repository 69
6.1. Web Platform Architecture 70 Figure 14 describes the general architecture. The three main components match the processing pipeline responsible for the extraction of triples from text, then these triples become available to the application, accessed by querying the knowledge base. Figure 15: Resources Rendered as HTML Pages As the Figure 15 suggests, by rendering the knowledge base, a network of pages emerge. Each resource is rendered as an HTML page, easily identifiable since each instance contains a unique identifier, the URI. Relations between concepts are expressed as links between webpages, providing a presentation layer to the knowledge repository. Additionally, Figure 15 describes a tree hierarchy between these webpages. Each book has its own page, which itself links to pages of that particular book, the transcriptions. Within each transcription page, instances of concepts are linked and the navigation through the knowledge repository is initiated. The entire architecture of the application, from the information extraction to the interaction between the end user and the knowledge base, it is represented in Figure 16.
6.2. Back-End Components 71 Figure 16: Updated Architecture 6.2 back-end components This section introduces the main components of the back-end of the application, more specifically, focuses on the models and the storage solutions that support the knowledge repository. This section is concluded by analysing the integration of the processing pipeline in the web application. 6.2.1Models and Storage Solution The application requires the development of database models to define the digital archive. As analysed during the development of the datasets, as explained in Section 5.1.1, the documents are organized according to books and transcriptions. Additionally, the result of the processing pipeline is permanently stored in a knowledge repository. The proposed solution preserves a separation between the knowledge repository and the remaining components. The OWLReady manages an independent database, where the World instances with all the concepts and relations reside. A second storage solution was developed to support the application, where instances of Books, Transcriptions and Users are stored.
6.2. Back-End Components 72 6.2.1.1User Model The application supports the standard CRUD operation, as a result, the content manipulations requires protection. Without any control, a malicious user is able to delete or wrongly modify the content preserved. The proposed solution consists in the development of users restrictions in the application, limiting the content manipulation to a restrictive set of users with a specific set of permissions. A regular user is only able to read the available content. The login process is a standard email and password procedure, and the additional permissions are set by the admin. A standard new account is set as an active account, without additional permissions. The following list describes the User model: •id - User identifier, •email - Email of the user, •username - Username of the user, •password - Password of the user, •date_joined - Account creation date, •last_login - Last logged date, •is_admin - Has admin permissions, •is_active - Has active account, •is_staff - Has staff permissions, •is_superuser - Has superuser permissions, 6.2.1.2Book Model The Book model is an extension of the descriptive attributes previously identified during the development of datasets, as explained in Section 5.1. The additional attributes are standard management information, including publishing date and poster. Furthermore, the model supports the addition of a picture of the physical book. The following list describes the Book model: •id - Book identifier, •titulo - Book title, •cota - Book identifier,
6.2. Back-End Components 73 •termo_abertura - Open notes, •termo_encerramento - Final notes, •observacoes - Observations, •datas_extrema_inicial - Date of the oldest document, •datas_extrema_final - Date of the newest document, •dimensoes - Dimensions, •image - Cover Image, •date_published - Publishing date in the platform, •date_updated - Latest update date, •author - Original poster, •modified_by - User responsible for the latest update, •slug - Resource identifier. 6.2.1.3Transcription Model The Transcription model describes each document contained in a book. The Transcription model is similar to the Book model. The main difference is a foreign key to link the transcription to the respective book. Additional, the attribute transcription_clean stores the result of the processing pipeline and the onto_marks attribute links entities found in the document, known instances stored in the knowledge repository. The following list describe the Transcription model: •id - Transcription identifier, •folio_num - Archival identifier, •transcricao - Original transcription, •transcricao_clean - Transcription after processing, •transcricao_lateral - Side notes, •observacoes - Observations, •onto_marks - Links to referenced entities, •author - Original poster,
6.2. Back-End Components 74 •image - Picture of the document, •livro - Book foreign key, •date_published - Publishing date, •date_updated - Last update date, •modified_by - User responsible for the latest update, •slug - Resource identifier. Figure 17 shows the Entity Relation Diagram (ERD) of the main database: Figure 17: Main Database ERD1
6.2. Back-End Components 75 The content is effectively stored in a SQLite database. The main decisive factor was the integration with the Django framework, which provides a built in ORM. This solution supports the current version of the project. In case of outgrowth, Django provides the additional tools to migrate to other compatible storage solution. 6.2.1.4Knowledge Representation The second datasbase is the triple storage solution, where the entities and relations are permanently stored. The database model is the ontology concept hierarchy. Figure 18 captures the entire ontology conceptual model: 1 ERD rendered with a Django extention. More information available at: https://django-extensions. readthedocs.io/en/latest/graph_models.html, Accessed in November 2021
6.4. Navigation Example 82 In the transcription page, the knowledge repository is accessible. Similarly to a Wikipedia page, where within the text other pages are linked, the transcription references known entities. Figure 24: Marked Entities As Figure 24 suggests, entities are highlighted, with the respective label on the right hand side, written in all caps. These elements are color coded, following a similar approach to an annotation tool. An important note is in order to maintain the readability of the transcription, only entities with relations are highlighted. Additionally, attributes in the knowledge repository, data properties, are not highlighted. The colorful blocks are links to other webpages. In these entity pages, known attributes and relations are displayed. For instance, Figure 25 displays the personal information of Guergório, the foundling referenced in the transcription shown in Figure 24.
6.4. Navigation Example 83 Figure 25: Personal Information Example Linked entities are underlined in the cards displayed. As seen in Figure 25, the foundling Guergório participated in one event, his entrance in the institution. By following the event link, a new card with the event details is displayed. Figure 26 shows the resulting card. Figure 26: Event Page Example
6.5. Summary 84 6.5 summary This analysis over the main webpages of the application, incorporates the essential use cases of the application. A user is able to simulate a physical access, by choosing a book and iterate through the available transcriptions. The transcriptions have an important role, as an entry point to the knowledge base. Entities are linked and displayed in the respective web page. Additionally, the application provides the standard features expected in a modern website, including user sessions, search functionalities and user friendly pages to update the knowledge repository.
7 CONCLUSION This document discusses the development of a web platform, focused on the foundling wheel domain. Archivists and collaborators of the Municipal Archive of Fafe, have been preserving and digitizing historical documents, from different collections and domains. This process preserves unique records, filled with cultural significance, beyond the physical format. One of these collections is the foundling archive, which includes documents dated to the nineteenth century, from historical institutions that supported the exposed children. These documents are the surviving records from foundling wheels and hospices dispersed across the Northern Region of Portugal. Although at a first glance the foundling domain may seem insignificant, since these institutions no longer exist, the anonymous child abandonment is a problematic that societies across the globe are facing till this day. A recent increase in the abandonment numbers is pressuring countries to reintroduce mechanisms to handle this problematic. These new solutions essentially are a new iteration of the foundling wheel, simply replacing the former wheel and bell by sensors and cameras. The challenge of developing a web platform, which simultaneously preserves and disseminates these mostly unique records, it is an important and fulfilling project. The research hypothesis is the possibility of developing a digital platform supported by a knowledge repository, from the identification of concepts and respective relations, contained in documents concerning foundlings. The nature of the knowledge repository, offers an exciting technical project, by automating the content extraction via natural language processing. The development of this project verifies the research hypothesis, and this document, describes the entire process. Initially, the anonymous child abandonment problematic was contextualized. Children are one of the most vulnerable groups, and as a result of the abandonment process, some unsupported children unfortunately die. In order to overcome this issue and effectively save lives, centuries ago the foundling wheel was established. Theses institutions provided a safe 85
86 abandonment process, without compromising the anonymity of the perpetrators. After the abandonment, these children were institutionalized. Although these institutions raised the foundling population, the poor living conditions provided, amplified the voices of critics and opponents, culminating in the termination of these institutions. Hospices replaced them and governmental support was redirected to families in need. A recent resurgence of anonymous abandonment, led to a reconsideration of the extinct foundling wheel. The baby box and the safe haven law are the most common solutions. Both essentially provide the main function of the foundling wheel, an anonymous abandonment without compromising the identity of the perpetrators nor criminal repercussions. The application development was initialized with an analysis of sample documents. This process had the fundamental role of determining the main concepts and meaningful relations frequently found in these documents. The conceptualization defines the knowledge domain, the structure of the main repository. Life events and personal relationships are the main topics specified. The Spacy natural language toolkit is the underlying technology used for automatically identify instances of concepts and relations, accordingly to the knowledge domain previously defined. This solution consists in a processing pipeline, composed of an entity recognizer and a relation extraction step. By processing a document, the desirable entities and relations are extracted, ready to be permanently stored in the knowledge repository. Prior to this processing, each document is cleaned, which removes additional punctuation and white spaces. Directly after, each document is spellchecked. The knowledge repository management is supported by the OWLReady toolkit. This component permanently stores the extracted entities and relations in a database, accordingly to the ontology model. Additionally, this tools contains a query engine and a reasoner, used to reclassify and assert the consistency of the knowledge domain. The final component is a web application, developed with the Django framework. This application incorporates all the previously developed components and establishes the link between the end user and the knowledge repository. Each entity is shown in a separate webpage. These pages display known relations and attributes of a particular entity. Additionally, the books and transcribed documents are accessible, effectively simulating the act of physically grabbing a book and read it. During the development process of this project, two main obstacles were faced. Automating the extraction of meaningful relations from documents was a difficult task. Linking distant entities in a document and solving ambiguities issues, set back the development of the relation extraction component. The second main issue was the integration of the knowledge repository in the web application. During the integrating of these separate components, concurrency issues where found
7.1. Future Work 87 while accessing the knowledge repository. The technical support and recommendations provided by the OWLReady development team, were essential to overcome these issues. The main objectives of this project were successfully accomplished. The final application disseminates the archived documents. Additionally, the support provided by the knowledge repository, improves the access to important entities and relations extracted from documents. The direct access to the information, increases the usability of the application, by highlighting and interconnecting content dispersed across documents. The main advantage provided by the proposed solution is the automation of the annotation and extraction of information from documents. The management of the knowledge repository was automated by the extraction pipeline and the usage of reasoners to reclassify the information, every time the repository is updated. In the point of view of the end user, processing information was fully automated, the only requirement is providing a new document in a pure textual format. In the back-end, the system automatically handles the entire processing. The platform is accessible in the following link: http://arquivoexpostos.epl.di.uminho. pt/. 7.1 future work Although the application provides the expected functionalities, possible improvements, in the perspective of usability and new functionalities, were identified. One of the most important improvements is the incorporation of an annotation tool in the client side of the application, similar to Doccano. Currently a user is able to see color coded entities, and by clicking them, the user accesses the webpage of that particular entity. By further developing this component, a user could drag a relational arrow and label undetected entities and relations. This user friendly interface would drastically improve the knowledge repository and unknowingly, these users develop larger datasets to train the entity and relation extraction models. A second improvement is the development of an API and SPARQL end point in the application. These functionalities provide to a technical user base custom access to the knowledge repository, besides the standard use cases. Offering direct access to data manipulation may compromise the consistency of the entire knowledge repository, as a result, additional security measures are necessary. The final improvement is the integration of the developed knowledge base with popular and established ontologies. Accomplishing the integration, this project is opened to a whole new set of exciting challenges, beyond the standard dissemination of the archive. As an example, the WikiTree platform contains a wide range of projects, currently under
7.1. Future Work 88 development, over their world wide family tree. The Adoption Angels 1 project has the goal of helping adoptees finding their biological family. Since the foundling archive preserves genealogical information concerning the Portuguese foundling population, the content extraction and repository developed in this project, could be integrated in a similar project. This exemplary extension of this project, would provide a tool to study the ancestry, roots and known facts about families impacted by the foundling problematic. 1 Official Adoption Angels project page: https://www.wikitree.com/wiki/Project:Adoption_Angels , Accessed in December 2021
BIBLIOGRAPHY Roda dos expostos. Abandonar um filho sem que ninguém saiba, Jan 1970. URL https://ionline.sapo.pt/artigo/663730/ roda-dos-expostos-abandonar-um-filho-sem-que-ninguem-saiba-?seccao= Portugal_i. Learn About The Foundling Hospital: The Foundling Museum, May 2018. URL https: //foundlingmuseum.org.uk/about/our-history/. Cristiana Araújo. Building the Museum of the Person Based on a combined CIDOC-CRM/ FOAF/ DBpedia Ontology. Master’s thesis, Minho University, Braga, Portugal, Dec 2016. MSc dissertation. Cristiana Araújo, Pedro Rangel Henriques, and Ricardo G. Martini. Virtual Learning Spaces Creation Based on the Systematic Population of an Ontology. Journal of Information Systems Engineering & Management (JISEM),3(1):1–11, Feb 2018. ISSN 2468-4376. doi: https://doi.org/10.20897/jisem.201807. Cristiana Araújo, Salete Teixeira, Diana Barbosa, and Pedro R. Henriques. Using Ontologies to plan Computer Programming courses for different levels. In Simon Polovina, Rubina Polovina, Neil Kemp, and Ken Pu, editors, MOVE’2020: Measuring Ontologies in Value-seeking Environments. Association for Computing Machinery, October 2020. to be published. Vicky Baker. Drop-off baby boxes: Can they help save lives in the US?, Jan 2019. URL https://www.bbc.com/news/world-us-canada-46801838. Caroline Brettell and Rui Feijó. Foundlings in Nineteenth-century Northwestern Portugal: Public Welfare and Family Strategies. In Enfance abandonnée et société en Europe, XIVe-XXe siècle. Actes du colloque international de Rome (30 et 31 janvier 1987), pages 273–300. École Française de Rome, 1991. Joan Cochrane and Goh Lee Ming. Abandoned babies: the Malaysian ‘baby hatch’. Infant,9 (4):142–144,2013. Teodoro Afonso da Fonte. No limiar da honra e da pobreza: a infância desvalida e abandonada no Alto Minho (1698-1924). Universidade do Minho (Portugal), 2004. 89
BIBLIOGRAPHY 90 Maria del Mar Roldan-Garcia and Jose F Aldana-Montes. A tool for storing OWL using database technology. In Proceedings of the OWLED 2005 Workshop on OWL: Experiences and Di-rections, Galway, Ireland, CEURWS. org,2005. Stephen Evans. The ’baby box’ returns to Europe. https://www.bbc.com/news/ magazine-18585020, Jun 2012. Accessed: October 2020. João M. Sousa Fonseca, Maria João Varanda Pereira, and Pedro Rangel Henriques. Converting Ontologies into DSLs. In Maria João Varanda Pereira, José Paulo Leal, and Alberto Simões, editors, 3rd Symposium on Languages, Applications and Technologies, volume 38 of OpenAccess Series in Informatics (OASIcs), pages 85–92, Dagstuhl, Germany, 2014. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik. ISBN 978-3-939897-68-2. doi: http://dx.doi.org/10.4230/OASIcs.SLATE.2014.85. URL http://drops.dagstuhl.de/ opus/volltexte/2014/4561. Al-Hakam Hamdan, Mathias Bonduel, and Raimar J Scherer. An ontological model for the representation of damage to constructions. In 7th Linked Data in Architecture and Construction Workshop,2019. Matthew Horridge, Simon Jupp, Georgina Moulton, Alan Rector, Robert Stevens, and Chris Wroe. A practical guide to building owl ontologies using protégé 4and co-ode tools edition1.2.The university of Manchester,107,2009. Eero Hyvönen, Markus Holi, and Kim Viljanen. Designing and creating a web site based on RDF content. In WWW Workshop on Application Design, Development and Implementation Issues in the Semantic Web,2004. Jean-Baptiste Lamy. Owlready: Ontology-oriented programming in Python with automatic classification and high level constructs for biomedical ontologies. Artificial intelligence in medicine,80:11–28,2017. Ricardo G. Martini, Cristiana Araújo, José João Almeida, and Pedro Rangel Henriques. OntoMP, An Ontology to Build the Museum of the Person. In Álvaro Rocha, Maria Ana Correia, Hojjat Adeli, Luis Paulo Reis, and Marcelo Mendonça Teixeira, editors, New Advances in Information Systems and Technologies: Volume 2, pages 653–661. Springer International Publishing, Cham, 2016a. ISBN 978-3-319-31307-8. doi: 10.1007/ 978-3-319-31307-8_67. URL http://dx.doi.org/10.1007/978-3-319-31307-8_67. Ricardo G. Martini, Cristiana Araújo, Giovani R. Librelotto, and Pedro R. Henriques. A Reduced CRM-Compatible Form Ontology for the Virtual Emigration Museum. In Álvaro Rocha, Maria Ana Correia, Hojjat Adeli, Luis Paulo Reis, and Marcelo Mendonça Teixeira, editors, New Advances in Information Systems and Technologies, pages 401–410.
BIBLIOGRAPHY 91 Springer International Publishing, Cham, 2016b. ISBN 978-3-319-31232-3. doi: 10.1007/ 978-3-319-31232-3_38. URL http://dx.doi.org/10.1007/978-3-319-31232-3_38. Ricardo Giuliani Martini. Formal Description and Automatic Generation of Learning Spaces based on Ontologies. PhD thesis, University of Minho, Sep 2018. Catherine Panter-Brick, Malcolm T Smith, et al. Abandoned children. Cambridge University Press, 2000. Joana Vieira Paulino. O abandono infantil na Lisboa da segunda metade do século XIX. Revista de Demografia Histórica,35(II):101–134,2017. Maria João Varanda Pereira, João Fonseca, and Pedro Rangel Henriques. Ontological approach for DSL development. Computer Languages, Systems & Structures,45:35–52, 2016. ISSN 1477-8424. doi: http://dx.doi.org/10.1016/j.cl.2015.12.004. URL http: //www.sciencedirect.com/science/article/pii/S1477842415300270. Randeep Ramesh. Spread of ’baby boxes’ in Europe alarms United Nations. https: //www.theguardian.com/world/2012/jun/10/unitednations-europe-news , Jun 2012. Accessed: October 2020. Monica Shekhar et al. Semantic Web Search based on Ontology Modeling using Protege Reasoner. arXiv preprint arXiv:1305.5827,2013. Mee Ting Tan. Building a family ontology to meet consistency criteria. PhD thesis, Universiti Tun Hussein Onn Malaysia, 2015.