Full text
Universidade do Minho Escola de Engenharia Departamento de Inform´ atica Emanuel Queiroga Amorim Fernandes Development of a web-based platform for Biomedical Text Mining December 2019
Universidade do Minho Escola de Engenharia Departamento de Inform´ atica Emanuel Queiroga Amorim Fernandes Development of a web-based platform for Biomedical Text Mining Master dissertation Master Degree in Computer Science Dissertation supervised by Miguel Francisco Almeida Pereira Rocha Hugo Samuel Oliveira Costa December 2019
DIREITOS DE AUTOR E CONDIC¸ ˜ OES DE UTILIZAC¸ ˜ A O D O TRABALHO POR TERCEIROS Este ´ e um trabalho acad´ emico que pode ser utilizado por terceiros desde que respeitadas as regras e boas pr´ aticas internacionalmente aceites, no que concerne aos direitos de autor e direitos conexos. Assim, o presente trabalho pode ser utilizado nos termos previstos na licenc¸a abaixo indicada. Caso o utilizador necessite de permiss˜ ao para poder fazer um uso do trabalho em condic¸ ˜ oes n˜ ao previstas no licenciamento indicado, dever´ a contactar o autor, atrav´ es do Reposit´ oriUM da Universidade do Minho. Licenc¸a concedida aos utilizadores deste trabalho Atribuic¸ ˜ ao CC BY https://creativecommons.org/licenses/by/4.0/ ii
ACKNOWLEDGEMENTS Agradec¸o a todas as pessoas que me acompanharam durante o desenvolvimento deste projeto, sem elas n˜ ao seria poss´ ıvel. Ao meu orientador, o professor Miguel Rocha, agradec¸o pela disponibilidade e pelos conhecimentos ministrados que auxiliaram a realizar este trabalho. A oportunidade, apoio e compreens˜ ao ao longo do mesmo. Ao meu supervisor na empresa, Hugo Costa, por toda a colaborac¸˜ ao prestada, disponibilidade e aux´ ılio em cada etapa do desenvolvimento da aplicac¸˜ ao. Ao R´ uben Rodrigues pela ajuda prestada, nomeadamente na fase inicial do projeto e esclarecimento de d´ uvidas. A toda a equipa da SilicoLife por serem pessoas af´ aveis e de boa disposic¸˜ ao. Aos meus amigos por todos os bons momentos de divers˜ ao e descontrac¸˜ ao como tamb´ em pelo apoio prestado. A toda a minha fam´ ılia, em especial ao meu pai, Jos´ e Fernandes, ` a minha M˜ ae, Paula Fernandes, e ao meu irm˜ ao Paulo Fernandes por todo carinho, apoio, dedicac¸˜ ao e motivac¸˜ ao. ` A minha namorada, Catarina Vieira, por me acompanhar e apoiar em todos os momentos da minha vida. iii
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. iv
RESUMO A minerac¸˜ ao de Literatura Biom´ edica (BioLM) pretende extrair informac¸˜ ao de alta qualidade da ´ area biom´ edica, atrav´ es da criac¸˜ ao de ferramentas/metodologias que consigam automatizar tarefas com elevado dispˆ endio de tempo. As tarefas subjacentes v˜ ao desde recuperac¸˜ ao de informac¸˜ ao, descoberta e recuperac¸˜ ao de documentos relevantes para a extrac¸˜ ao de informac¸˜ ao pertinente e a capacidade de extrair conhecimento de texto. Nos ´ ultimos anos a SilicoLife tem vindo a desenvolver uma ferramenta, o @Note2, uma BioLM Workbench multiplataforma baseada em JAVA, que executa as principais tarefas inerentes a BioLM. Tamb´ em possui uma vers˜ ao aut´ onoma com uma interface amig´ avel para o utilizador. Esta tese desenvolveu uma plataforma de software baseada na web, que ´ e capaz de executar algumas das tarefas de BioLM, com suporte num n´ ucleo de bibliotecas do projeto @Note. Para tal foi necess´ ario melhorar o servidor RESTful atual, criando novos m´ etodos e APIs, como tamb´ em desenvolver a aplicac¸˜ ao baseada na web, com uma interface amig´ avel para o utilizador, que comunicar´ a com o servidor atrav´ es de chamadas ` a sua API. Este trabalho focou o seu desenvolvimento em tarefas relacionadas com recuperac¸˜ ao de informac¸˜ ao, focando na pesquisa eficiente de documentos de interesse atrav´ es de uma interface integrada. Nesta fase, o objetivo foi tamb´ em ter um conjunto de interfaces capazes de visualizar e explorar as principais entidades envolvidas em BioLM: pesquisas, documentos, corpora, entidades relacionadas com processos de anotac¸ ˜ oes e recursos. Palavras-chave: Aplicac¸˜ ao Baseada na Web, Minerac¸˜ ao de Literatura Biom´ edica, Recuperac¸˜ ao de Informac¸˜ ao. v
ABSTRACT Biomedical Text Mining (BTM) seeks to derive high-quality information from literature in the biomedical domain, by creating tools/methodologies that can automate time-consuming tasks when searching for new information. This encompasses both Information Retrieval, the discovery and recovery of relevant documents, and Information Extraction, the capability to extract knowledge from text. In the last years, SilicoLife, with the collaboration of the University of Minho, has been developing @Note2, an open-source Java-based multiplatform BTM workbench, including libraries to perform the main BTM tasks, also providing user-friendly interfaces through a stand-alone application. This work addressed the development of a web-based software platform that is able to address some of the main tasks within BTM, supported by the existing core libraries from the @Note project. This included the improvement of the available RESTful server, providing some new methods and APIs, and improving others, while also developing a web-based application through calls to the API provided by the server and providing a functional user-friendly web-based interface. This work focused on the development of tasks related with Information Retrieval, addressing the efficient search of relevant documents through an integrated interface. Also, at this stage the aim was to have interfaces to visualize and explore the main entities involved in BTM: queries, documents, corpora, annotation processes entities and resources. Keywords: Biomedical Text Mining, Information Retrieval, Web Based Application. vi
CONTENTS 1 introduction 1 1.1Context 1 1.2Objectives 2 1.3Structure of the thesis 2 2 state of the art 4 2.1Biomedical text mining 4 2.1.1Information retrieval 5 2.1.2Named entity recognition 7 2.1.3Relation extraction 8 2.1.4Tools 9 2.1.5Resources 10 2.2The @Note project 10 2.2.1@Note application 13 3 web application development 15 3.1Technologies and languages 15 3.1.1Java 15 3.1.2Hibernate ORM 16 3.1.3Hibernate Search and Lucene 16 3.1.4Spring framework 19 3.1.5Web-based technologies 20 3.2@Note Architecture 21 3.2.1@NoteLibs 22 3.2.2@Note data access 23 3.2.3@Note domain model 25 3.3Cache 29 3.4Search 30 3.4.1Hibernate Search 31 3.4.2Boolean search 35 3.5Processes 40 3.5.1Process data status 40 3.5.2Corpus creation 42 3.6@Note web 43 3.6.1@Note web structure 43 3.6.2Data access 47 vii
Contents viii 3.6.3Modules 48 3.6.4Global search 59 3.6.5Navigation 60 4 results 63 4.1Queries 63 4.2Corpora 64 4.3Processes 65 4.4Documents 67 4.5Curator 68 4.6Resources 69 4.7Global Search 71 4.8User 74 5 conclusions and future work 75 5.1Summary of the work 75 5.2Prospects for future work 75 a implemented @fields for lucene indexing 80
1 INTRODUCTION 1.1 context The Life sciences produce a large amount of information that is spread in scientific publications and databases (Larsen and von Ins,2010). The publications contain textual nonstructured data that turns the search and extraction of high-quality information into a difficult challenge. As a consequence, biomedical researchers spend a large amount of time extracting useful information from literature. Biomedical Text Mining (BTM) is the field that applies a process of deriving high-quality information from texts and literature of the biomedical domain. Thus, BTM appeared to create tools/methodologies that can automate and reduce time-consuming tasks when searching for new information in biomedical literature (Shatkay and Craven,2012). Information Retrieval (IR) and Information Extraction (IE) are the two major BTM tasks. IR includes the methods related to the discovery of documents (articles, books, patents) and their pre-processing to make them suitable for subsequent operations (e.g. Portable Document Format (PDF) to text conversion). IE on the other hand, has the capability to extract high-quality information from text streams. Two of the main tasks in IE are Named Entity Recognition (NER) and Relationship Extraction (RE). These two processes can be tested in terms of performance and accuracy, being typically validated against golden standard corpora (set of biomedical documents) that contain annotations (bio-entities and relations) curated by specialists (Kim et al.,2003). In the last decade, challenges such as Biocreative (http://www.biocreative.org/) were created by the BTM community to compare and improve BTM algorithms. Over the last few years, the Biosystems research group University of Minho (UM) and the SilicoLife company have worked in the BTM field. In this period, @Note21a multiplatform BTM Workbench has been developed, fully written in Java and that uses a MySQL database. This framework copes with the most important IR and IE tasks in the field and promotes multi-disciplinary research. The @Note2architecture, based in plug-ins, enables 1http://www.anote-project.org 1
1.2. Objectives 2 the fast development of new BTM methodologies, while keeping a user-friendly interface (Lourenc¸o et al.,2009). The software developed in the @Note project includes a set of core Java libraries implementing the main tasks in IR and IE. In the last couple of years, these have been used as the basis for the implementation of a server, providing a number of BTM methods, with two different options, through well-defined RESTful Aplication Programing Interface (API)s or integrated database access. A set of graphical user interfaces are provided within the @Note client stand-alone application, which is made available as open-source software. 1.2 objectives The main goal of this work is the development of a web-based software platform that is able to address some of the main tasks within BTM, focusing on the visualization and exploration of the main entities and results (e.g. documents,corpora,annotations). This will be supported by existing core BTM libraries from the @Note project. In detail, the scientific/ technological objectives are: •To review methods/algorithms and existing tools within the field of BTM; •To review the existing software within the @Note BTM framework; •To review web programming tools, selecting the most adequate for this project; •To improve the available RESTful server within the @Note project, providing new methods and APIs, and improving others making them more suitable to support webbased applications; •To develop a web-based application allowing the user to visualize, explore and manage the main entities involved in BTM. •To develop a tool allowing the Boolean search of documents by named entities and by free text with an interactive and intuitive web-based interface integrated, and allow corpus creation by both search types. 1.3 structure of the thesis The state of the art (next chapter) explores the BTM field, focusing on topics such as the problems it addresses, its main tasks and the resources that support them. It reviews some developed tools by the scientific community that implement BTM methodologies similar to the proposed objectives. Also, it briefly introduces the @Note project where this thesis is integrated in. The chapter describing the web application development follows, explaining
1.3. Structure of the thesis 3 the architecture and domain of the solution, and describing the development of the web application starting by the back-end implementation. The next chapter focuses on the results, showing the web application interface with some examples of data and interactions. The last chapter brings the main conclusions of the work and some lines of prospective future work.
2 S TAT E O F T H E A RT 2.1 biomedical text mining The significant increase in the number of unstructured biomedical texts in the last few years gave birth to BTM. Resorting to computational tools, time-consuming tasks can be replaced with automated processes, designed for quality knowledge extraction in the biomedical and molecular biology domains (Shatkay and Craven,2012;Cohen and Hunter,2008). Tasks related to BTM can address a vast number of purposes giving answers to differentiated groups within the scientific community (Shatkay and Craven,2012). The tasks can be divided in two distinct categories: IR, where the main purpose is to find and organize relevant documents from a larger set, through well-formed queries on an indexed database, and IE which is responsible for more in-depth analyses of text, such as NER where the purpose is to identify interesting entities like genes, proteins or cellular locations, while RE identifies links between these entities. The NER process can be performed by distinct approaches, including lexicon-based, rulebased or Machine Learning (ML) based techniques. Each approach has advantages and disadvantages regarding the need to resort to manual curation (e.g. necessity of curated lexica, rules or ML models). The RE process also has different approaches (e.g. semantic rules, Part of Speech (POS) trees), but ML methods are still an option. RE methods identify possible relations between previously annotated bio-entities (Shatkay and Craven,2012;Rodriguez-Esteban,2009). Evaluation of the processes pipelines associated with a specific task is done with a standard goal. The standard goal is a corpus with instances of the task, ideally providing correct solutions free of errors, although this scenario rarely happens. The evaluation is based on metrics that score the processes, and based on the results responds to questions about how well the system performs (Shatkay and Craven,2012). Typical performance measures for both IR and IE systems are recall (Rc) and precision (Pc): recall =TP TP +FN 4
2.1. Biomedical text mining 5 precision =TP TP +FP Recall and precision are calculated by dividing the original set the BTM task processed, into four subsets related to its classification. True positives (TP) are the entities correctly classified, false positive (FP) are incorrectly classified entities, true negatives (TN) are entities correctly classified as negative or correctly not classified as an entity, and false negatives (FN) are when the system failed to classify an entity or incorrectly classified as negative. Recall generally corresponds to sensitivity, however reaching 100% of this metric is trivial. For example, if an IR system labels all retrieved documents as relevant it would successfully indicate the user all the documents relevant to him, however a system like this would be useless. A system with a nearly perfect precision is also trivial to implement, modifying the previous IR example to a system that only labels one document as relevant. To more systematically evaluate a system, two additional metrics that balance the trade-off between precision and recall are used. They are the accuracy and F-score: accuracy =TP +TN TP +FP +TN +FN Fscore =2Pc ∗Rc Pc +Rc 2.1.1Information retrieval In any research, the first step is to obtain relevant information, from where knowledge can be extracted. IR offers several methods to search for documents that might be interesting to the users needs, the goal is to retrieve all relevant documents, while correctly discarding irrelevant ones. Sometimes, the number of relevant documents might require time to analyze that greatly surpasses what is available. When this happens, a finer grained query can be applied or the information can have some priority enabling structure, showing the user the retrieved documents which best suit him. Publications can be accessed on public repositories, aggregators or catalogs, that can contain abstracts, citations, full text articles, reports, etc. To prevent ambiguity, and enable easy reproduction of results reported by other teams, each resource has a persistent identifier. Two examples are: Handle Persistent Identifiers (PID), where abstract ids are assigned to a resource in accordance to the Handle schema, and Digital Object Identifiers (DOI)1, serial ids used to uniquely identify digital resources (Przybyła et al.,2016). 1http://www.doi.org/
2.1. Biomedical text mining 6 Currently, two of the most popular repositories are Pubmed Central (PMC)2and arXiv3. PMC contains around 3.9million publications related to Biomedical and life sciences fields. It also contains an open access subset, that is part of the total collection of articles in PMC, with over 1million articles. ArXiv gives access to full preprints and abstracts of 1.2million publications related to Biology, Chemistry, Physics, Computer science and Mathematics, among others. Aggregators are especially useful to text miners, as they contain information harvested from multiple sources searchable and available in an uniform way. The Bielefeld Academic Search Engine (BASE)4by Bielefeld University Library provides more than 100 million documents from more than 4,000 sources and about 60% of the indexed documents for free (Open Access). It contains abstracts, full text articles, books and multimedia documents, software and datasets. Focused on the area of the Life Sciences, we have the aggregator PubMed https://www. ncbi.nlm.nih.gov/pubmed/ by the National Center for Biotechnology Information (NCBI), U.S. National Library of Medicine, that comprises more than 30 million citations for biomedical literature from MEDLINE, life science journals, and online books. Generally, full text articles are not available, but may contain links to their content or publisher web sites. However, NCBI’s PMC archive contains more than 5million free full-text records, of biomedical and life science research https://www.ncbi.nlm.nih.gov/pmc/. An indexed structure is fundamental to retrieve information from these databases, especially for Boolean queries. The structure relies on tokenization, a Natural Language Processing (NLP) process of segmenting text, where the document(s) are divided into tokens later combined to form terms. Terms are sorted, typically alphabetically, and they reference documents containing them forming an index. When a Boolean query is executed, the documents referenced by the terms which satisfy the set operation from the query are retrieved. However, these terms alone may not be sufficient as they only contain tokens from the documents processed. For example, querying a term not present in the index but where a synonym is, the documents referenced by the synonym should be retrieved which will not happen. To solve this problems, other terms corresponding to fundamental concepts may be inserted. This type of index can be enriched with different types of useful information to support processes of categorization or summarization, among others: •The exact position on the text or words surrounding the term, which is useful for longer phrases identification and location. •Grammatical information, such as part-of-speech tags. 2https://www.ncbi.nlm.nih.gov/pmc/ 3https://arxiv.org/ 4https://www.base-search.net
2.1. Biomedical text mining 7 •Statistics, like the number of times and number of documents a term occurs and is contained, respectively. Simple Boolean queries, despite efficient implementation have domain-specific limitations problems, such as the fact that short Boolean queries might result on impractical number of documents retrieved. Natural language problems can lead to the retrieval of irrelevant documents, while relevant ones may be missed. Methods based on the vector model try to address the issues of Boolean queries explicit words and terms dependency. Documents are viewed as vectors of weights, reflecting the significance of the individual terms. Queries also follow this principle and are also represented as a vector. The search algorithm can be reduced to comparing similarities between the documents and query vectors, being the most similar retrieved (Shatkay and Craven,2012). 2.1.2Named entity recognition NER contains the methods of IE responsible for the identification of interesting entities in texts. Before explaining the processes of NER, let’s enumerate some factors related to this task, which impose significant difficulties: •Synonyms — the same entity (e.g. gene) can have different names depending on authors and context; •Abbreviations — the same entity (e.g. compound) can have several different abbreviations and acronyms depending on the context. •Homonymous — biological entities can be represented by names that have common meanings in English (e.g. a gene name FOR). •Ambiguity — the same name is often used for entities of different classes (e.g. a gene and its encoded proteins). •Entity names composed by combining others (e.g. genes or compounds). Dictionary based methods On this method, a dictionary structure is parsed searching for matches with entity names kept in the dictionary keys and possible synonyms. This process has two major limitations: the results will only be as complete as the dictionary used, i.e. an entity that is not present on the structure cannot be matched, and context is not taken into consideration, so the homonymy problem is not addressed, i.e. common terms used in natural language should be omitted from the dictionaries as they will generate a huge number of false positives.
2.1. Biomedical text mining 8 One approach to mitigate the problems of an incomplete dictionary is to use a generalized dictionary relying on named patterns. This type of dictionaries might increase recall; however, some precision is typically lost. Different kinds of dictionaries can be employed as components of the NER, with better evaluation than the separate parts. Rule-based methods These methods rely on morphological and lexical properties of named entities of different classes, as well as syntactic analyses. The core rules can be devised separated in stages. One method by Fukuda et al. (1998) has 2stages of rules, in the first stage the terms are identified, and the second stage extends them with rules based on syntax like POS. These methods have the advantage of how easy the extraction process is to understand, while their drawback is the non existence of default rules. According to the situation, rules might have to be modified and created, and therefore this task typically expends significant human effort. Learning classification models Machine Learning methods are automatic processes where the model learns from labeled training data. These models automatically identify regularities among named-entities if a good dataset of training examples is available. Generally, producing these datasets is very costly and requires a considerable amount of manual work. Maximum-entropy models, probabilistic sequence models, like Hidden Markov Models and Conditional Random Fields are some examples of machine learning methods widely used for NER tasks. 2.1.3Relation extraction This field of BTM also includes methods for the identification of relations between entities of interest. The extraction of relations is a complex task and the systems are mostly based on hand-coded patterns, ML processes or a combination of the two, using detailed syntactic analysis and semantic categories and relationships. Co-occurrence This kind of methods are based on finding co-occurrences of two entities within short passages of text or in documents. As a standalone process, it has a major limitation, just by two entities co-occurring, a relation is not confirmed as the relation can be elsewhere on the text or even be non existent. To support the hypothetical existing relationship, the frequency with the possibility by chance in mind and textual context can provide more information towards the significance of the relationship found.
2.1. Biomedical text mining 9 Rule-based methods On these systems, rules can be applied on syntactic and semantic level to pre-processed text divided into tokens. Interesting entities like proteins and verbs can be labeled using NER and POS tagger processes, respectively. POS taggers can be based on models that are induced by supervised machine-learning methods from labeled corpora. These ML methods are able to identify statistical regularities in the context of a given token that enable its part of speech to be disambiguated (Shatkay and Craven,2012). 2.1.4Tools The scientific community has at its disposal several resources available for IR, IE processes, as well as access to multiple structured databases to use on their work. Some function as a standalone service, others provide a workflow of operations combining existing resources. Next, we enumerate some tools that implement BTM methodologies: •XplorMed5(Perez-Iratxeta et al.,2001) — The XplorMed server allows to explore a set of abstracts derived from a MEDLINE search. The system gives main associations between the words in groups of abstracts. Then, you can select a subset of your abstracts based on selected groups of related words and iterate your analysis on them. •Whatizit6— Text processing system that allows text mining tasks on text, great at identifying molecular biology terms and linking them to publicly available databases. Several vocabularies can be integrated in a single pipeline, examples of already integrated vocabularies are Swissprot, the Gene Ontology (GO), the NCBI’s taxonomy, Medline Plus. •Egas7(Campos et al.,2013) — Egas is a web-based platform for biomedical text mining and collaborative curation, supporting manual and automatic annotation of concepts and relations. •PubAnnotation8— PubAnnotation is a repository of text annotations, especially those made to literature of life sciences, e.g., PubMed or PMC articles. If one has such annotations, they can be registered in PubAnnotation. When annotations are registered, PubAnnotation aligns them to the canonical text that is taken from PubMed and PMC, which means all the annotations in PubAnnotation are linked to each other through 5http://xplormed.ogic.ca/ 6http://www.ebi.ac.uk/webservices/whatizit 7https://demo.bmd-software.com/egas/ 8http://www.pubannotation.org/
2.2. The @Note project 10 canonical texts. It is a new way of publishing or sharing text annotations using recent web technology: annotations will become accessible and searchable through standard web protocol e.g., Representational State Transfer (REST) API. •Argo9(Rak et al.,2012) — Argo is an inter-operable, integrative, interactive and collaborative system for text analysis with a convenient graphic user interface to ease the development of processing workflows and boost productivity in labour-intensive manual curation. Robust, scalable text analytics follow a modular approach, adopting component modules for distinct levels of text analysis. The user interface is available entirely through a web browser that saves the user from going through often complicated and platform-dependent installation procedures. Argo comes with a predefined set of processing components commonly used in text analysis, while giving the users the ability to deposit their own components. Table 1provides some key points on the tools described above. 2.1.5Resources To support the BTM tasks explored in subsections 2.1.1,2.1.2,2.1.3, several resources have been developed over the years. Lexical resources collect frequent lexical information on text corpora such as parts of speech and spelling variants. Terminology resources collect names of entities employed in the biomedical domain, they generally store synonyms and have a hierarchical organization, such as graph structures. Ontology resources store relations, such as is a and part of, between biomedical entities and their significance Bodenreider (2006). Table 2presents some of these resources and summarily explains them. 2.2 the @note project The Biosystems research group (UM) and SilicoLife company released @Note214 currently on version 2.1.4(November, 23rd - 2016), a BTM tool which promotes the joint efforts between three distinct classes: biologists, text miners and software developers (Lourenc¸o et al.,2009). @Note is built on top of AIBench a facilitator to the referred multidisciplinary approach empowering the project with modular and flexible development. Its plug-in based approach also enables the fast development of new BTM methodologies, while keeping a 9http://argo.nactem.ac.uk/ 10 https://www.nlm.nih.gov/research/umls/ 11 http://wordnet.princeton.edu 12 http://wordnetweb.princeton.edu/perl/webwn 13 http://www.geneontology.org/ 14 http://anote-project.org/
3.1. Technologies and languages 17 •Offers control on how to store data, and how to extract information, also exposing all capabilities of Apache Lucene. •Offers architectural solutions to maintain a high performance, scalable and distributed index. •Query results can be organized by groups and categories. Model At the beginning of a search, it is necessary to have a database with efficient methods to arrive at the intended information, allowing for fine-grained queries with options like case-sensitivity, suggestions, filtering of results and sort. Lucene’s index stores documents’ terms into maps, called inverted indexes because the search is based on the terms of the documents. Each term must have a token and a field name. The way query results are organized can be explained using the Lucene Practical Scoring Function1: score(q,d) = ∑ t in q (t f (t in d)×id f (t)2×t.getBoost() ×norm(t,d)) 1.tf(t in d) is the term’s frequency, so documents that have more occurrences of a given term receive a higher score. 2.idf(t) correlates to the inverse of docFreq (the number of documents in which the term t appears), rarer terms give higher contribution. 3.t.getBoost() is a search time boost of term t in the query q. 4.norm(t,d) is an index-time boost factor that solely depends on the number of tokens of this field in the document, so that shorter fields contribute more to the score. Hibernate Search model To map the domain model, persistent classes are marked with several annotations and filled with value types that define their state. To add free text capabilities with Hibernate Search, additional annotations to the class are required. Table 4lists some of the referred annotations. Analysis is the process in which text is converted into terms, Hibernate Search has an configurable analyser class that can be applied to entities, properties or even fields. Custom reusable analysers can be defined and are comprised by: a name, unique identifiers of the 1https://lucene.apache.org/core/8_2_0/core/org/apache/lucene/search/similarities/ TFIDFSimilarity.html
3.1. Technologies and languages 18 Annotation Location Use @Indexed Class entity Specifies that the entity is indexable, can have searchable fields. @AnalyzerDef Class entity Definition of a custom analyzer for indexation. @AnalyzerDefs Class entity Allows multiple @AnalyzerDef definitions. @Field Basic value type Specifies that the field is searchable. A custom or builtin-in analyzer, can be passed to the field to customize the indexation. @Fields Basic value type Allows multiple @Field annotations to be associated to the value. @SortableField Value type Explicitly specifies that the field is sortable @IndexedEmbedded Collection value type Index associated entities for example: (@ManyToMany, @*ToOne,@Embedded and @ElementCollection) as part of the owning entity @FieldBridge Value Type Custom bridge for the field for more fine-grained indexing. Table 4.: Some Hibernate Search annotations applicable on data persistence classes analyser definition; a list of character filters, responsible for the pre-processing of characters before they are converted into tokens; a tokenizer, transforms the input characters into tokens; a list of filters that can remove, modify or add words. This separation of tasks enables re-usability of these components when defining other analysers. Query Hibernate Search provides a list of querying methods that can be combined to make a fine grained search. Some of the options available are: •Keywords; •Words where some are unknown; •Phrases; •Range values, like between dates, numbers or words; •Results similar to the text search. Queries can also be configured with the following options: •boostedTo (on query type and on field): boost the whole query or the specific field by a given factor. •withConstantScore (on query): all results matching the query have a constant score equal to the boost.
3.1. Technologies and languages 19 •filteredBy(Filter) (on query): filter query results using the Filter instance. •ignoreAnalyzer (on field): ignore the analyzer when processing this field. •ignoreFieldBridge (on field): ignore field bridge when processing this field. 3.1.4Spring framework The Spring framework is a Java platform that provides comprehensive infrastructure support for developing Java applications. Spring enables to build applications from Plain Old Java Objects (POJOs) and to apply enterprise services non-invasively to POJOs. Two of the advantages of the Spring platform are: turn a local Java method into a remote procedure without having to deal with remote APIs; make a Java method execute in a database transaction without having to deal with transaction APIs. (Pivotal,2017) The Spring framework consists on features organized into modules, grouped into containers such as (Pivotal,2017): •Core Container: Has modules that provide the fundamental parts of the framework, such as the Inversion of Control (IoC) and dependency injection features. It also provides access to objects in a framework-style manner. •Data Access/Integration: Has transaction modules for integration, with Hibernate for example, and modules for data access, for example giving support to pragmatic and declarative transaction for classes. It also provides a Java Database Connectivity (JDBC) abstraction layer. •Web: Contains SpringsModel View Controller (MVC) and REST Web Services implementation. Inversion of Control In a Java platform application development, it is the developer’s task to organize basic building blocks into a coherent whole. This task can use patterns, good practices given a name, a description of what it does, where to apply it, and the problems it addresses. The Spring Framework codifies formalized design patterns as first-class objects that can be integrated in the application. IoC also known as dependency injection, provides formalized means of composing disparate components into a fully working application. IoC is a process whereby objects define their dependencies, that is, the other objects they work with, only through constructor arguments. These dependencies are injected when creating a bean. In Spring, the objects that form the backbone of the application, and that are managed by the Spring IoC container, are called beans (Pivotal,2017).
3.1. Technologies and languages 20 3.1.5Web-based technologies With the advances on modern browsers, we observed an increase on web-applications, where deployed JavaScript code size has grown 45% over the course of the year 2015 (ENACHE,2015). Web applications make the project more accessible, avoiding possible complicated installation and configurations to use the product. However, writing a fullfledged application on JavaScript,Cascading Style Sheets (CSS) and a general-purpose scripting like PHP alone lacks productivity (e.g. duplication of code, writing too much code), maintainability (e.g. lack of modular components) and abstraction. To help solve these problems, several web frameworks are available, either developed with an MVC architecture in mind like Ruby on rails2, or their well designed framework are MVC enablers like Django3. MVC is a design pattern that encourages the division of the application into three interdependent components. Views contain how the data are presented, among the components needed for display they might also contain subviews.Controllers are the interface between their associated views and models, they define how the application interacts with the user. The model is the application central structure, contains all of the application logic and data. A modular structure is extremely useful, isolating functional units as much as possible, facilitating their understanding and modification (Krasner and Pope,1988). Angular Angular4is a web framework, 100%Javascript and client-side. Powered by google, created by Miˇ sko Hevery. Some examples built with it can be found at https://www.madewithangular. com/ with websites like the one from the Oscars5. Angular is extremely modular, actually many of its libraries are modules, as well as, many other third party libraries are also available as modules. An angular application must have at least one module,the root module. From this module the application can be constructed by adding other cohesive modules of functionality, they can feature a specific business domain (e.g. a module for IR tasks) or simply provide some utility (e.g. a bootstrap module to help with the application graphical design). Two special features about angular are: Data binding and Directives.Data binding is the automatic synchronization of data between the model and view components. The view can be thought as an instant projection of the model, which enables the controller to be completely separated and unaware of the view’s existence. This is especially useful for testing and applying different presentation forms of information to the same controller.Directives 2http://rubyonrails.org/ 3https://www.djangoproject.com/ 4https://angularjs.org/ 5http://oscar.go.com/
3.2. @Note Architecture 21 Figure 1.: @Note Architecture are markers on a Document Object Model (DOM) element that extend the HyperText Markup Language (HTML), the language for describing the structure of web pages (w3h), with new attributes, providing functionality to the application. The DOM is an API for valid HTML and well-formed Extensible Markup Language (XML) documents. It defines the logical structure of documents and the way a document is accessed and manipulated (Wood and Level, 2004). Angular already provides many useful built-in directives (e.g. ng-model,ng-repeat) and encourages the user to write their own when needed. For example, with the ng-repeat directive, we can mark a table HTML tag to populate a table bind to a model. We write the code to populate the columns, and one row and the directive will repeat the rows as many times as there are elements in the model. 3.2@note architecture In figure 1, we provide the architecture of the @Note system, where we can see that the developed web application data is a RESTful Java application connected to selected databases. The project has two databases to query for information, both implemented using Hibernate, and set up through configuration files. One of them is a relational database, where we used MySql, and the other is a repository of files for Lucene queries. The anote2daemon is a Spring RESTful web service, giving access to @Note’s methods to the outside. The mapped methods use the five core @Note libs to access the database and execute BTM processes. Finally, the @Note web application has services implemented with REST requests configured to query a server with an @Note web service running.
3.2. @Note Architecture 22 Figure 2.: @Note java libraries 3.2.1@NoteLibs The @Note project has seven Java libraries connected and maintained as Maven6projects. Figure 2shows what each library contains and their dependencies. The more relevant Java libraries to the web application development are: Core,anote2daemon and Processes. The Core library has the essential data structures, data access and business logic of the domain. The Processes library implements the majority of the BTM processes. Processes implemented in other libraries have a reason to be in a separated library, for example ProcessesGate8has the BTM processes dependent on the Gate8framework. The anote2daemon library provides a RESTful API to access @Note’s data and BTM processes. The contributions of this thesis to the improvement of the @NoteLibs can be summarized as: •Core: –Use Hibernate Search to create a Lucene database and queries for that database. The Resource and ResourceElements already had implementations related to Lucene. –Implementation of attribute languages for Boolean expression search. –Implementation of data access methods better suited for the web application, for example, implementation of paginated results. –Implementation of data access to track the progress of running processes and consult reports of finished processes. Data access implementation involved creating a data persistence class, services and the Data Access Object (DAO). 6https://maven.apache.org/
3.2. @Note Architecture 23 •Processes: Added two corpus creation methods, using the process tracking implementation at the Core. One method adds publications to the corpus from a set of publication identifiers, and the other from a set of objects from the classes implementing the interface IPublication. •anote2daemon: –Added methods to the controllers related to the new implementations on Core and Processes. –Added beans of the new implemented services at Core. –Implemented caching for some methods. –Implemented methods related to authentication and communication with the @Note web application. 3.2.2@Note data access The @Note Core project provides access to the entities stored in the relational database and the Lucene database. Figure 3has a relationship between the entities and the modules they are included in. Access is granted by a class implementing the interface IDataAccess, and all methods that access the database must be defined here. Two methods implement IDataAccess: •DatabaseAccess: Reads configurations of the relational and Lucene databases, accessing the files and creating an Hibernate session. Implements the methods to access the database using the services in dataaccess.implementation and Lucene packages. •DaemonAccess: Has methods to connect and authenticate for an anote2daemon running at a server. In the anote2daemon, all methods declared at IDataAccess are implemented, by Hypertext Transfer Protocol (HTTP) requests. Services are the bridge between the DAO and data access, they request the information from methods implemented in DAOs and return business objects. Lucene DAO implementations use the Hibernate Search API to build database queries to access the Lucene index of @Fields defined in data persistence classes at model.entity. Model DAO implementations use Hibernate to query the relational database. GenericDao for both Lucene and model can be instantiated for a data persistence class, and contains generic methods that can return results of the instantiated type. A simple example of a generic method is to get an entity using its id as input.
3.2. @Note Architecture 24 Figure 3.: @Note data access packages, entities and their relations
3.2. @Note Architecture 25 Figure 4.: @Note Domain model 3.2.3@Note domain model A domain model captures the entities of a problem and their relations. Figure 4contains the most important entities to understand the system. The meaning of each entity is the following: •Document:Documents are unstructured texts with relevant metadata like authors, year of publications etc. •Query:Query is a search on a database for potential documents of interest related to a specific task. Documents associated to a query have relevance related to the query. •Corpus: This entity represents a structured set of documents over which IE processes extract information. •Resource: A Resource represents formally knowledge on a specific domain (e.g. biological entity or relation type). BTM processes can be defined with the option/necessity on the inclusion of resources to run. •Resource Element: This entity specifies a selected term representing an element of a specific domain with its synonymous and external databases. •IEProcess:IE processes extract information from the unstructured text on documents of acorpus by generating annotations.
3.2. @Note Architecture 26 •NERProcess: This entity specifies IE processes of the NER type, which identify and annotate entities of interest on documents. •REProcess: This entity specifies processes of the RE type, which find relations involving entities previously annotated by a NER process. Users and permissions Users belong to one of two groups, Admin or General. Admins have access to administration functionalities such as: changing permissions and creating users. The @Note platform has five major entities: Queries,Corpus,IEProcesses,Resources and Documents. With the exception for Documents, accessibility is restricted based on user permissions. A permission to a resource can be classified as: owner,read write,read and none. Permissions and user groups have a significant impact on the development of the application, as the majority of requests to the database need to obey the logic imposed by user permissions. The users’ permissions are also used to ”remove” information, for example if a dictionary is no longer useful to a user, ”removing” that dictionary is changing the permission of that resource to none. The dictionary now is not returned on a query with the set of dictionaries associated to this user, while for other users using that resource nothing changes. If the dictionary is again of use to the user, an admin can change the permission again. Only elements that have errors and should never have any application are deleted by changing its validity parameter on the database. Query Queries are IR operations to search for documents. If the search is related to an external database, the documents are retrieved and stored. Queries have a set of parameters that help on the selection of relevant documents. The relevance of a document to a query can vary on levels from None to Relevant. As shown in figure 5, the QueryOriginType gives information on how the query was executed. Processes on the @Note platform for queries have a specific name associated to it, for example a query to the Pubmed database has an origin of PUBMED. Properties are keyvalue pairs that provide additional information on a query, like date ranges on publications. Corpus Acorpus is a set of documents created by an IR process, selected from a given source with a given purpose executing a query, over which BTM processes can be executed. In figure 6, it is visible that like on the Query properties, there are pairs to store additional information about the corpus, such as if they are full texts or abstracts.
3.4. Search 33 Variable Type Description value String Text search fields List<String >List of fields to search at wholeWords Boolean If true the query must use the text search as a continuous segment keywords boolean If true the text search must be divided word by word caseSensitive Boolean If true the query must be case-sensitive, otherwise, it must do a non case-sensitive search restrictions Map<String, String > Restricts returned results of pairs field value. For example return just processes of a specific corpus filters Map<String, List<String >> Filter results, allows for more than one value for the same field expression Boolean The text search is a Boolean expression Table 7.: SearchPropertiesImpl variables with description a value used to ”connect” string representations of the two classes the bridge is applied to. This ”connection” is used by the two methods implemented in the bridge: •objectToString: Converts the object into a string to be in the Lucene indexation. •stringToObject: Converts a string generated by objectToString back to an object. Query All Lucene data access services have methods to query the Lucene database. We will explain how to query for paginated data, sorted by a field that returns results based on user permissions to that resource. These have the parameters searchProperties (of type ISearchProperties), permission (string), index and paginationSize (integers), asc (Boolean), and sortBy (string). The permission refers to the user requesting the data, required to only return what the user has access to; (index and paginationSize are used to return the intended page of results; if asc is true, the results are in ascending order, otherwise they are returned in descending order; sortBy indicates the field the results are sorted by. SearchPropertiesImpl class implements the search configurations the presentation layer uses to communicate with the business layer how to make the query. Table 7has SearchPropertiesImpl, that implements ISearchProperties), variable names, their type and how they are used. Lucene queries need the unique index field defined at @Field definition, these are stored at enums created for each searchable data persistence class. Using the enum ProcessLuceneFields created for the data persistence class Processes, we can define the following enum where for each database column is attributed a suggestive name, usually the names of the variables of the corresponding business class. The exception is the name none that is used to represent the absence of sorting by an entity:
3.4. Search 34 Figure 9.: Search method in a Lucene Service with permissions and filters processOrigin (" processOrigins . pro_po_descriptionNCS " , " processOrigins . pro_po_descriptionCS ", " processOrigins . pro_po_descriptionSort ", SortField . Type . STRING ) , processType (" processTypes . pro_pt_typeNCS " , " processTypes . pro_pt_typeCS " , " processTypes . pro_pt_typeSort ", SortField .Type . STRING ), notes (" pro_notesNCS " ," pro_notesCS ", " none ", null ), name(" pro_nameNCS "," pro_nameCS " ," proNameSort ",SortField . Type . STRING ), none("",""," none ",null); private final String NCS; private final String CS; private final String SORT; private final SortField . Type SORTTYPE ; Each entity name has a correspondence to a Lucene index field name. The exception is the parameter SORTTYPE that instead of having a field name, has a SortField type necessary for sorting. The enum then has methods to retrieve the associated name based on one of the four parameters. In figure 9, we have a visual representation on how the search method is structured. First, the function inputs are structured as maps, each having its own role for sub-queries. When necessary, the respective enum is used to get the unique field name. The next step is to call the query defined at GenericLuceneDaoImpl, its results are then converted to the business equivalent.
3.4. Search 35 3.4.2Boolean search One of the major tasks of the web application is to empower its users with powerful querying tools. Almost all the information is stored using Lucene indexation and has search methods by phrase and keyword implemented. However, the document database is very extensive and always growing, and so it was decided it required a more precise and configurable query method. A Boolean query accomplishes this by refining requests with logical operators. The application provides two distinct Boolean query operations on documents: •Global search: This Boolean search uses resource elements, more specifically, their unique identifiers, as arguments and queries annotated documents for the results. This type of search allows for example to combine proteins and genes logically to retrieve relevant documents. •Expression: This Boolean search uses words or phrases as arguments to search on Lucenes index database for the results. To accomplish the goal of Boolean querying for documents, we used the Java Compiler Compiler (JavaCC). JavaCC is a parser generator and lexical analyzer generator for Java. Expression grammar In the introduction to this chapter, we talked about the grammar to be applied for documents. However, it can be applied to any class that implements the GenericLuceneDao and has data indexed by Lucene. It is dependent on a Lucene service, and on a list of index fields to query for results. To write a Boolean expression able to combine words and phrases (sequence of words that should be combined on the search) with logical operators we defined the tokens given in table 8. Figure 10 shows the following Boolean expression’s grammar functions and their interactions: •one line: initializes an array of queries to be manipulated by the operation; when the expression reaches the terminal symbol, the expression reached its end and the list of queries must only have one element that is returned. •operation: inherits a list of queries (queriesIn), and initializes a new list queriesOut. When the end of the operation is reached, it checks for three different cases: the operation entered the andOp path, in this case the queries in queriesOut are combined into a single query with the AND logic. This query is then added to queriesIn; The orOp path is very similar to the previously described only changing the logic by which the queries are
3.4. Search 36 Token Definition Explanation Word ( [”&”, ”+”, ”—”,”!”, ”¨ ”,” ”,”(”,”)”, ”;”] )+ Represents words of the text search AND (”&” — ”+” — ”AND ”) Characters that represent the logical operator and. OR (”—” — ”OR ”) Characters that represent the logical operator or. NOT (”!”) Character that represent the logical operator not. QUOTED "\"" ( "\\" ~[] | ~["\""] )* "\"" Represents a phrase, the quotation marks, allows the content to be considered as a single entity. ( In a term implies that an operation will follow it. ) Indicates that an operation preceded by ( has finished. ; End of the Boolean expression Table 8.: Tokens and terminal characters of the Boolean expression
3.4. Search 37 Figure 10.: Boolean expression grammar combined to OR. The third option is if the operation only contains an unary, in this case no logic operation is applied to the queries at queriesOut, they are simply added to the queriesIn list. •notRule: inherits a list of queries,queriesIn, and initializes a new list queriesOut. When it reaches the end, applies the logic of the NOT Boolean operator to combine the queries at queriesOut, it is then added to queriesIn. •word: Generates a query using the string found by WORD and adds it to the list of queries inherited. •quoted: Generates a query using the string found by QUOTED and adds it to the list of queries inherited. Some examples of Boolean expressions are provided below (<>refers to the variable symbol): •<WORD> •<WORD> AND <QUOTED> •<WORD> AND <QUOTED> AND <WORD>
3.4. Search 38 Figure 11.: Boolean expression example tree
3.4. Search 39 Figure 12.: Global search expression grammar •(<WORD> AND <WORD>) OR <QUOTED> •<WORD> AND (<WORD> OR <QUOTED>) •<WORD> AND !(<WORD> OR <QUOTED>) Global search A Boolean search by the global search method must allow logical operations on BTM resource elements: the annotationService has the method to fetch documents based on the resourceElement, and as such it is a dependency to this grammar. To write a Boolean expression in this language it is necessary to provide the resource elements unique identifiers, which are captured using the token CONSTANT defined as: <CONSTANT : (< DIGIT >)+ > | < #DIGIT : [ "0"-"9" ] > The terminal symbols defined are: QUERY;END;AND;{;};OR;TERM . Figure 12 maps global search expression’s grammar functions and their interactions: •query p: initializes a list to store sets of resource element ids (Long) and has the terminal symbols QUERY and END that start and finish the expression, respectively. When the end is reached, the list must have only one set of documents that are the result of the query. •operation: operation just initializes a new Set of Long that is inherited by either andOp or orOp.
3.5. Processes 40 •andOp/orOp: Both fetch the publications with the resource element annotated on it and apply the respective logic. 3.5 processes This section goes through the implementation of the data process status, used to track the progress of processes/jobs, and report the result. It also has a subsection on the new corpus creation processes, that include the new progress tracking and report system for processes. 3.5.1Process data status @Note has many different types of operations/processes, from executing a query to fetch documents from an external database to run an NER process. The system runs them in threads and their progress is printed by a method to the standard output stream. The desktop application uses a super implementation on this method to store the progress of the process in a variable, allowing the progress to be displayed. However, with the introduction of the web application, we decided it was necessary to implement a more robust and complete approach to the tracking and reporting on processes. The problems to solve can be summarized as: •The web application needs to be able to access the progress of the process. •If a process fails, this should be evident together with the reason why it failed. •It should be possible for a user to track her/his processes that are running. •An administrator should have a clear picture on the processes run /running on the server. The solution started by adding a table to the relational database. Figure 13 shows a representation on MySQL Workbench of that table. Each field has the following purpose: •dps id: Primary key, incremental. •dps data object id: Id related to the result of the process. For example, a corpus creation process stores here the id of the corpus it creates. •dps type resource: Identifies the type of process, the options are: ’queries’, ’resources’, ’corpus’, ’ner’, ’re’. •dps status: Identifies in which state the process is at, the options are: ’start’, ’running’, ’finished’, ’stop’, ’error’.
3.5. Processes 41 Figure 13.: @Note data process status table of the relational database •dps report: A textual report on the process. •dps progress: A numerical value representative of the progress at the update time. •dps create date: Date of creation. •dps update date: Date of update. •dps finish date: Date of process completion. •dps users id: Foreign key, linking to auth users. Following the data access structure explained in the subsection 3.2.2, the next steps are to implement the DAO, Service and add its accessible methods to the IDatabaseAccess interface with the respective implementations. In the anote2daemon, it is also necessary to add the bean for the process data status service and a controller. IDataProcessStatusAccess is the interface with data accessible methods related to data process status, extended by IDataAccess. A brief description on each method, or group of similar methods, follows: •addDataProcessStatus: adds an element to the database, forces the AuthUser to be the session logged user.
3.5. Processes 42 •updateDataProcessStatus updates the entity, with the parameters in the object received as input. The exceptions are the creation date and AuthUser that should only be defined when the entity is created. •Get and count methods: Get methods return one or more entities of type IDataProcessStatus; count methods return an integer, the number of results of the query. These methods have names correlated to the query, as follows: – byId: Find the entity using its id. – User: Find entities related to the logged user. – Recent: Entities are filtered by a SIGDATERANGE value applied to the date of update. – Sorted: Entities are sorted by id, in ascending order. – OfType: Filter the results by the type of process, types are defined at the enum ProcessStatusResourceTypesEnum. – WLimit: Only returns the first N results, the number is given as input. – AdminPrivileges: If the logged user has role admin, no further filter is applied. However if the user is not an admin only entities related to him are returned. – Paginated: With a pagination size and index returns the requested sub-list of results. 3.5.2Corpus creation The anote2daemon has an entry point responsible for running processes. Each process gets an unique identifier, which the entry point method uses to switch between the methods that execute in a thread the process. We added two additional methods for corpus creation, one for a global search query, and the other for a Lucene query on publications using ISearchProperties for its configuration. The creation of a corpus has an auxiliary class (CorpusCreateConfigurationImpl), to store and manipulate data that can be fetched when it is required. As the new methods have additional information related to the search method, we implemented two classes extending CorpusCreateConfigurationImpl. Figure 14 is a class diagram representation exposing the relations, attributes and interface. Figures 15 and 16 are sequence diagrams on the creation process of corpus from the entry point to run processes of anote2daemon for global search query and lucene query, respectively. They show how DataProcessStatus is used on each phase of the process to store its progress.
3.6. @Note web 49 •global-search: This module has a page responsible for the search operation that allows the user to find resource elements and manipulate them to build a Boolean expression to query annotated documents. The other two pages are related to the results of the query. •home: Module with some informative pages for the application. It contains the home page and the contacts page. The shared modules enumeration contains a succinct explanation on the module and/or the reusable components they contain: •corpora: –corpus-notes: responsible for displaying notes associated to a corpus; if the user has permission, enables the edition. –create-corpus: has a form with metadata for the corpus and methods for each type of corpus creation submit operation. •data-process-status: –data-process-status-table: table with the data process status processes the user has access. –running-process-status:data process status with some visualization options; periodically updates the state on the status of running processes. –show-data-report: displays the report on a data process status. •footer: has a component with the application’s footer. •navbar:module of the application navigation bar. •privileges:module for components related to changing permissions. Contains a component of a table that can be applied for multiple entities to change permissions for users on that entity. •processes : has a component displaying details of a IE process. •publications: –publication-informations: displays information on a document like meta-data and notes. The latter can also be edited. –publications-table: table for documents reusable with different applications. Example: the documents’ table for documents on a query shows the document relevance to the query;Documents’ table for corpus must only show the documents associated to that corpus.
3.6. @Note web 50 –query-relevance: display of document relevance to a query with the ability to change the relevance. •queries: has a component that displays details of a query. •resources: has two components that display details, one for a resource and the other for aresource element. •search: –search:component with the several search options like text search and filtering results. Knows how to make the request and returns the results. It is applied on tables to enable search. –show-marked: component that highlights text based on a search. •table:module responsible for displaying data in a table used in many of the other components of the application. Some operations of the table are: pagination, expandable rows, select visible columns, text search provided by a search component integration and sort by column. Data tables The focus of the current state of the @Note web application is primarily focused on visualization of information. Like the desktop application, many contents use paginated tables with search options. Tables on the web application use the DataTableModule module, which was first imported from npm, the world’s largest software registry that developers can use npm to share packages (npm). It was integrated as an application module, to enable the addition of new features. Input Type Description ITEMS any Content displayed on the table rows, it is dynamic changing based on table operations. ITEMCOUNT number Number of rows displayed on the table. HEADERTITLE string Title of the table. HEADER boolean Defines if the table shows a title. PAGINATION boolean Defines if the table has pagination operations. INDEXCOLUMN boolean Defines if the table has a column where each row shows its cardinality.
3.6. @Note web 51 INDEXCOLUMNHEADER string The text shown at the index column header. SELECTCOLUMN boolean Defines if the table has a column where each row has a check box MULTISELECT boolean Defines if the select column header has a check box EXPANDABLEROWS boolean Defines if the table has rows that can be expanded to show more information. EXPANDABLEROWSHEADER string The text shown at the expandable rows header EXPANDABLEWIDTH number—string Defines the width of the expandable column. TRANSLATIONS DataTable - Translations Translation for elements of the table like pagination. SELECTONROWCLICK boolean Defines if the row is selected by clicking on it. AUTORELOAD boolean Defines if the items are reloaded when the table component starts. EXPANDCOLUMNVISIBLE boolean Defines if the table expandable column starts as visible SERVICE string Service to be used on the search component embedded on the table. SHOWSEARCH boolean Defines if the table has search operation. BLOCKLIMIT boolean Defines if the number of rows can be altered. STARTLIMIT number Number of maximum starting rows. TABLEPARAMS TableParams Defines the column by which elements are sorted by, if it is ascending or descending order, the offset and the maximum number of displayed rows. INITIALSEARCHPROPERTIES SearchProperties A search to start the table on. SORTBY string Defines the column where elements are sorted by.
3.6. @Note web 52 Input Type Description header string Text on the column header. sortable boolean Defines if the column is sortable. resizable boolean Defines if the size of the column can be altered. property string Defines the property the column is associated to, of the items object. styleClass string The class of the cells. cellColors CellCallback Colors of the associated cells. width number — string The width of the column. visible boolean Defines if the column starts visible. Table 10.: DataTable Columns Input Figure 19.: DataTable Header of publications SORTASC boolean Defines if it is ascending or descending order. OFFSET number Defines the offset. LIMIT number Defines the maximum number of displayed rows. Table 9.: DataTable inputs A data table is divided into Header, Columns, Rows and pagination, each with their component,template (view) and style. However, the data table module also contains a main component (DataTable) (table 9contains the inputs available for this component). There are many variables that control different aspects of the table that can be manipulated, allowing for plentiful customization. Many elements that integrate the table are optional, however it is also possible to have a well-defined starting state of the table when first loading a page. Columns’ component can also be tailored for the situation, the input variables in the table 10 explain what properties can be manipulated. The header can hold the title of the table, text search field, search related buttons and table related buttons. Figure 19 shows, for the header of the publications’ table, the four groups of components. The title gives a textual representation on the contents of the table; the text search field allows free text input; the search related and table related buttons have suggestive icons for their function. Table 11 has a description for each button.
3.6. @Note web 53 Button Pressed Description When pressed shows a list of selectable fields, at least one field selected is mandatory. The search will be on the fields selected. When pressed opens a modal with filters that can be added to the search. When pressed opens a modal with a date range selector. When pressed shows a list of configurations that can be selected, applicable to the search. The possible configurations are: Whole sentence, Keywords, Case-sensitive, Filters, Year, Suggestions and Expression. Whole sentence, Keywords and Expression define how the text given as input on the text field is processed. When hovered offers a small hint of how the text search will be processed based on the selected option of the configurations button. Refreshes the table When pressed shows list of columns, the selected columns are shown on the table. Table 11.: DataTable Header buttons
3.6. @Note web 54 Table fields that the search can be based on use the component show-marked to highlight words/sentence corresponding to a search. The component has as input the text of the field, the object searchProperties that contains search related properties, like text search and configurations, and finally the name of the field. The component has a method based on regular expressions to find matching expressions to be highlighted. The algorithm takes into consideration the search options selected. For example, on the input text ”Norisoprenoids from Ulva lactuca.” with the text search field with ”ulva lactuca”, there are some variations on search options, underlining what is highlighted: •Only Whole sentence selected: Norisoprenoids from Ulva lactuca. •Only Keywords selected: Norisoprenoids from Ulva lactuca. Columns headers that can be clicked to sort results by the field they represent have a visual indication. This visual indication is a symbol comprised by one or two caret icons at the right of the column header. Clicking on it will sort table elements based on the chosen column. Two carets, one faced up on top of another faced down means that the table isnt sorted based on that column, clicking on it will sort the table by descending order represented by the caret faced down icon, clicking on it again will sort by ascending order and is represented by the caret faced up icon. Rows can have the option to be expanded by double click, which will create a space between the clicked row and the row below containing more information. On both the cardinality and expandable column there is a caret icon that is faced right, if the row can be expanded but is collapsed; when it is expanded the icon changes to caret faced down. The pagination of data tables is located on the bottom of the table, the layout is shown in figure 20. From left to right, the list explains what is displayed and the user input options: •Results: Elements currently on the table and the total of elements. •Limit: Maximum number of elements displayed, this number can be edited by focusing the current number and typing a new number, using the up and down arrows on the keyboard or using the caret icons. •Page navigation: Current page and last page; can be changed by focusing the current page number and typing the desired page or by using the intuitive buttons on both sides of this number. Curator A curator in BTM is an environment with a biomedical text with annotations clearly identified on the text. It should allow to manually curate the document and validate entities
3.6. @Note web 55 Figure 20.: DataTable pagination annotated by BTM processes. To give context to generated annotations, it is necessary to show some information on the BTM process and the resources it used. When a document is annotated by multiple processes the view should also link the annotation to the process. The current curator of @Note web doesn’t allow manipulation of annotations in the document or has visual relation cues between entities. The problem addressed is, for a document annotated by N IE processes, how to clearly identify annotations of each process and the context of that annotation. The first consideration to solve this problem is that documents have an abstract and if available the full text and only one of them could contain annotations. We decided the solution would be to have a separation by these types of texts, allowing the user to change between an abstract and full text view. To build the curator, it requires from the server: •Publication: –Metadata to give context on the document (e.g. the title). –The abstract to show annotations on the abstract view. •The full text to show annotations on the full text view. •IEProcess: –Text type of the process to know if it annotates the abstract or full text. –Metadata of the process (e.g. the name of the algorithm). •Resource: –Metadata of the resource like its name. –The type of resource, example: dictionary. •ResourceElement: –The term, the name used to represent the element. –Synonyms. –The external identifiers of the element. •AnoteClass: –The name of the class. –The color that represents the class.
3.6. @Note web 56 Figure 21.: Method ngOnInit of curatorViewComponent component •EntityAnnotation: –Annotation value. –Start and end offsets to locate the annotated entity on the text. Figure 21 goes through the most relevant steps of the ngOnInit method of curatorView- Component component. It is in this method that the majority of the information is requested and stored in structures that can be shared with the view to allow the display of information and control over annotated entities shown on the text. These structures are filled as the information is requested, for example when each IE process is iterated, and they are associated with a color. If the component has a process identifier as input, the function changeText is called to show the entities of that IE process on the text.
3.6. @Note web 57 The process of showing annotated entities on text can be described with the steps: 1. Define a reference variable in the template (e.g. <div #dataContainer ). 2. Use angular ViewChild 9decorator, as defined by Angular’s property decorator that configures a view query. The change detector looks for the first element or the directive matching the selector in the view DOM to access the element in the DOM from the component (e.g. @ViewChild(’dataContainer’) dataContainer: ElementRef;). 3. Build a string with HTML tags and style that displays the annotations properly. 4. Assign the attribute innerHTML to the element referenced in the template with the string. The first and second step on the enumeration are defined once, while the third and fourth steps are used whenever it is necessary to change the annotated text annotations. With ngOnInit, we get all the building blocks necessary to mark and style the text. However before tackling this process, it is necessary to address a major difference the abstract and full text views have. When the function to annotate entities of a IE process in the abstract is called, it will locate and mark entities of that IE process through all of the abstract text extent. First, this was also valid for full text. However, we noticed the length on many of these documents caused an extended waiting period to annotate the text. The solution implemented is to only annotate entities within a certain range of the portion of text that is visible. A range is used for two reasons, the calculated offsets are estimations and to reduce the number of times the scroll experience is aggravated by the application annotation process to a chunk of text. The annotation of the text while scrolling has the following implementations: •On the view: The div with the annotated text has an identifier the controller can use to reach the element, allow scrolling of the text and call a method defined in the component on scroll events. •On the controller: With informations from the element defined in the template(scrollWidth, scrollHeight,scrollTop,offsetHeight) (Figure 22) and the length of the text, calculate the offsets where entities can be marked between: 1.topVolume ∗textLength/totalVolume =isInInd defines the estimation of the index in the text length of the first visible character: by multiplying scrollWidth with scrollHeight, we get the total volume of the element; By multiplying scroll- Width with scrollHeight we get the volume of text not shown on the top, the top volume. If we correlate the total volume to the text length we can estimate the text length of the top volume. 9https://angular.io/api/core/ViewChild#usage-notes
3.6. @Note web 58 Figure 22.: Scroll properties 2.visibleVolume ∗textLength/totalVolume =charsInVisible defines the estimation of number of characters visible in the text: the visible volume can be calculated by multiplying the offsetHeight with scrollWidth. 3. The start offset is estimated by subtracting a range value to the estimated isInInd. If the result is lower or equal to zero the start offset used is zero. 4. The end offset is estimated by adding charsInVisible to isInInd plus the range. If this value is superior to the text length the value used is the text length. There are multiple operations to add annotations to the text, however the method responsible to add them, buildAnnotatedText, only annotates on text the annotations received as input. When on full text view methods that call buildAnnotatedText, with a subset of annotations between the offset values explained above. The method buildAnnotatedText builds a string adding to the text bHTML elements representing the annotation. The bHTML tag is used at the start of the annotation offset, at the end offset is placed the respective closing tag. This HTML element is built with five variables each applied to a attribute,attributes provide additional information about the element: 1.annotId: references the annotation, applied to the id attribute. 2.color: color of the class, applied to the style attribute, parameter color. 3.borderbottom: thickness of the border, applied to the style attribute, parameter borderbottom.
4.3. Processes 65 Figure 25.: @Note web Corpus interface the application presents a page with the processes run on that corpus (the table for processes is explored in the next section). The text search can be based on Name and Notes, and its available options are Whole sentence,Keywords and Case-sensitive. 4.3 processes Processes are BTM processes, that use resources to extract relevant information from natural text. They can be divided into two types: NER or RE. The @Note platform has several processes with different algorithms and configuration parameters. Figure 26 has a table for processes, focused on displaying the first row. In the row it displays that this process is called Linnaeus Tagger plus the date the process executed. It is an NER process and used the Linnaeus Tagger process configuration. In the expanded row space, it contains more information on how the process was configured. Continuing to explore the Linnaeus Tagger process in figure 26, it informs that the annotations accept abbreviations and words smaller than two characters are not annotated. It also shows resources used referencing its id, for example this process used a Stop Words Resource with the id: 3102121930612798438. The example shown does not display all the information, it misses some resource elements ids and a configurable parameter, Disambiguation that can be set to ON or OFF. The text search can be based on Name,Type,Process Origin and Notes, and its available options are Whole sentence,Keywords and Case-sensitive. The page presented when opening a process is illustrated by figure 27, it has a collapsible titled Process details, which when expanded shows the same information of the associated expanded row on the processes table and a table with columns unique to processes named Annotations. The Annotations column contains a list of annotated entities with the respective number of times the entity is annotated in the document. In the example presented, all annotations are of proteins, the first document has 441, the second 7and the third 488. The documents table is properly explained in the following section.
4.3. Processes 66 Figure 26.: @Note web Processes interface Figure 27.: @Note web Process interface
4.4. Documents 67 Figure 28.: @Note web Document filter modal interface 4.4 documents Documents are the base from where BTM processes extract knowledge. As the number for relevant documents increases rapidly over the years, a powerful search engine is valuable to quickly check the database on a study subject. The implemented search engine does not consider synonyms of words or tries to correctly guess abbreviations, however it can give a rough approximation and it is easy to iterate multiple search operations. Publications tables text search can be based on Title,Authors,Journal,Abstract Section,Category,Type,Notes,Full Text Content. The available options are Filters,Year,Whole sentence,Keywords,Case-sensitive and Expression. The available filters are Type (currently documents can be divided into three types: Patent,Publication,Book) and Category (examples of categories are: Journal Article, English Abstract and Case Reports). Figure 28 shows the filter modal interface with the Patent Type selected. By expanding a row or clicking on the Open button, document metadata is available. In the example presented in the figure 29, we have a publication of the Endocrine journal released in the year 2015, issue 1, authored by Kakudo et al. From the title and abstract, we get to know this is a review about patient classification related to thyroid carcinoma and ki-67 labeling index. The labels can help to quickly understand the content of the document. The page also contains external identifiers of the document, in this case we have the identifier for the pubmed database and it’s DOI. Also, a there is a place to view and edit notes when applicable and an external link (that can be updated by clicking on the icon on its side). In each publications table, it is possible to create a corpus after a search by pressing the button Create corpus that will appear as presented in figure 30. Then the corpus name and notes can be filled and, finally, submitted to start the corpus creation process. Processes
4.5. Curator 68 Figure 29.: @Note web Document interface Figure 30.: @Note web Corpus creation by document expression search interface progress are shown on the top of the page. Figure 31 illustrates how this information is displayed. If a related process to the page is running, the progress bar fills accordingly to the current percentage of progress. The report also changes with the state of the process, which when finished provides additional information. 4.5 curator The curator page, in its current state, does not allow for any editing of information. However, it has the information on annotated terms,resources and processes on the document visually integrated with the text. By clicking on a process, in the processes’ list at the right, under it will have the associated corpus and classes involved, each class with its defined color. Both Figure 31.: @Note web running process on top of page interface
4.6. Resources 69 Figure 32.: @Note curator abstract interface the process and colors can be selected to interact with the text coloring and underlining the respective entities. Figure 32 shows the curator page for a document on abstract view. It has the Linnaeus Tagger process selected, to show the annotated organisms. Similar to the process details on processes tables, if the advanced button is clicked, it shows information on the configurations and resources used (e.g. this process uses a Chebi Ontology to find metabolites and a Linnaeus Species Dictionary for organisms). In the text since only one process is selected all annotated entities have a blue underline matching the process’ color. The text color of the annotations on text facilitates in identifying entities of interest, its also evident which of these are metabolites or organisms. In the example the organism C.fragile is hovered, displaying a tooltip with black background and white text. The information on the term and it’s synonyms can be particularly useful, when the hovered entity is an abbreviation or a name the user doesn’t recognize. With the Ncbi taxonomy id, the user can go to the Ncbi website and learn more on this organism. Figure 33 has the same document, in the full text view, in the processes list it shows that the process is also named Linnaeus Tagger (different date), a referencing the same algorithm. However it also shows that this process is applied to a different corpus. This the FullText type corpus, used in the example on section 4.2. In the full text view the process managed to annotate diseases, enzymes and biomass, class types the process in the process in the abstract view didn’t. 4.6 resources Resources are fundamental pieces to BTM processes, and they usually need to be updated to cope with new discoveries or changes. The web application gives access to five types of resources: Dictionary, Lookup table, Rule Set, Ontology and Lexical words. The resources of
4.6. Resources 70 Figure 33.: @Note web curator full text interface Figure 34.: @Note web Resources interface each type are divided in a tab menu, containing a search data table with the resources of the corresponding type. The data table columns are: Name,Information,ID,Permission - button with the permissions configurations panel for resources,Remove - operation to remove the resource,Open - opens a view associated to the selected resource. The expanded row contains information on the number of terms and synonyms in the resource, and a list of all classes with their id. The text search can be based on Name and Information; its available options are Whole sentence,Keywords and Case-sensitive. In figure 34, the tab menu is set on the resource type Dictionary, as such the search data table contains resources of that type. In the Uniprot dictionary, the row is expanded showing that it contains 147198 terms and 143374 synonyms, all proteins. Opening a resource changes to a page illustrated by figure 35, that contains a table for a resource, its columns are: Term,Class,Synonyms. The expandable row gives information on the synonyms and external Ids.
4.7. Global Search 71 Figure 35.: @Note web Resource interface Figure 36.: @Note web global search initial state interface 4.7 global search The globalSearch page is dedicated to form a Boolean expression of resource elements contained in resources. The expression can be evaluated returning the publications with annotated terms that match the query. As presented in figure 36 at the top, we have a search field on resource elements, where the fields available are: Name,Synonyms and External Ids, with the available options Filters, Whole sentence,Keywords,Suggestions and Case-sensitive. The filters model contains a tab menu with the available resource types, each containing a search data table of resource, with the option to select a resource for the filter. If the resource has multiple classes, by expanding its row classes, each class can be selected individually for the filter. In the example presented in figure 37, the results will be filtered by organism. The search results will show on the left empty space as a list, each row containing the term followed by the class with parenthesis finished by a maximum of two synonyms (if the term has any). Rows can be expanded showing all other names and external identifiers. In figure 38, the Ulva lactuca organism (an algae) in the resource elements list, was added to the query builder by pressing and holding, and dragged to the dedicated space for the query
4.7. Global Search 72 Figure 37.: @Note web global search Filters interface building at its right. At the far right are the available Boolean operators that can also be dragged and dropped into the query building space. The building space works as a tree with levels, the empty space is the first level and works as an OR operator where terms and operators can be added. Terms already present in a level will not be possible to add (the cursor icon will change to ”forbidden operation”). When operators have other elements attached to them, they will have the option to be collapsed or extended. All elements have the option to be selected, while term elements have the same option to be expanded as they were in the list of resource elements. As an example, we show how to find documents containing Ulva lactuca and cisplatin, used in cancer treatment. The query is executed by pressing the button Execute query. A new tab opens in the browser with the page that contains a table with the resulting documents of the query. These results are shown in figure 39. The first document is a study that evaluates the toxicity and bioaccumulation of cisplatin in the marine environment using Ulva lactuca. In the second, we have a study related to cancer and algae. Both are relevant to the domain of the search, however they can be irrelevant to more specific subjects of study. This query had 11 results; it can be refined to either narrow the results even further or broaden them (e.g. add more cancer related entities, or other algae). It is possible to create a corpus with these documents by pressing the Create corpus button.
4.7. Global Search 73 Figure 38.: @Note web global search interface building a query Figure 39.: @Note web global search results interface
4.8. User 74 Figure 40.: @Note web User administration management interface Figure 41.: @Note web User administration process data status interface 4.8 user On the @Note web platform, users can edit their personal information by accessing the user page like updating their address, photo or change the password. The page also contains the administration menu where the admin can create new users, and all users can access queries, corpus,resources and processes available to him and change permissions when applicable (figure 40). The last option is to check the running and finished processes on the process data status table, as shown in figure 41.
81 Columns Fields qu query date •quDateSort qu keywords •q keywordsCS •q keywordsNCS qu organism •q organismCS •q organismNCS qu matching publications •quMatchingPublicationsSort qu query name •q query nameCS •q query nameNCS •quNameSort Table 13.: Queries’ @Fields Columns Fields crp corpus name •crp nameCS •crp nameNCS •crpNameSort crp notes •crp notesCS •crp notesNCS •crpNotesSort Table 14.: Corpus’ @Fields
82 Columns Fields au username •auUsernameCS •auUsernameNCS •auUsernameSort au fullname •auFullNameCS •auFullNameNCS •auFullNameSort au email •auEmailCS •auEmailNCS •auEmailSort au location •auLocationCS •auLocationNCS •auLocationSort Table 15.: AuthUsers’ @Fields Columns Fields pro name •pro nameCS •pro nameNCS •proNameSort pro notes •pro notesCS •pro notesNCS Table 16.: Processes’ @Fields
83 Columns Fields po description •pro po descriptionCS •pro po descriptionNCS •pro po descriptionSort Table 17.: ProcessOrigins’ @Fields Columns Fields pt process type •pro pt typeCS •pro pt typeNCS •pro pt typeSort Table 18.: ProcessTypes’ @Fields
84 Columns Fields pub title •titleCS •titleNCS •pubTitleSort pub authors •authorsCS •authorsNCS •pubAuthorsSort pub category •categoryCS •categoryNCS •pubCategorySort pub journal •journalCS •journalNCS pub abstract •abstractCS •abstractNCS pub fullcontent •fullContentCS •fullContentNCS pub notes •notesCS •notesNCS pub type •typeCS •typeNCS •pubTypeSort Table 19.: Publications’ @Fields
85 Columns Fields res element •keywordEdgeNGram res element •tokenEdgeNGram res element •res elementCS •res elementNCS Table 20.: ResourceElements’ @Fields Columns Fields reso resource name •reso resource nameCS •reso resource nameNCS •resoNameSort reso notes •reso notesCS •reso notesNCS •resoNotesSort Table 21.: Resources’ @Fields Columns Fields syn synonym •keywordEdgeNGram syn synonym •tokenEdgeNGram syn synonym •syn synonymCS •syn synonymNCS Table 22.: SynonymsId’s @Fields