Archive for the ‘Ontology’ Category

This post carries the text of a paper accepted for PLoS One. I publish it here as a pre-print because of the recent discussion on OBO discuss about realism. I have converted this from the original latex, which isn’t perfect. Apologies for errors.

The [PDF] is available here.

Adding a little reality to building ontologies for biology
Phillip Lord and Robert Stevens
School of Computing Science
Claremont Road
Newcastle University
Newcastle-upon-Tyne, UK
phillip.lord@newcastle.ac.uk
School of Computer Science
The University of Manchester
Oxford Road
Manchester, UK
robert.stevens@manchester.ac.uk

Abstract

Background: Many areas of biology are open to mathematical and computational modelling. The application of discrete, logical formalisms defines the field of biomedical ontologies. Ontologies have been put to many uses in bioinformatics. The most widespread is for description of entities about which data have been collected, allowing integration and analysis across multiple resources. There are now over 60 ontologies in active use, increasingly developed as large, international collaborations.

There are, however, many opinions on how ontologies should be authored; that is, what is appropriate for representation. Recently, a common opinion has been the “realist” approach that places restrictions upon the style of modelling considered to be appropriate.

Methodology/Principle Findings: Here, we use a number of case studies for describing the results of biological experiments. We investigate the ways in which these could be represented using both realist and non-realist approaches; we consider the limitations and advantages of each of these models.

Conclusions/Significance: From our analysis, we conclude that while realist principles may enable straight-forward modelling for some topics, there are crucial aspects of science and the phenomena it studies that do not fit into this approach; realism appears to be over-simplistic which, perversely, results in overly complex ontological models. We suggest that it is impossible to avoid compromise in modelling ontology; a clearer understanding of these compromises will better enable appropriate modelling, fulfilling the many needs for discrete mathematical models within computational biology.

Introduction

Ontologies are now widely used for describing and enhancing biological resources and biological data, largely following on from the success of the Gene Ontology [1]. Ontologies have been used for many purposes, from schema integration to value reconcilliation to query interfaces [2]. Ontologies have also become a cornerstone of computational biology and bioinformatics. As computationally amenable artifacts they are, themselves, a direct part of computational biology; many computational biologists are involved in their production and maintenance. Many more use ontologies to summarise their data, often by looking for over-representation [3], as the basis for drawing computational inferences about data [4], or as the basis for determining semantic similarity [5]. Even those not making direct computational use of ontologies are likely to come into contact with them, for example, when preparing annotation as part of their data release [6].

It is, therefore, of vital interest to computational biologists that ontologies for use within biomedicine are fit for purpose. One effort that aims to increase the quality of the ontologies available within biomedicine is the “OBO Foundry” [7]. The main tool that it uses for this is “an evolving set of shared principles governing ontology development”. The initial eleven principles of the OBO Foundry [8] were largely concerned with what might be termed ‘good engineering practice’ (ontologies must, for example, be openly available, with a common syntax, well documented, and used). These principles have later been joined by a further eleven [9]; these include principles such as “textual definitions will use the genus-species form”, “Use of Basic Formal Ontology” and, the somewhat quixotic, “terms […] should correspond to instances in reality”. These stem not from engineering practice, but from a perspective called realism.

The many different uses for ontologies that we have described are reflected in different understandings and methodologies about how and what to represent in an ontology. Over the last few years, for many uses the paradigm has moved from “a conceptualization of the application domain” toward “a description of the key entities in reality”; it is this latter approach that defines realism [10]. This approach to ontology is typified by the Basic Formal Ontology (BFO); a small upper-ontology for use within science in general and biomedical ontology building in particular [11].

There has been significant discussion regarding the possibility of representing only “real entities” in computational ontologies [12]. Likewise, there has been significant discussion about the philosophy surrounding realism and the role of ontology in its representation [10]. While it is argued by some that it is possible to represent only reality when making a domain description, there has, however, been little discussion on whether it is necessarily desirable to do so.

In this paper, we consider the implications that realism has for the choices that are open to the ontologist while they are modelling their domain of interest. In particular, we consider the implications that this has for the computational capabilities of any resultant ontology, in terms of its ability to represent scientific knowledge in a computationally amenable form, as well as the ability to perform automated inference or statistics over this knowledge. We suggest that the application of realism results in ontologies that are over-complex, awkward or limited; as such, realism falls far short of its aim of increasing the fitness-for-purpose of ontologies. This approach, therefore, is unlikely to fulfil the needs of computational biologists whom form a substantial part of both the user and developer community for bio-ontologies.

Methods

In this paper, we take the approach of a number of worked exemplars; this is a complementary approach to an in-depth consideration of the modelling decisions for a particular area or particular ontology, which we have used previously [13], as it allows broader conclusions about the general principles of ontology development. For each section, as well as the main exemplars, a number of related examples are briefly discussed, to reinforce that the issues raised are, indeed, general.

The exemplars have been selected by several criteria. First, all the main exemplars are all taken from within biomedicine; this is also true for the majority of the related examples. Second, we have chosen exemplars that provide as wide a coverage of biology as possible. For practical reasons, third, we have chosen exemplars where the underlying science is relatively basic to much of biology and is likely to be immediately clear to the reader without significant explanation.

We have chosen exemplars requiring as little knowledge of specific ontologies as possible. We refer to only three. The first is BFO (see “sec:what-realism-2”) which is a canonical example of a realist ontology. BFO is described as a cross-domain, upper-ontology; as a result, most terms fail the criteria given above; they are of poor biomedical relevance, and are not basic science or immediately clear. We have, therefore, also used PATO (see http://obofoundry.org/wiki/index.php/PATO:Main_Page); this defines “qualities” that we might consider attributes of other entities; so, the authors of this paper have a height, weight and shape, all of which are considered to be qualities of the authors. Finally, we use the relationship ontology [14]; this describes the relations between entities. So, for example, the height of the author inheres_in the author.

As discussed in this and other works [15, 16], “realism” is itself poorly defined. Where this lack of definition makes the consequences of realism hard to determine, we have taken the practical course, of showing the consequences as they play out in practice; to an extent, therefore, these three ontologies are not only exemplars for realism, but define it, as it is currently practiced. In short, for this paper, when we say “realism”, we largely mean “realism as practiced by BFO”. We do not claim, in this paper, to address all the philosophical perspectives that through time carried the name “realism”.

Results

What is Realism?

Building ontologies based on reality is obviously appealing to most scientists; after all the study of reality to determine its behaviour and laws is the goal of scientists. A brief consideration, however, shows that this notion cannot define a methodology for the building of ontologies.

Within the context of science “reality” would normally be taken to mean our experimental or observational data; but the statement that science (ontologies) should be based on experimental or observational data is a truism and, as such, has no explanatory power. The “real” in realism refers, in fact, to the belief that the categories that we can use to divide entities are, themselves, real.

This distinction stems from an old argument from philosophy; realism against conceptualism. Again, both sides of the argument agree that the world we can percieve, and as scientists, experiment on, is mind-independent. The conceptualist, however, argues that the categories that they term concepts are a product of social agreement. Conversely, the realist argues that these categories that they term universals are themselves real, that is mind independent in their own right, like the entities they describe.

This distinction may seem fairly confusing; as Russell [15] says “if I have failed to make Aristotle’s theory of universals clear, that is (I maintain) because it is not clear”. In fact, there is a third possibility that is a more empirical view—that is, if categories (or other models) help in describing and predicting experimental data, then they are useful regardless of whether they are real or otherwise [17]. As an example, the Mendelian notion of segregating units of inheritance was defined and useful many years before a complete mechanistic description of their cause was available. In this context, we note that there is no commonly used term to express this form of category; most commonly, “concept” is used.

For a field with a core activity of providing definitions, there is surprisingly little agreement on the meaning of the word “ontology”; as there have been many papers on the topic, we consider just a few that reflect the distinction between these approaches. Probably the most commonly cited definition [18] describes an ontology as “a specification of a conceptualization”. This definition emphasises the formality (i.e. logical and, therefore, computationally amenable) aspect to ontology development.

This is countered with a realist definition; while the requirements from Gruber’s definition—a formal specification—are necessary, realist ontologies add the requirement that “the nodes and edges correspond not to concepts but, rather, to entities in reality” [19].

What does“reality” in this context actually mean? Definitions such as “that which exists” are strangely circular leaving the question of what “exists” means. Smith [12] adds the priviso that reality is “captured in scientific laws”. Being a scientific law is not strictly enough, as some are later shown to be wrong, but a scientific law is the current best attempt at reality; this possibility does not make an ontology non-realist. For a realist ontology, the nodes are “universals”—entities in reality—rather than concepts; at least one particular must exist for every universal.

This still leaves the difficulty of applying the realist definition in practice. So most scientists will happily accept, for example, that a cell is real as it is an entity that can be observed, interacted with and manipulated. However, concepts such as “function” [13] have raised more discussion [20]; is this “real” or just a word biologists use as a point of reference? While the definition involving “entities in reality” maybe of philosophical interest, they are hard to turn into a specific assay; how to test whether a particular concept is, also, a universal. Instead of a clear assay for existence, realism offers direction about what concepts are NOT reality, rather than those that are reality. For example, and perhaps ironically given the negative practical definition of reality, a statement such as:

  Dog is_a not Cat

is not held to be a statement about reality as it is a logically constructed example of subsumption (an is_a relationship); there is no real universal containing particular not Cats in existence. Likewise,

  Dog is_a (Dog or Cat)

as the existence of particular Dogs and Cats does not mean that there are any particular Dog or Cats (examples modified from [12]).

This is not meant to provide a complete introduction to “realism”, but to provide a grounding for the discussion that follows; we will consider the issues raised by realism, throughout the paper. A more philosophical treatment of realism is given by Merrill [16]. It is useful to note that Gruber’s [18] statement that “And it [a computational ontology] is certainly a different sense of the word than its use in philosophy.”. In this paper, we are concerned with the ontologies as computational artefacts.

To summarise, a realist approach to ontology says that the categories or universals in to which objects or particulars fall have an existence in their own right. It is these universals and only these universals that a realist approach says should be the nodes within an ontology. In this paper we examine whether this approach is an adequate means to provide an account for the data produced by biomedicine.

Models that represent reality

In this section, we suggest that many universals have a range of representations. In some cases, the choice of representation may be obvious, such as length which has a natural scientific representation in SI units. In many cases, however, there is no clear set of criteria for choosing between representations. We consider the way that one quality, colour, could be represented ontologically.

Colour is a complex phenomenon. The colour of an object or other phenomena arises, in part, from that object and, in part, from the eye that perceives it.

A representation of the physical reality would be an account of the reflection, transmission and perception of light by an organism. Such an account of the reality of light and its perception might cover the following facts: Chlorophyll is green in reflection and red in transmission; a flower petal appears white to a human, but has UV stripes to a bee; the plant leaf and the algae appear green to humans, but have different reflection spectra because their chlorophyll co-ordinate to their Mg2+ ion in different ways.

There have been a number of different attempts to represent the complexities of colour numerically, for a number of different purposes. These are models that allow us to describe colour, without having to deal with the underlying physics or reality of colour. Probably the best known of these are RGB (Red, Green, Blue) or HSV (Hue, Saturation, Value), both of which are additive colour models appropriate for describing colour on a display screen. CYMK (Cyan, Yellow, Magenta and Black) is a subtractive colour model and commonly used for printing.

Collectively these representation schemes are known as colour models. That none of these schemes has become predominant reflects both their different uses and the preferences of different user groups.

For the ontology builder, this leaves us with a difficult choice:

  1. We bless one of the colour models, substituting the model for the underlying physics and do not describe the others.

  2. We describe all of the colour models, but do not describe that they are part of a colour model.

  3. We explicitly describe the reality of the physics, biology and the relationship to the different colour models, reflecting the practise of describing colour in much of science.

Currently, considering the PATO ontology, which is documented as being built according to realist principles, the first approach has been taken, using the HSV scheme. So, PATO has a term Color Hue (PATO:15) that is defined as :

“A chromatic scalar-circular quality inhering in an object that manifests in an observer by virtue of the dominant wavelength of the visible light; may be subject to fiat divisions, typically into 7 or 8 spectra.”

Using this model, PATO describes red (PATO:322) as :

“A color hue with high wavelength of the long-wave end of the visible spectrum, evoked in the human observer by radiant energy with wavelengths of approximately 630 to 750 nanometers.”

This modelling approach has a number of limitations.

  • The decision to choose one colour model or the other is arbitrary. While there are reasonable justifications for the use of HSV as opposed to, for example, RGB, there is no a priori justification for use of an additive colour model as opposed to a subtractive model. Both are valid, for different usage; in general, reflective colour is more common in biology (e.g. pigmentation) than emitted colour (e.g. fluorescence) which would suggest that subtractive models are more generally applicable, but a full treatment requires both.

  • There are no terms which can be used to express data described according to other colour models, necessitating a transformation between the different models into the officially “blessed” version during application of the ontology. These transformations may be lossy and not fully reversible.

The second approach is also possible. This would allow expression of data in multiple colour models, however:

  • The ontology would tend to get rather confusing as more colour models are added; colour would have children “Hue”, “Red” and “Cyan” and seven other sibling terms.

  • It is not clear which terms comprise a colour model: do values for “Hue”, “Green” and “Magenta” specify a colour?

  • It is not clear whether terms that occur in the other contexts are equivalent. Is “Red as in RGB” the same or different as Red (PATO:322)? Is “Hue as in HSV” the same or different from “Hue as in HSL” (HSL is another additive colour model).

The third approach does not suffer from the limitations described. We suggest from this analysis that it is necessary, if unfortunate, for some qualities to be explicitly described with multiple representations. To avoid confusion, the universal quality, colour, would need to be explicitly described as having multiple valid models. Yet, realism argues that we should not do this, as colour is real and not a model; more over, the focus on realism means that the documentation does not describe the choices that have been made, nor refer to the relationship between Color Hue (PATO:15) and “Hue as in HSV”. In short, realism has limited our ability to represent colour.

Related Examples

There are many different examples of this issue; having two or more models to describe the same part of reality is common. The distance between two markers on a chromosome can be measured using (one of a number of) genetic techniques. Some qualities have a bewildering array of different measurements associated with them; Wikipedia, for example, lists 13 different measurements of concentration such as molarity or \(gm^{-3}\).

This issue has been previously recognised. In computing science, explicitly modelling one model in another is a form of metamodelling. Other, non-realist, upper-ontologies such as DOLCE use the concept of Quale to describe a cognitive abstraction (such as Colour), including those over a physical quality (such as the spectral properties of reflected light) [21].

Sequences and the Central Dogma

The central dogma of molecular biology suggests that all genetic information is encoded in the DNA of a cell, as the ordered nucleotides that comprise the DNA. RNA is transcribed from this DNA. The RNA molecule also has a defined order of nucleotides related to the DNA. Finally the RNA is translated into protein.

Consider an ontology describing these entities. First, the DNA molecule has a number of properties; as well as physical dimensions (discussed further in “sec:limits-consistency”), including a length expressed in metres, it consists of a number of monomeric units. So, for example, we might say a DNA molecule with a series of nucleotide residues represented as ‘GATC’ has­Monomeric­Part 4.

This causes a slight worry from a realist perspective; the number 4 may not be a realist universal. There are no instances of 4. In this case, the number 4 is being used to describe a part of reality, so this is allowable in a realist ontology. Alternatively, we could describe the same reality using units (traditionally base-pairs or bp). Therefore, the DNA molecule has­Polymer­Length 4bp.

Accepting the use of natural numbers in this way, also means that we accept the use of sets and sequences to describe reality. One definition of 4 is a sequence. Stating that the DNA molecule represented with the sequence ‘GATC’ has­Polymer­Length 4bp is equivalent, therefore, to stating that it hasSequence ‘NNNN’ where ‘N’ is any nucleotide residue.

It should be noted, however, that the usefulness of these statements stems from our implicit knowledge. The number 4 is a natural number, so has­Monomeric­Part 4.2 is not possible. If a new monomer is attached to our DNA molecule, it will now has­Monomeric­Part 5, because the natural numbers are additive. We understand the operation of natural numbers as part of our shared, background knowledge, and we can apply this knowledge here.

Having described that the DNA molecule represented as ‘GATC’ has­Polymer­Length 4 (or hasSequence ‘NNNN’) we might wish to be more specific about the order of nucleotide residues and state hasSequence ‘GATC’. The implicit background knowledge we used previously about the natural numbers still applies here.

Next consider the process of transcription. The previous discussion about DNA likewise applies to RNA. The RNA molecule will, however, hasSequence ‘GAUL’, as RNA uses a different set of bases to DNA. Mathematically, one sequence can be determined from the other by applying a mapping; though the mapping is a human activity, not a representation of biochemical reality. To describe this, we have two options:

  • Taking the realist approach, we can continue to rely on the implicit knowledge of the biologist, as we have previously relied on an implicit understanding of the natural numbers.

  • We can be explicit about the properties of these sequences (additional to those properties shared with the naturals). We can talk about non-real world concepts such as alphabets, transformations and how these map to the real entities involved.

It should be noted that the former severely limits the ability to describe the central dogma. The transformation of DNA to RNA sequence is simple, but the transformation of RNA to protein is more complex. Again, the choice is between representing reality or representing how we practise science.

Related examples

The issues relating to sequences are fairly general. In computer science terms, these are abstract data types. The DNA sequence is a kind of sequence with special properties (a limited alphabet). Many of the physical quantities in science have special properties in this way. Consider:

Temperature:

While these look like positive real numbers, temperatures are only meaningfully subtracting from each other, which gives information about heat-flow between two bodies. Other operations (addition, multiplication) which are useful for real numbers have little meaning for temperature.

Recombination Distance:

These look like probabilities but are not, requiring a transformation to add.

There is a limitation on the ability to use abstract data types within a given ontology language; in most cases, the expressivity of the language will not allow arbitrary mathematical relations. Some languages, such as OWL, for example, provide “concrete domains”; these provide extension points within the ontology language where, for example, the special properties of temperature could be represented; other languages do not. In either case, there are limitations to these capabilities; for example, the constraint and behaviour of a concrete domain needs to be interpreted with its own semantics within a reasoner, rather than expressed explicitly within the ontology. It may make more sense in many circumstances to describe the existence of a mathematical model as discussed in “sec:go-where-science”.

The limitations of computers

Modelling continuous properties is a common problem in ontological engineering. For example, according to statistics the western world is now facing an obesity epidemic; in short many or most of us weigh too much. Understanding, however, exactly what “too much” means is not necessarily simple; a common technique to use is body mass index (BMI)—body weight divided by square of the height, which is a continuous value. The BMI range is split into 4 categories: Obese (>30), Overweight (>25), Normal (>18.5) and Underweight (<18.5). These categories represent ranges of the value of BMI.

This data simplification has many justifications. On an individual basis, the BMI is not a particularly accurate measure, so the simplification does not lose much accuracy. It is also easier to describe to patients, for whom a “BMI of 25” will be less comprehensible than being “overweight”.

Modelling some of this is straight-forward. Height and weight are modelled as properties of the individual. The BMI would therefore appear to be a property of the individual as it is a restatement of two existing properties. It would appear, therefore, that the category into which an individual falls should also be a property of the individual.

Consider the values of the property next. These categories are an abstraction over the real-world properties. Although, height as an integer value is expressed using a non-real-world entity, it is a description of a part of reality. A range, however, in the BMI does not describe part of reality in the same sense. There are no instances of BMI “Obese”. In a realist ontology, therefore, it is unclear what the relationship is between BMI Obese and the individual person.

For the statistician or computer scientist, there is an additional advantage to the simplification; four discrete groups have better computational properties than a continuous measure. Database queries become easier to write, and quicker to run. This is also true for the ontology builder; simplifying the real-world may fulfil the needs of an application for which the ontology is built, while avoiding unnecessary complexity. This is a widely used method for representing partitions of continuous values, the appropriately named value partition [22].

In the case of BMI there is a pre-existing social agreement toward a set of categories; however, even in the absence of such an agreement, the ontology builder might wish to represent a continuous range as a value partition to decrease the complexity of their ontology. The value partition is useful, but many of the concepts involved are not realist universals. The choice, then, is modelling “reality” and modelling a simplification that is easier to use and has better computational properties.

Related Examples

Splitting the two cases, there are many examples of pre-existing simplifications. From medicine, there are so many that it seems to be the norm rather than the exception: hypo- vs hyperthermic; hypo vs hypertensive; hypo- vs hyperglycemic. In many cases, these ranges have standard interpretations akin to the BMI.

There are likewise a number of constructions or design patterns that reduce complexity, extend the effective capabilities of the language or simply provide standard solutions to common problems [23].

To go where science has gone before

Many experiments in biomedicine require the measurement of some physical property of a biological system. Take, for example, the measurement of heart rate; in standard practice, this is measured in beats per minute, and is calculated simply by counting beats (\(b\)) over a time period (\(t\)) and dividing one by the other (\(b/t\)). However, what time period is appropriate? We might choose 60s, but this raises the question, what is the meaning of heart rate over shorter periods?

Fortunately, there is a standard solution to this problem, which is to define heart rate using differential calculus; so heart rate becomes \(db/dt\).

The derivative, \(db/dt\), presents some problems from a realist perspective. As noted previously (see “sec:sequ-centr-dogma”), it is possible to associate real numbers with entities; however, \(db/dt\) is \(0/0\). It is not clear whether this quantity is a universal; it is certainly the case that the expression \(db/dt\) is not a universal, yet such values and calculus itself is apowerful tool within science and not using it within ontological models is a severe restriction.

We can describe this ontologically in three ways:

  • We can model the real world entities involved – beats, time and describe nothing else.

  • We can describe rate in mathematical terms. In this case, we are defining the heart rate as a mathematical abstraction.

  • We can model the heart rate as a real world entity, \(db/dt\) as a mathematical entity and explicitly state that $latex db/dt is a model of heart rate.

These different solutions present different advantages. The first is consistent with realism. The second is consistent with the most common definition used within science. The third is consistent with both but it is unclear when to use which term (for example, is \(\Delta {}b/\Delta{} t\) an approximation of \(db/dt\), a quantification of the real world quality or both)?

In most cases for the description of science, the second option makes most sense; conflating the mathematical model with the real entity enables us to use the advantages of two different modelling techniques without introducing the confusion of the third option.

Related Examples

There are many related examples from mechanics, electromagnetics or chemistry; as with value partitions in medicine, so many that they appear to be the norm. All of these subject areas have direct relevance to biology and, perhaps even more so, to the equipment used in the practice of biology.

Mechanical examples would include velocity (\(dr/dt\)) and acceleration (\(d^2r/dt^2\)). Electromagnetics would include current (\(dC/dt\)) and capacitance (\(dV/dt\)). Chemistry examples would include rate constants and pH. In biology, population biology, systems biology and neurosciences make wide use of mathematical models. The lack of a link in realist ontologies to these mathematical models is not free from consequences (described further in “sec:discussion”).

The more general issue comes not from relating to differential calculus, but relating to pre-existing non-ontological techniques. For example, taxonomy in the linnean sense. There have been many discussions about whether species and high taxons are reflective of reality; it is certainly the case that a number of higher taxons do not reflect phylogeny [24]. Given that it is of uncertain status, should we represent taxonomy as a quality of an organism, an independent conceptualisation of the biologists or both?

The limits of consistency

Physical biological entities such as cells and organisms have an extent in the real world. This paper’s first author, for example, has a height of around 1.8m; a similar value cannot be applied meaningfully to the electronic version of this document, although it may apply to the paper that it may be printed on.

There are a number of different, well-understood mechanisms for representing physical space. We can use a dimensional or cartesian model, with three perpendicular lines with a linear scale. We can use a polar model, expressing extent using angles and a single distance. Modern physics has told us, however, that all of these are limited models of reality; physics generally uses a four dimensional Minkowskian spacetime model; here the axes are not linear; motion of the observer down one will change values down the others. Alternatively, at a quantum level, length is a probability distribution.

For the ontology builder, this leaves a difficult choice and the same choice discussed previously in “sec:colo-colo-models”: Represent the reality physicists relate; bless one, ignore the rest; describe their components but not their models; explicitly describe them.

If the ontology builder is to be consistent, then, they should make the same choice in both cases; if we describe colour models, we should explicitly describe Minkowskian spacetime, quantuum probability distributions, cartesian and polar systems.

There are, however, two important differences to colour models. First, there is a strong social bias toward cartesian systems. Secondly, within the scope of biology and the life sciences, four dimensional spacetime or quantuum models confuse rather than simplify; the relativistic corrections produce such small differences that they are statistically meaningless; similarly, describing a leg as a probability distribution adds little other than complexity.

This leaves the ontology builder with two options:

  1. We can build an ontology with a consistent relationship to reality. So, having decided to explicitly represent colour models, this suggests that we should also explicitly model 3D space, 4D spacetime and the various co-ordinate systems that are used to describe these.

  2. We build an ontology with an inconsistent relationship to reality. So, we might be explicit about colour models, but arbitrarily bless 3 dimensional space, using cartesian co-ordinates.

The compromise here is very straight-forward. The first solution retains its consistency to reality, the second is consistent with usability and usage; for biomedicine, a 3D cartesian co-ordinate system plus time is likely to be enough for the foreseeable future and makes life easier in the meantime.

The Newtonian view of the world is the best model in this case: it is good enough. When building an ontology for biomedicine, it makes most sense to use this view as it will produce the results required. If, in the future, biomedicine advances so that relativistic or quantuum representations are necessary, then current ontologies will need refactoring; even then, this future cost is likely to be offset by gains in the present.

Related examples

In the choice of units for measurement for scientific purposes, SI units are to be preferred. It should be noted, here, that there is a domain dependency; for an engineering ontology, the use of American imperial units would be inevitable.

For most of biology it is unnecessary to distinguish between the length of the calendar year and the astronomical year—the latter changing with respect to variability in the motion of the earth. There are occasions when this distinction may be important for data integration in bioinformatics as leap years and leap seconds show.

For an ecologist counting the number of trees in a sampling square 100m by 100m, they will take the area as 10,000m2; The surface is, however, neither smooth nor a Euclidean plane, so this area is wrong in reality. For much of ecology, this distinction will not matter. Again, there is a domain dependency here; whale or bird biologists interested in migration patterns may well care about the curvature of the earth.

Discussion

Realism has been held up as a methodology for “good” ontological modelling, and the production of more tightly defined and consistent ontologies. In this paper, we have discussed five different cases, with biological examples, that we might wish to model ontologically; for each, we have presented different models, describing the same underlying science. In each case, a realist solution is possible, but places either limitations or awkwardness on the models produced.

Building an ontology with a consistent relationship to reality may help to enable interoperability [7] under some circumstances. If, however, it disallows modifications for computability (see “sec:work-around-comp”), or requires arbitrary blessing for one form of specification over another (see “sec:colo-colo-models”) it may have the opposite effect.

Nor are the issues discussed in this paper free from consequences. In “sec:go-where-science”, we discussed interoperability with existing scientific models. Mathematics and physics have produced complex, refined and expressive notation systems, representing a deep understanding of how numbers and the physical world work. These are, however, not being used in current ontologies and this results in a lack of precision, errors and omissions:

Lack of Precision:

The PATO term speed (PATO:8) which is defined as:

“A physical quality inhering in a bearer by virtue of the bearer’s rate of change of position”

with a synonym of velocity; from this definition, we cannot distinguish the vector and scalar quantities of velocity and speed; indeed, it is not clear which of these two speed (PATO:8) is. Meanwhile acceleration (PATO:1028) is defined as:

“… the rate of change of the bearer’s velocity in either speed or direction”

which is implicitly a vector quantity, and contradicts the statement that speed and velocity are synonyms. The mathematical definitions (velocity as \(dr/dt\), speed \(\left|{dr/dt}\right|\), acceleration \(d^2r/dt^2\)) are precise, concise and accurate.

Errors:

Similarly, length (PATO:122) is defined as a quality; qualities have to inhere in Independent Continuants; as a Spatial Region is a child of Continuant this means that Spatial Regions cannot bear lengths. In short, in current versions of BFO, there is no intuitive way of modelling the length of a region in space.

Omissions:

BFO is mass-centric; it is currently unclear where many physical entities exist, examples including energy, waves (through a medium) or EM radiation. Likewise, it lacks a natural position for numbers (that have no particulars), patterns and distributions. Yet, these entities are key to a physical description of the world.

To our mind, these are indicative of some of the most serious flaws of realism-based ontology building. It makes little sense to replicate the models of physics using English instead of a more precise mathematical notation. If BFO had been built using direct links to a grounded physical model of the world, it seems likely that these problems would not have arisen.

We have discussed a number of concrete examples where building an ontology by considering realist concerns has detrimental consequences for the model. We believe that the real world entities and the relationships between them is only one consideration among many: simplicity, usability, fitness for purpose are equally important.

Taken to its most extreme form realism, it seems to these authors, would produce models unsuitable for use within science. There is a choice between a correct account of reality that does not allow the data of science to be adequately described and a description of reality that takes in to account how science is performed. Fortunately, most “realist” ontologies are not really so: PATOs representation of HSV for modelling colour is not a bad decision; it represents a straight-forward, pragmatic approach to ontology building, where the representation has been chosen on the basis of a use case, not the entities as they exist in reality. Similarly BFO uses a 3D plus time model of reality; it suggests that length are properties of the entity alone, without reference to the observer. This is not a true reflection of reality, but one which is a good enough approximation for use within the biomedical sciences; in short, usability and simplicity have been considered to be more important in the modelling process than the relationship of the model to reality. In accepting these compromises, BFO has placed itself squarely as a computational rather than philosophical ontology.

Despite these concerns, realism has made a contribution to the field of biomedical ontology engineering. By emphasising the importance of real-world entities and by encouraging a more specific interpretation than the generalisation of a “conceptualisation”, realism helps to avoid the introduction of unnecessary layers of abstraction. A consideration of the entities in reality may be a part of an ontology engineering process; ontology builders should have careful and considered reasons for diverting from modelling in this way and that ontologies should explicitly describe through annotations the terms that do or may divert from this view. Ontology builders should, however, be free to make this decision; the acceptance of compromise with respect to reality will result in simpler and more effective knowledge artefacts.

Johansson [10] when discussing realism asks the rhetorical question: “would you like to be treated for a physiological illness by a (non-realist) physician who is not sure that there are human bodies?” – (our emphasis). As scientists, our reply would be if their survival and success statistics were the best, we would not care whether they were a realist, a non-realist or a robot which admitted of no philosophical position at all; also, using a doctor who was strictly realist and thus cut off from much of the practise of science (such as determining heart rate) would disturb many patients. As bioinformaticians, we build ontologies to provide a descriptive and predictive model of the wealth of experimental data that is now available. In biology, the job of an ontologist is to describe data such that it can be analysed. Naturally this entails a description of entities in reality; it also, however, entails a description of science, and it entails compromise; we overlook this to our peril. The last 200 years of science shows the success and strength of this position; it is on this groundwork that we should build for the future.

Bibliography

[1]

Ashburner M, Ball C, Blake J, Botstein D, Butler H, et al. (2000) Gene Ontology: a tool for the unification of biology. The Gene Ontology Consortium. Nat Genet 25: 25–9.

[2]

Stevens R, Lord P (2008) Application of ontologies in bioinformatics. In: Staab S, Studer R, editors, Handbook on Ontologies in Information Systems, Springer. Second edition. URL http://www.cs.man.ac.uk/~stevensr/papers/handbook2.pdf.

[3]

Zeeberg B, Feng W, Wang G, Wang M, Fojo A, et al. (2003) GoMiner: a resource for biological interpretation of genomic and proteomic data. Genome Biol 4: R28.

[4]

Wolstencroft K, Lord P, Tabernero L, Brass A, Stevens R (2006) Protein classification using ontology classification. Bioinformatics 22: e530-538.

[5]

Lord PW, Stevens RD, Brass A, Goble CA (2003) Investigating semantic similarity measures across the gene ontology: the relationship between sequence and annotation. Bioinformatics 19: 1275–1283.

[6]

Whetzel PL, Parkinson H, Causton HC, Fan L, Fostel J, et al. (2006) The MGED Ontology: a resource for semantics-based description of microarray experiments. Bioinformatics 22: 866–873.

[7]

Smith B, Ashburner M, Rosse C, Bard J, Bug W, et al. (2007) The OBO Foundry: coordinated evolution of ontologies to support biomedical data integration. Nat Biotechnol 25: 1251–1255.

[8]

OBO Foundry Consortium (2006). OBO Foundry Principles. http://obofoundry.org/wiki/index.php/OBO_Foundry_Principles.

[9]

OBO Foundry Consortium (2008). OBO Foundry Principles. http://obofoundry.org/wiki/index.php/OBO_Foundry_Principles.

[10]

Johansson I (2006) Bioinformatics and biological reality. J Biomed Inform 39: 274–287.

[11]

Grenon P, Smith B, Goldberg L (2004) Biodynamic ontology: applying BFO in the biomedical domain. Stud Health Technol Inform 102: 20–38.

[12]

Smith B (2004) Beyond concepts: ontology as reality representation. In: Formal ontology in information systems: proceedings of the third conference (FOIS-2004). Ios Pr Inc, p. 73.

[13]

Lord P (2009) An Evolutionary Approach to Function. In: Bio-Ontologies 2009: Knowledge in Biology. URL http://hdl.handle.net/10101/npre.2009.3228.1.

[14]

Smith B, Ceusters W, Klagges B, Köhler J, Kumar A, et al. (2005) Relations in biomedical ontologies. Genome Biol 6: R46.

[15]

Russell B (1946) A History of Western Philosophy. Routledge.

[16]

Merrill G (2010) Ontological realism: methodology or misdirection. Applied Ontology 5: 79-108.

[17]

Dumontier M, Hoehndorf R (2010) Realism for scientific ontologies. In: 6th International Conference on Formal Ontology in Information Systems.

[18]

Gruber T (1992). What is an ontology? URL http://www-ksl.stanford.edu/kst/what-is-an-ontology.html.

[19]

Ceusters W, Smith B (2006) A realism-based approach to the evolution of biomedical ontologies. AMIA Annu Symp Proc : 121–125.

[20]

Shrager J (2003) The fiction of function. Bioinformatics 19: 1934-1936.

[21]

Seyed AP (2009) BFO/DOLCE Primitive Relation Comparison. In: BioOntologies 2009: Knowledge in Biology.

[22]

Rector A (2005). Representing specified values in owl: “value partitions” and “value sets”. W3C Working Group Note. URL http://www.w3.org/TR/swbp-specified-values/.

[23]

Egana M, Rector A, Stevens R, Antezana E (2008) Applying Ontology Design Patterns in Bio-ontologies, Springer Berlin/Heidelberg. pp. 7-16.

[24]

Schulz S, Stenzhorn H, Boeker M (2008) The ontology of biological taxa. Bioinformatics 24: i313–i321.


Introduction

A few weeks ago I unsubscribed from the BFO discuss mailing list. I’ve been reading and posting there since March 2007; in that time I’ve managed to send 492 mail messages which surprises even me. As a mailing list, BFO discuss is a slightly bruising experience: it’s a bit like a bar fight; one person swings a punch and everyone just piles in. I joined the mailing list because BFO has become somewhat of a force within the bio-ontology community and I wanted to help make sure it was fit for purpose; however, I have to admit that I have been as guilty of reaching for nearest available pool cue as the next ontologist. Not the best side of me, but there you have it.

During my time on the mailing list, I have learnt a lot about BFO and the realist philosophy that, in theory, underpins it. Actually, BFO is not at all bad; for me, though, realism is largely without merit. One of the main difficulties with realism is that is carries with it the idea that, by thinking very hard, you can come up with a “representation of reality”. I think that this is mistaken. As scientists, we should be wary of thinking too much; our role, whenever possible, is to think just enough to get us to the start of the next experiment. This doesn’t seem to happen with BFO; in the time that I have been on the mailing list, BFO itself has changed very little; the constant feedback and iteration to accommodate new knowledge and experience is largely not happening. I have qualms with many parts of BFO (for example, I have discussed the issues with the Realizable Entity hierarchy). However, for me, the worse outcome of the philosophical approach have happened as a result of not considering the advanced models that physics has produced to explain the experimental data that we see. I give four examples.


Length in Space

BFO makes a very high-level split between Independent and Dependent Continuants. A continuant is something that persists over time, but which exists in full for this entire time: my computer or me, for instance, as opposed to a process, not all of which exists at any point in time. The distinction between an independent and dependent continuant depends on whether this entity exists on its own; for my height, a dependent continuant, to exist, I also have to exist. Once I cease to exist, so does my height. This seems okay, but in tying physical dimensions to an independent continuant, BFO has made a fundamental error: how do we express the length of a Spatial Region? Length is a dependent continuant and, so, there must be independent continuant in which is inheres. Unfortunately, Spatial Region is not an independent continuant itself.

There are solutions, of course; we can think of another relation, other than inheres to link Spatial Region and Length. But, we still need a Independent Continuant to exist that this length inheres in. Another possibility is to describe the length of a spatial region as the length of a Independent Continuant that could exists in it. But, it is easy to think of Spatial Regions in which no Independent Continuant can exist (for example, the Spatial Region 1m longer than the longest object in the universe). BFO would be modelling the world backward; physics uses a coordinate system and places objects within that; this approach would use objects to define the coordinate system.

Currently, this problem seems to have been accepted by some of the authors of BFO; however, there is no solution. If BFO had started from the mathematical models of physics, to me it seems likely that we would not be in this position.


Change in Process

BFO suggests that Occurrents (such as a process) can have properties in a similar way that independent continuants can have qualities. I have a length, a process may have a duration. However, BFO suggests that the properties of a an Occurrent cannot change; rather, there must be a new Occurrent.

Again, this makes little sense, and ignores very simple physical examples. Consider, for example, a car first travelling at 10ms-1, then 20ms-1. Consider the process of motion. BFO would have us model this as 3 processes; car moving at 10ms-1, car moving at 20ms-1 and a single motion process of which the other two are part.

For a simple example, this style of modelling may work. However, consider the earth travelling around the sun. The problem is that the motion is continually changing; the earth’s velocity changes infinitesimally toward the sun, so it’s always accelerating. Worse, the acceleration also changes infinitesimally, as the earth’s relative location to sun changes. So, to model this in BFO, we need an infinite number of processes (for both the motion and acceleration). We could argue that while the velocity and acceleration change constantly, the angular velocity and speed of the earth is constant, so why not model the process in these terms? Unfortunately, even this is not true; the earth moves in an ellipse, not a circle, even if its very close to a circle. So, the angular velocity and speed change continually also.

The physics of this is, as I have said, straightforward. The earth’s motion has a velocity and acceleration expressed as (nearly) two sine waves along the two axes.


Rate of Change

In order to get to the subtleties in a clearer fashion, we remind you of a joke which you surely must have heard. At the point where a lady in a car is caught by a cop, the cop comes up to her and says, “Lady, you were going 60 miles an hour!” She says, “That’s impossible, sir, I was travelling only seven minutes. It is ridiculous – how can I go 60 miles an hour when I wasn’t going an hour?”

— Richard Feynman

In a short, recent thread, it appears that there has been discussion on those qualities that need a period of time to have meaning. The examples given include velocity and acceleration. But does this make any sense? It is certainly the case, as the Feynman quote shows, that the definition of velocity is not obvious. But it’s also a known issue. Feynman’s story shows that it can be very hard to describe exactly what you mean when talking about velocity; it’s for this reason that physics uses mathematical notation, where we can be precise. Velocity is \(dr/dt\), acceleration is \(d^{2}r/dt^{2}\). As I have said, these examples do not stand alone — the same applies to many other qualities, including those where change is not over time.

In short, it makes little sense to create distinctions in our physical model of the world that physics does not make. We are creating work for ourselves and confusion for everyone else.


Absolute Space

BFO distinguishes between Sites and SpatialRegions; the idea is to distinguish between bits of space in general, and holes — the lumen of the gut, for instance. This seems reasonable at first sight. However, this is being done by suggesting that a Site is relative to an IndependentContinuant while SpatialRegions are absolute.

In short, over 100 years after Michelson-Morley, BFO has reinvented absolute space. The justification for this is that, according to one of the authors, without absolute space, problems arise. The problems haven’t been described in detail, but apparently, involve things moving through space or changing shape.

BFO is put forward as a “realist” ontology — that is it models the key entities as they exist in reality. And, the reality is this; there is no evidence that absolute space exists and, indeed, very strong evidence that it does not. It is also hard to see how this could cause problems; Einstein removed absolute space from the model that physics uses a century ago. Now, admittedly, this produces some really weird and counter-intuitive results, but only when two objects are moving rapidly with respect to each other. Relativity does not cause any problems that are not necessary to describe the world. In practice for “everyday” physics, the upshot is that you just define (or assume) a frame of reference; there is normally an obvious one, but any frame will do, and the results will come out the same.

My post on this produced some interesting replies. Bjoern Peters straightforwardly agreed. Alan Ruttenberg suggested that I was arguing space doesn’t exist; while Barry Smith argued that having this (false!) distinction in BFO is necessary for practical reasons.

At which point, I unsubscribed.


Conclusions

I am not arguing here that BFO is totally broken or has no purpose. To some extent, I am yet to be convinced that having any upper ontology helps with ontology building: arguing against, they are hard to understand and often result in a top-down design which ends in philosophical arguments and analysis paralysis; arguing for, they provide some basic structure or a design pattern, which can ease the task of starting to build an ontology, or to understand someone else’s. I am unsure yet whether they help with (computational) interoperability; by analogy to software, design patterns are good for the developer but do not provide any more guarantees. In general, though, I work on the basis that the use of a common framework seems a sensible idea; it is something we should try until we have enough data to make a more coherent decision. BFO provides one such basic framework; and, in general, it’s okay so long as we do not take it too seriously. We should be willing to ignore it when it fails.

However, realism has much less going for it. It is based on the conceit that we should look at reality; now, within a scientific context, this means experimental data. The statement that science should use experimental data, though, is obvious and is a truism; it cannot, therefore, itself define a methodology.

In practice, however, BFO has been built leaning on 2000 years of philosophy; and here lies the mistake. We should acknowledge our limitations as ontologists; we have nothing at all to add to a physical model of the universe as the physicists have already done it. All we need is to represent their model; we should not be looking at experimental data, because someone else has already done it for us. The problems described here are all avoided by the simple mathematical model that physics uses — 4 dimensions, or real number lines, at 90 degrees to each other, and by the use of calculus to describe change.

In BFO, we see an attempt to consider the key entities as they exist in reality; and, the bottom line here, is that at least for these few classes, BFO has done a bad job of it. It has misunderstood lengths and space, developed a process model that is unmanageable and made distinctions that are known to be wrong. Biology is built on top of the other sciences, and it will not benefit the cause of bio-ontologies if we ignore them. Worse biologists attempting to use BFO will find it hard to apply models which are demonstrably wrong; what criteria can we apply to distinguish SpatialRegions and Sites, when physics tells us that these criteria do not and cannot exist? Finally, as ontologists, we should accept our limitations and the limitations of the technology; we should not attempt to re-represent knowledge which has already been modelled in more appropriate ways.

We should be experimenting and testing more than we are thinking; we should be embracing change when we are wrong. We should be leaning on 200 years of physics and biology, not 2000 years of philosophy.

So, this year of Bio-Ontologies is upon me; I’m sitting in the airport waiting to fly in the wrong direction; although I’ve noticed that the airport signs no longer call this “waiting time” but “shopping time”.

It’s 12 years on now; I can’t remember whether this makes it the oldest SIG at ISMB, but it must be close. Perhaps it is surprising that a small meeting like this has lasted so long, but during it’s time the use of ontologies within biology has blossomed; to some extent, this is true of the outside world also. This year has carried on with the trend. Gone are the days that we used to get enough papers to fill the day, but no more; we’ve stretched the day out, we’ve added a poster session but still we get more. The number of attendees has gone up somewhat also. It’s good to see.

For me, bio-ontologies has also been the centre of my entry into the field; Edmonton was the first ontology paper that I ever presented — perhaps depressingly, still some of my best work. This year has special significance for me. I’m giving a paper myself for the first time since Edmonton; perhaps fitting to end off as I began, because this will also be my last year as conference chair. I’ve been involved now for 6 of the 12 years; while, I’ve enjoyed it and felt privileged to do the work, it’s enough. Organising is hard work, even now when I understand the process well. In the last few years, I’ve tried to push the workshop to be a bit broader than just ontologies, to take in all new forms and technologies for representing and distributing knowledge; I’ve met with some, but limited success. A workshop with a 12 year pedigree takes some time to move. I was heartened to see that it was the first SIG to get a subject on the official conference friendfeed. Web 2.0 is upon us. With luck, this will become a bigger part of the meeting. If so, this will be other peoples achievement, not mine. Did I mention that this is my last year?

I’m looking forward to giving my paper on functions and roles in ontologies. One of the more minor reasons for retiring, is that it’s easier to publish in a workshop which you are not organising. I’m surprisingly nervous about the talk; probably as much so as in Edmonton. I’ve been practicing the talk incessantly, to the point that my back is complaining from too much sitting. It’s my first ever single author paper. I’m hoping that people will like the paper; it’s message is simple and straight-forward. Of course, this doesn’t mean that it’s correct. Last years paper on a similar topic caused quite a fuss (which, let’s be honest, was partly my fault) and I know that some in the audience will be quite vehement in their opposition to mine. Even though I’ve been over it so many times, I have the back-of-my-mind fear that there is a big hole that I’ve missed.

I guess this is good; it means that I’m excited about my own paper in a way that I haven’t been for years. A bit of fuss will mean that other people are too, for good or for ill. In the end, I’ll probably be most disappointed if the paper goes with a whimper not a bang.

Ah, it does on and on. After my last attempt at literate OWL programming, called omnsplit, I decided that there was a problem; this version splits the OWL file into individual statements, and puts them into files with the same name as the OWL class (property, or whatever).

The problem is that, for an ontology like OBI, you get 1400 individual files; this is just inconvienient as many applications don’t like this many files in a directory. Also, there is a naming constraint; you can only use characters legal in the file system; this doesn’t include “:” if you want to be Windows (NTFS) compliant.

So, for my new system, I decided to generate an index file, which just points at locations in the ontology file. Initially, I was just going to index the main ontology file; in the end, I decided a partial copy was the way forward; generating both the index and indexed file ensure that they will stay in-sync.

It required a bit of nasty latex hacking; the basic problem was avoiding the limitation of being only able to use legal LaTeX macro characters (that is letters). The system now works like this:



%% This is generated by python which also generates the
%% function_ont.spt file which is a copy of the ontology (with a
%% few new lines gone.

%% This just defines a new macro in what appears to be an
%% unnecessarily complex way.
\expandafter\def\csname OmnEntityHeaderheader\endcsname%
{\lstinputlisting[language=omn,firstline=1,lastline=8]{function_ont.spt}}

%% But the use of \expandafter and \csname means that you can
%% use any character you like, including underscores and numbers
%% in the macro name.
\expandafter\def\csname OmnEntityObjectPropertyhas_role\endcsname%
{\lstinputlisting[language=omn,firstline=206,lastline=219]{function_ont.spt}}

%% We can now define two commands in the style file. Again
%% we use \csname so that we are not bound to characters legal
%% in latex macros.
\newcommand{\omnclass}[2]{\csname OmnEntityClass#1#2\endcsname}
\newcommand{\omnobjprop}[2]{\csname OmnEntityObjectProperty#1#2\endcsname}

%% now in our source, we can do things like this.
\omnobjprop{}{has_role}

Using an index in this way also has another advantage. I’ve had to make a decision whether to go with rdfs:label or the entity name. I can now back out of this; I can just use both in the index file, without too much extra space, so that either would be referencable within the latex.

To me, this feels like the right solution. It’s relatively simple (with a bit of nasty latex, which is nicely hidden), it doesn’t depend on the file system. It needs a bit more work to bring it to completion, but not that much.

Sadly bio-ontologies looms, so next week will be getting ready for that; perhaps I can finish this off on the way back. “Sadly” is perhaps a poor choice of words; I’m greatly looking forward to it, but I’ve kind of had the bit between my teeth with python and latex hacking for the last few weeks.

After a bit of struggle, I now have another literate OWL tool working, along the lines discussed in a previous blog post. Rather than generating the OWL documentation, I now split a Manchester syntax file up, so that I can refer to bits of it. I have this working with OBI, using Protege to produce a single merged ontology file, in Manchester syntax.

The current implementation is rather simple; it produces one file-per-entity in the OWL file which I don’t think is entirely good. When run on OBI, it creates over 1400 files which is a lot. The other problem is that I’ve had to do some dubious hacking to get the file names work out. Firstly, I have to remove spaces and “\”‘s, as wel as “:” which is illegal on NTFS.

There’s also a problem with some of the OWL. Unfortunately, the OBI to OWL conversion process has a reification step which I don’t quite understand the purpose of. This comes out as this sort of anonymous individual. I’m not sure at all how the definition has come out as the rdfs:label, but, for sure, you can’t use this as a filename!


Individual: relationship:genid7

    Annotations:
        rdfs:label "C located_in C' if and only if: given any c that
instantiates C at a time t, there is some c' such that: c' instantiates
C' at time t and c *located_in* c'. (Here *located_in* is the
instance-level location relation.)"@en,
        oboInOwl:hasDbXref relationship:genid8

    Types:
        oboInOwl:Definition

I think I might change the implementation a bit, though. Having 1400 files in one directory is not good. My idea is to serialize the entire file out as latex, with lots of macros, autogenerated.


%% this would appear in the generated file
\newcommand{\OwlClassowlthing}{
  \begin{omn}
Class: owl:Thing
  \end{omn}
}

%% then in your latex file you would do
\owlclass{owl}{Thing}

%% which would just resolve to the class above

The only worry with this is that latex would then have to read a large file into latex, even if most of the macros are not used. This might be really, really slow. Well, we can but try.

As before, the current version is available at git://github.com/phillord/literate_omn.git.

Well, after a reasonable degree of struggle, I managed to get the first version of my literate OWL system working. As well as learning python, I’ve had a go with git; my repo is hosted on github at git://github.com/phillord/literate_omn.git. There are three components.

omnextract.py this pulls out all the referenced omn files from the TeX document and produces the complete omn file.
omn.sty this is a driver for the listings package which does syntax highlighting in TeX.
omndoc.sty this provides commands for including files into the TeX. It’s a thin wrapper around the listings package.

I decided to make omn.sty seperate from omndoc.sty as it works standalone, if you just want to use the listings package on its own. At the moment, you can only include files; environments don’t work. You can see the the pdf it creates from this TeX


\documentclass{article}

\usepackage[pdftex]{color}
\usepackage{omndoc}

\title{A Test Document for OMNDoc}
\author{Phillip Lord}
%% should be ignored by latex, put read by python

\omndoc{all_test.omn}

\begin{document}
\maketitle

Here is a piece of OWL that should be readable in the documentation and in the
OMN output.

\begin{omn}
Class: FirstClass
\end{omn}

\omn{first.pomn}

Here is a piece of OWL that should be readable in the OMN output but is to
boring to be worth of consideration for the documentation.

% \ignore{
%   \begin{omn}
%     Class: BoringOWL
%   \end{omn}
% }

\ignore{\omn{second.pomn}}

Here is a piece of broken OWL that should be rendered in the documentation (as
broken!) but should be ignored in the OMN.

% \begin{notomn}
% Clazz: BrokenOmn
% \end{notomn}

\notomn{third.pomn}

\end{document}

I’m starting to debate with myself, though, whether I have gone the right route here. The problem is that splitting the omn file up into bits is a pain. It only supports one way of working; if you want to use Protege, for example, to edit the file, you can’t; you can only view. We even miss the big advantage of literate programming; one source for both document and computation. But, then, you are stuck with a poor editing environment for either the documentation or computational representation.

I’ve been thinking instead of a system which would like this:


\omndoc{function.omn}

\omnClass{Function}

\omnProperty{has_role}

\omnSummary{}
\omnMissing{}

Now, the python component would split the function.omn file instead of combining it. Each class, individual or property would be but into it’s own file. The \omnClass macro would then just be a simple include (again using the listings package; it would show the class inline. \omnSummary would include some TeX (generated from python) saying how many classes and so forth were in the omn file; \omnMissing would produce a list of Classes that are not explicitly included. Given a big monitor, you could work on the two sources (documentation and ontology) side-by-side, with only a little bit of editing to support jump-to or equivalent. Finally, it would be more syntax-independent. The TeX would not need to be changed to support, for example, the XML syntax. Just some python to split the XML document up into snippets.

I shall start coding this over the next couple of days. I think I already have most of the python that I need so, hopefully, it should not take too long.

My next blog post was going to be about function, as I have just had a paper about it accepted. But, I got slightly side-tracked along the way, thinking about Literate Programming as it applies to OWL. While an ontology is (or, to my mind, should be) a computational artifact, it’s a bit different from a program; the main thing is that it doesn’t run; it doesn’t have that functional test that a program does. This is not to say that an ontology is not an application-dependent entity. It can be, but even then it needs to have a program built on it.

One of the upshots of this is that a narrative justification for an Ontology is fairly important; currently, we spend far too long on mailing lists, arguing about ontology terms and, to my mind, not enough of this is reflected in the final outcome. If, on the other hand, we moved to a situation that adding a new concept was equivalent to writing a paper, we might have less of this. Discussion would be a bit more focussed; besides which, most scientists are experienced with writing and reviewing papers, so we’d just be better at it.

For this to happen productively, though, the paper has to become, itself, a computational artifact. It’s not good having documentation that has to be kept in-sync with the ontology; we will just end up with multiple versions, and will never quite know what we are talking about; my discussions about BFO have shown me this; do we mean the OWL, the definitions in the OWL, the papers or what? We should be able to generate both readable documentation and computational OWL at the same time. In short, literate programming.

Now, I know that Bijan Parsia has been investigating this also, but I wanted to think a little bit about how it would fit into my environment.

One thought was to get the system working within asciidoc which I am using to generate these pages. This turned out to be simple enough; take, for instance, this definition for BiologicalFunction.


Class: BiologicalFunction
    Annotations:
    rdfs:comment
"Definition: A biological function is a realizable entity that inheres in continuant
which is realized in an activity, and where the homologous structure(s) of
individuals of closely related species (or identical species) fulfil this
same biological function.",

    SubClassOf:
        Function

Asciidoc uses source-highlight for it’s syntax highlighting. I had to add a bit of config (which, annoyingly, needs to be placed into main install directory for source-highlight, rather than in a user space dot-directory.

Unfortunately, this is not going to be as good as you might hope for printed documentation. The obvious solution here is to aim at LaTeX. I think that I am going to have a quick go at producing something like this, inspired by Literate Haskell. Basically, I need three tags which look like this:



\begin{owl}
Class: Thing
\end{owl}

\ignore{
\begin{owl}
Class: BoringOWL
\end{owl}
}

\begin{notowl}
Clazz: BrokenOwl
\end{notowl}

The first copes with OWL that should appear both in the documentation and code (that is most of it). The second covers OWL that should appear just in the code; the haskell example is for a “help” function; I suspect that this is rarely needed for OWL. The final example appears just in documentation; it would be useful for anti-examples (“Don’t do this!!!”). My plan would be to pre-process the latex just using regexps, nothing complex, to dump the OWL to a file, mostly because I don’t know how to get latex to do it. Meanwhile, these two macros would be just be defined in terms of the Listings package (which means writing yet another syntax highlighting set of regexps, oh dear).

Well, this is okay, but has two problems: first, it means writing OWL inside latex which means that editor support is going to be rubbish; second, what if I want to blog AND print a document. My solution to this is to move my ontologies to being multi-file based. As far as I can tell, Manchester OWL is order independent (except for the header). So the plan would be to write multiple files, each with a few Concepts in:

 function/header.omn
 function/function.omn
 function/biological_function.omn
 function/artifactual_function.omn

Generating a complete Manchester syntax file from this would be easy (more or less, just run cat). This could be supported within latex by adding some include macros. Again, this is trivial to do with listings package.


\owl{function.omn}
\ignore{\owl{help.omn}}
\noowl{broken.omn}

Likewise, asciidoc supports it using include macros. I shall give this a go next week. I shall produce a document describing the axiomatisation for function in OWL that started all of this off.

PS Just finished this, and found out that blogpost stripped off all my nice syntax highlighting. Took a bit of effort but (hopefully) it should all be back in again now.