ChemLog: Making MSOL Viable for Ontological Classification and Learning

Simon Flügel, Martin Glauer, Till Mossakowski, Fabian Neuhaus · 2025

Read ChemLog: Making MSOL Viable for Ontological Classification and Learning by Simon Flügel, Martin Glauer, Till Mossakowski, Fabian Neuhaus (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2507-13987.txt.

Introduction

Chemistry databases need labels for millions of molecules, and a 2025 paper by Simon Flügel and co-authors pairs strict logic with deep learning to supply them. The logic they use, monadic second-order logic, can state class rules that the common web ontology language cannot express.

Their system, ChemLog, starts with logic-based rules for fourteen peptide classes from the ChEBI ontology. Those rules were run on ChEBI itself and on 119 million molecules in PubChem. The logic alone can only label the set classes, so the team used its labels as training data for transformer models. Those models then label the whole ontology, and their accuracy rose sharply thanks to the clean logic-made training set.

Catalog record

CREATORSimon Flügel, Martin Glauer, Till Mossakowski, Fabian Neuhaus
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE38 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2507-13987

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

ChemLog: Making MSOL Viable for Ontological Classification and Learning Simon Flügel, Martin Glauer, Till Mossakowski, Fabian Neuhaus Abstract Despite its prevalence, in many domains, OWL is not expressive enough to define ontology classes. In this paper, we present an approach that allows to use monadic second-order formalisations for ontology classification. As a case study, we have applied our approach to 14 peptide-related classes from the chemistry ontology ChEBI. For these classes, a monadic second-order logic formalisation has been developed and applied both to ChEBI as well as to 119 million molecules from the chemistry database PubChem. While this logical approach alone is limited to classification for the specified classes (in our case, (sub)classes of peptides), transformer deep learning models scale classification to the whole of the ChEBI ontology. We show that when using the classifications obtained by the logical approach as training data, the performance of the deep learning models can be significantly enhanced. 1 Introduction Ontologies of structured objects (such as chemical molecules) can be used for the classification of new unseen objects (and thus, for the extension of the ontology) in two ways: (1) the structure of the objects can be used to train deep learning models [ 7 ] . These models directly work on a graph-like structure (e.g., Graph Neural Networks), or on a string representation of structured objects (e.g., Transformers). (2) Alternatively, logical axioms can be used for axiomatising classes of structured objects, the latter being construed as first-order models [ 12 ] . Note that generally, these logical axioms are not part of the OWL formalisation of the ontology, but are specifications of single classes expressed in a richer language like first-order logic (FOL) or monadic second order logic (MSOL). MSOL has been termed the “finite automata for graphs”, and (unlike FOL) it can be used to speak about paths in a graph and subgraphs of a graph [ 4 ] . When using MSOL, a key challenge is its model checking complexity and scalability to large datasets. In this work, we first follow the logical approach and present ChemLog , a methodology that can bridge the gap between complex second-order definitions of classes of structured entities and their application to large datasets. Our approach consists of three stages: In the first stage, we use monadic second-order logic (MSOL) to fully formalise the ontology classes of interest. In the second stage, we translate these definitions to a set of partial definitions in FOL. Finally, we turn the FOL definitions into a purely algorithmic implementation. This allows us to check efficiently which instances fulfil which definitions, while simultaneously ensuring the alignment of the procedural implementation with the original declarative MSOL definitions, thereby enhancing the trustworthiness of the implementation. Each stage comes with a different type of reasoning: While the algorithmic stage provides a direct result, for the FOL stage, we resort to a model checker. For MSOL, model finding with the MONA reasoner [ 9 ] and a conversion to Quantified Boolean Formulas (QBF) are used. In a case study on the Chemical Entities of Biological Interest (ChEBI) [ 8 ] ontology, 14 classes related to peptides have been selected. This section of ChEBI includes 14,879 molecules (out of 179,115 in the complete ontology as of version 239). For these classes, we have formalised the existing textual definitions into MSOL, taking the instances of classes and definitions from IUPAC [ 10 ] into account to resolve ambiguities. On this example, we demonstrate the process of transitioning from MSOL to FOL and an algorithmic solution. We evaluate the alignment of the layers on the ChEBI ontology and use the algorithmic layer to identify peptides across 119 million molecules from PubChem. This shows both that the algorithmic layer is a faithful representation of the MSOL layer, and also that the algorithmic layer is able to cover large datasets that not only cover the size of current domain ontologies, but extend them significantly. In the second part of our paper, we demonstrate how the results of the logic-base classification can improve the quality of deep learning models that classify new molecules in the ChEBI ontology. We train Transformer models both on the original ontology, as well as on our reclassification of the 14 ChEBI classes according to our formalised definitions. The model trained on our reclassified data improves on the ChEBI-trained model by a significant margin (from a micro F1-score of 85% to 93%). Even on the original ChEBI, the new model achieves a recall of 92% (compared to 81% for a model trained directly on ChEBI). This indicates that our classification stays true to the intentions of the original ChEBI classes, while improving the consistency and completeness of the taxonomy. The paper starts with an introduction to our peptide axiomatisation in Section 2 , followed by an explanation of our proposed methodology (Section 3 ). In Section 4 , we show the results of our evaluation on ChEBI and on PubChem. Section 5 discusses the effect of the logical classification to deep learning classification. This is followed by a discussion of our results in Section 6 . In Section 7 , we give an overview over related work. Finally, we draw conclusions and give an outlook on future work in Section 8 . 2 Axiomatising Peptides In order to showcase our approach, we will use the concept of peptides in the ChEBI ontology. We have developed MSOL definitions for 14 ChEBI classes related to peptides. Peptides, as defined in ChEBI, are “Amides derived from two or more amino carboxylic acid molecules (the same or different) by formation of a covalent bond from the carbonyl carbon of one to the nitrogen atom of another with formal loss of water. […]”. Thus, our main task for deciding if a molecule is a peptide or not, is to identify the amino acids from which it has been derived. Regarding amino acids, ChEBI states that “The term [peptide] is usually applied to structures formed from alpha -amino acids, but it includes those derived from any amino carboxylic acid.” (a) Structure of the alpha -amino acid L-cysteine . All \alpha -amino acids follow this structure, only with changing side chains. (b) Workflow of our methodology. The MSOL axioms are used to verify their correspondences in FOL, which in turn are used to verify the algorithmic implementation. At the same time, each layer can be used on a different scale. Amino acids are defined by the presence of two functional groups, amino groups and carboxylic acids. In alpha -amino acids, they are directly connected by a carbon atom (the amino group is located at the alpha position relative to the carboxylic acid, cf. Figure 1(a) ). Since other amino acids are explicitly included, we consider every substructure of a molecule in which the residues of a carboxylic acid and an amino group are connected via a chain of carbon atoms an amino acid residue. Then, we verify if these residues are connected according to the definition (i.e, by a bond between the carbonyl carbon of one amino acid residue and the nitrogen atom of another). Formally, amino acid residues are defined in MSOL as follows: \text{{AAR}}(X)\leftrightarrow(\text{{BuildingBlock}}(X)\wedge\exists a,c_{1},c_{2},c_{3}:(\text{{AminoResidue}}(a)\\ \wedge\text{{CarboxyResidue}}(c_{1},c_{2},c_{3})\wedge a\in X\wedge c_{1}\in X\wedge c_{2}\in

Read the complete text