The TDDonto tool to try out TDD for ontology authoring

Last month I wrote about Test-Driven Development for ontologies, which is described in more detail in the ESWC’16 paper I co-authored with Agnieszka Lawrynowicz [1]. That paper does not describe much about the actual tool implementing the tests, TDDonto, although we have it and used it for the performance evaluation. Some more detail on its design and more experimental results are described in the paper “The TDDonto Tool for Test-Driven Development of DL Knowledge Bases” [2] that has just been published in the proceedings of the 29th International Workshop on Description Logics, which will take place next weekend in Cape Town (22-25 April 2016).

What we couldn’t include there in [2] is multiple screenshots to show how it works, but a blog is a fine medium for that, so I’ll illustrate the tool with some examples in the remainder of the post. It’s an alpha version that works. No usability and HCI evaluations have been done, but at least it’s a Protégé plugin rather than command line :).

First, you need to download the plugin from Agnieszka’s ARISTOTELES project page and place the jar file in the plugins folder of Protégé 5.0. You can then go to the Protégé menu bar, select Windows – Views – Evaluation views – TDDOnto, and place it somewhere on the screen and start using it. For the examples here, I used the African Wildlife Ontology tutorial ontology (AWO v1) from my ontology engineering course.

Make sure to have selected an automated reasoner, and classify your ontology. Now, type a new test in the “New test” field at the top, e.g. carnivore DisjointWith: herbivore, click “Add test”, select the checkbox of the test to execute, and click the “Execute test”: the status will be returned, as shown in the screenshot below. In this case, the “OK” says that the disjointness is already asserted or entailed in the ontology.

cdisjh

Now let’s do a TDD test that is going to fail (you won’t know upfront, of course); e.g., testing whether impalas are herbivores:

impalaFail

The TDD test failed because the subsumption is neither asserted nor entailed in the ontology. One can then click “add to ontology”, which updates the ontology:

impalaAdd

Note that the reasoner has to be run again after a change in the ontology.

Lets do two more: testing whether lion is a carnivore and that flower is a plan part. The output of the tests is as follows:

lionflower

It returns “OK” for the lion, because it is entailed in the ontology: a carnivore is an entity that eats only animals or parts thereof, and lions eat only herbivore and eats some impala (which are animals). The other one, Flower SubClassOf: PlantParts fails as “undefined”, because Flower is not in the ontology.

Ontologies do not have only subsumption and disjointness axioms, so let’s assume that impalas eat leaves and we want check whether that is in the ontology, as well as whether lions eat animals:

lionImpalaEats

The former failed because there are no properties for the impala in the AWO v1, the latter passed, because a lion eats impala, and impala is an animal. Or: the TDDOnto tool indeed behaves as expected.

Currently, only a subset of all the specified tests have been implemented, due to some limitations of existing tools, but we’re working on implementing those as well.

If you have any feedback on TDDOnto, please don’t hesitate to tell us. I hope to be seeing you later in the week at DL’16, where I’ll be presenting the paper on Sunday afternoon (24th) and I also can give a live demo any time during the workshop (or afterwards, if you stay for KR’16).

 

References

[1] Keet, C.M., Lawrynowicz, A. Test-Driven Development of Ontologies. 13th Extended Semantic Web Conference (ESWC’16). Springer LNCS. 29 May – 2 June, 2016, Crete, Greece. (in print)

[2] Lawrynowicz, A., Keet, C.M. The TDDonto Tool for Test-Driven Development of DL Knowledge bases. 29th International Workshop on Description Logics (DL’16). April 22-25, Cape Town, South Africa. CEUR WS vol. 1577.

Advertisements

Nontransitive vs. intransitive direct part-whole relations in OWL

Confusing is-a with part-of is known to be a common mistake by novice ontology developers. Each time I taught the ontology engineering course, I had included a session of 1-2 hours to explain some basic aspects of part-whole relations and, lo and behold, none of the participants made that mistake in the labs or mini-projects! One awkward thing did pop-up there and at other occasions, though, which had to do with modelling direct parthood that does not go well at the moment, to say the least, for a plethora of reasons. Inclusion of direct parthood is not without philosophical quarrels, and the more I think of it, the more I dislike the relation, but somehow the issue appears often in the context of part-whole relations in ontologies. The observed underlying modelling issue—representing intransitivity versus nontransitivity—holds for any OWL object property anyway, so I will proceed with the general case with an example about giraffes.

Preliminaries

First of all, to clarify terms in the post’s title: INtransitive means that for all x, y, z, if Rxy and Ryz then Rxz does not hold; formally \forall x, y, z (R(x,y) \land R(y,z) \rightarrow \neg R(x,z) and an option to state this in a Description Logic is to use role chaining: R \circ R \sqsubseteq \neg R NONtransitive means that we cannot say either way if the property is transitive or intransitive, i.e., in some cases is may be transitive but not in other occasions. Direct parthood is to be understood as follows: if some part x is a direct part of a y, then there is no other object z such that x is a part of z and z is a part of y; formally, \forall x,y (dpo(x, y) \equiv \neg \exists z (partof(x,z) \land partof(z,y))) . If direct parthood is in- or non-transitive is beside the point at this stage, so let us look now at what happens with it in an OWL ontology when one tries to model it one way or another.

The OWL ontology and the reasoner

Given that I used the African Wildlife Ontology as a tutorial ontology earlier and the theme appeals to people, I will use it again here. Depending on what we do with the direct parthood relation in the ontology, Giraffe is, or is not, classified automatically as a subclass of Herbivore. Herbivore is a defined class, equivalent to, in Protégé 4.1 notation, (eats only plant) or (eats only (is-part-of some plant)), and Giraffe is a subclass of both Animal and eats only (leaf or Twig). Leaves are part of a twig, twigs of a branch, and branches of a tree that in turn is a subclass of plant. The is-part-of is, correctly according to mereology, included in the ontology as being transitive. Instead of all the is-part-of and is-proper-part-of between plant parts and plants in the AfricanWildlifeOntology1.owl, we model them using direct-part. AfricanWildlifeOntology4a.owl has direct-part as sister object property to is-part-of, AfricanWildlifeOntology4b.owl has it as sub-object property of is-part-of, and neither ontology has any “characteristics” (relational properties) checked for direct-part. Before running the reasoner to classify the taxonomy, what do you think will happen with our Giraffe in both cases?

In AfricanWildlifeOntology4a.owl, Giraffe is still a mere direct subclass of Animal, whereas with AfricanWildlifeOntology4b.owl, we do obtain the (desired) deduction that Giraffe is a Herbivore. That is, we obtain different results depending on where we put the uncharacterized direct-part object property in the RBox. Why is this so?

By not clicking the checkbox “transitive”, an object property is non­-transitive, but not in-transitive. In fact, we cannot represent explicitly that an object property is intransitive in OWL (see OWL guide and related documents). If we put the object property at the top level (or, as in Protégé 4.1, as immediate subproperty of topObjectProperty), then we obtain the behaviour as if the property were intransitive (and therefore Giraffe is not classified as a subclass of Herbivore). However, the direct-part property is really nontransitive in the ontology. When direct-part is put as subproperty of is-part-of, then it inherits the transitivity characteristic from is-part-of and therefore Giraffe is classified as a Herbivore (because now leaf and Twig are part of plant thanks to the transitivity).

Obviously, it holds for any OWL/OWL2 object property that one cannot assert intransitivity explicitly, that an object property’s characteristics are inherited to its subproperties, and this kind of behaviour of nontransitive object properties depends on where you place it in the RBox—whether you like it or not.

How to go forward?

Direct parthood is called isComponentOf in the componency ontology design pattern and is a subproperty of isPartOf. Its inverse is called haspart_directly in the W3C best practices document on Simple Part-Whole relations [1], and is a subproperty of the transitive haspart. The componency.owl notes that isComponentOf is “hasPart relation without transitivity”, the ODP page’s “intent” of the pattern is that it is intended to “represent (non-transitively) that objects either are proper parts of other objects, or have proper parts”, and the W3C best Practices note that, unlike mereological parthood, it is “not transitive”. Hence, if you include either one in your OWL ontology, you will not obtain the intended behaviour. Therefore, I do not recommend using either suggestion.

Setting aside the W3C’s best practices motivation for inclusion of haspart_directly—easier querying for immediate parts, but for the ontology purist this ought not to be the motivation for its inclusion—it is worth digging a little deeper into the semantics of the direct parthood. Maybe a modeller actually wants to represent collections with their members, like each Fleet has as direct parts more than one Ship, or constitution of objects, like clay is directly part of some vase? In both cases, however, we deal with meronymic part-whole relations, not mereological ones (see [2] and references therein); hence, they should not be subsumed by the mereological part-of relation anyway. They can be modelled as sister properties of the part-of relation and have the intended nontransitive behaviour as in, e.g., the pwrelations.owl ontology with a taxonomy of part-whole relations (that can be imported into the wildlife ontology).

Alternatively, there is always the option to choose a sufficiently expressive non-OWL language to represent the direct parthood and the rest of the subject domain and use one of the many first/second order theorem provers.

References

[1] Alan Rector and Chris Welty. Simple Part-Whole relations in OWL ontologies. W3C Editor’s draft, 11 August 2005.

[2] C. Maria Keet and Alessandro Artale. Representing and Reasoning over a Taxonomy of Part-Whole Relations. Applied Ontology, 2008, 3(1-2): 91-110.

African Wildlife Ontology tutorial ontologies

Following the invitation by Deshen Moodley from the University of KwaZulu-Natal to give a guest lecture for his Ontology and Knowledge Based Systems fourth year (honours) course, I looked up the African Wildlife Ontology he intended to use and that was introduced in the A Semantic Web Primer book by Grigoris Antoniou and Frank van Harmelen [1]. Given the state of that tutorial ontology, I could not resist fiddling with it to make the tutorial ontology a little more comprehensive.

Googling for an existing version in OWL on the Web, I came across Guy Lapalme’s version that, however, gave me an error loading it in Protégé 4.1-beta due to the use of collection in the definition of Herbivore. Having removed that and renamed the .xml extension into .owl, this version is renamed AfricanWildlifeOntology0.owl. The ontology has 10 classes and 3 object properties concerning animals such as Lion, Giraffe, Plant, eats, and is-part-of. Note the annotations in the ontology that give an idea of what should be modelled (else: see 4.3.1 pages 119-133 in [1]). Upon running the reasoner, it will classify, among others, that Carnivore is a subclass of Animal.

All this is not really exciting though, and the tutorial ontology is not of a particularly good quality. First, I added knowledge: I played with proper parthood and added a few more plant parts and animals, such as Impala, Warthog, and RockDassie, and also refined knowledge such that giraffes eat not only leaves but also twigs and there are omnivores, too. This version of the African Wildlife Ontology is named AfricanWildlifeOntology1.owl. With this additional knowledge, warthogs are classified as omnivores, lions as carnivores, giraffes as herbivores, and so on. We still miss out on having impalas classified as herbivores; what can—or should—you add to the ontology to achieve that?

However, adding classes and object properties to an ontology does not necessarily make a better quality ontology. One aspect that does with respect to the subject domain, is to refine the represented knowledge so as to limit the possible models, such as giraffes eating both leaves and twigs and adding more characteristics to the object properties, like that the is-part-of is not only transitive, but also reflexive, and is-proper-part-of is transitive and irreflexive or asymmetric (the latter we can add thanks to the increased expressiveness of OWL 2 DL compared to OWL-DL). Another aspect is purely engineering: if you intend to put your ontology online, you should name the ontology (in Protégé select “refactor” and “change ontology URI”) so that its contents can be identified appropriately on the Semantic Web. Third, we can improve the ontology’s quality by using a foundational ontology.

Foundational ontologies provide principal categories of kinds of entities and relations to give a basic structure to a reference or domain ontology. With it, you can avoid reinventing the wheel during ontology development by availing of outcomes from research into the foundations of ontologies and it can guide you to make the modelling process easier to carry out successfully. In addition, it facilitates linking your ontology with other ontologies that also adhere to a foundational ontology. Foundational ontologies contain basic categories such as IndependentContinuant/Endurant (roughly: to represent objects) and Occurent/Perdurant (informally: processes), and Quality for representing attributes, and then their respective sub-categories, such as AmountOfMatter, Feature, PhysicalObject, Achievement, Function, and SpatialRegion; see, e.g., DOLCE, BFO, GFO, GUM, and SUMO.

For the sake of example, let us take DOLCE [2] to enrich the African Wildlife Ontology. To do this, we need to import into our wildlife ontology an OWLized version of DOLCE; in this case, we import DOLCE-lite.owl. Then, consider first the taxonomic component of DOLCE (see Wonderweb deliverable D18 Fig 2 p14 and Table 1 p15 or explore the imported ontology with its annotations). Where does Plant fit in in the DOLCE categorisation? Giraffes drink water: where should we put Water? Impalas run (fast); where should we put Running? Lions eat impalas, and in the process, the impalas die; where should we put Death? The answers can be found in AfricanWildlifeOntology2.owl. DOLCE is more than a taxonomy, and we can also inspect in more detail its object properties and reuse the already defined properties instead of re-inventing them. First, the African Wildlife Ontology’s is-part-of is the same as DOLCE’s part, and likewise for their respective inverses. Concerning the subject domain, here are a few modelling questions. The elephant’s Tusks (ivory) are made of Apatite (calcium phosphate, an amount of matter); which DOLCE relation can be reused? Giraffes eat leaves and twigs; how do Plant and Twig relate? How would you represent the Size (Height, Weight, etc.) of an average adult elephant; with DOLCE’s Quality or an OWL data property? Answers to the former two questions are included in AfricanWildlifeOntology2.owl.

How does it work out when we import BFO into AfricanWildlifeOntology1.owl? Aside from minor differences (e.g., Death is not a type of Achievement as in DOLCE, but a ProcessBoundary instead, and animals and plants are subtypes of Object), there is a major difference with respect to the object properties (BFO has none). A possible outcome of linking the wildlife ontology to BFO is included in AfricanWildlifeOntology3.owl. To do these last two exercises with DOLCE and BFO in a transparent and reusable way, however, we need a mapping between the two foundational ontologies. Even more so: if there was a proper mapping, only one of the two exercises would have sufficed and the software would have taken care of the mappings between the two. But, alas, such a mapping and implementation is yet to be done.

One could take the development a step further by adding types of part-whole relations [3] so as to be more precise than only a generic part-of relation (e.g., Root is a structural part of some Plant and NatureReserve is located-in some Country) and/or consider a Content Ontology Design Pattern [4], such as being more finicky about names for plants and animals with, perhaps, the Linnaean Taxonomy content pattern or adding some information on the Climatic Zone where the plants and animals live, and so on. (But note that regarding content, one also can take a bottom-up approach to ontology development with resources such as the Environment Ontology or pick and choose from ‘semantified’ Biodiversity Information Standards etc.)

References

[1] Antoniou, G, van Harmelen, F. A Semantic Web Primer. MIT Press, 2003.

[2] Masolo, C., Borgo, S., Gangemi, A., Guarino, N., Oltramari, A. WonderWeb Deliverable D18–Ontology library. WonderWeb. 2003.

[3] Keet, C.M. and Artale, A. Representing and Reasoning over a Taxonomy of Part-Whole Relations. Applied Ontology, IOS Press, 2008, 3(1-2): 91-110.

[4] Presutti, V., Gangemi, A., David, S., de Cea, G. A., Surez-Figueroa, M. C., Montiel-Ponsoda, E., Poveda, M. A library of ontology design patterns: reusable solutions for collaborative design of networked ontologies. NeOn deliverable D2.5.1, Institute of Cognitive Sciences and Technologies (CNR). 2008.