Fig. 1.
Glosses written between lines
of a page of a Latin gospel
written in Ireland
in the first quarter of the 9th century
Bodleian Library MS. Auct. D. 2. 19 fol. 64r
(used by permission CC-By-NC 4.0 of the Bodleian Library)
A glossary is a partial dictionary, a list with explanations of technical or abstruse terms, a collection of glosses. A gloss is a synonym or explanation inserted between the lines or in the margin to explain difficult words in a text — see the beautiful example to the right (Fig. 1) dating from 1241, in which you can clearly see glosses in the left margin, and also in the right margin, the center gutter, and in many of the spaces between lines. A glossary collects such glosses in a single place, rather than dispersed through a document.
A glossary for a particular problem or domain is a list of the special terms that are used there. A glossary is a partial dictionary in that it does not include words that are used in their ordinary senses, only those that are either special words not used in ordinary life or that are used with a special meaning in this context.
See the voting glossary for an example of a glossary in requirements engineering. This glossary defines the words and phrases that are used with special meaning in the domain of elections and voting. Hyperlinks are used to take a reader from each use of a glossary term to the definition of that term, and the distinctive format of hyperlink text identifies each such use.
A good glossary defines every word and phrase that is used with special meaning, and gives these definitions in terms of ordinary words and in terms of other glossary terms.
Glossaries are great as far as they go, but in software requirements we are also very interested in the relationships among concepts, which are made explicit in an ontology.
An ontology consists (for our purposes) of several components:
An ontology adds more information that is not present in a glossary. This additional information provides for more informative problem descriptions. It also makes it easier to check that the glossary is correct, by giving paths by which we can try out what we have so far. For example,
Fig. 2. Ontology diagram — vehicles
Some of this additional information can be effectively presented in a diagram. Figure 2 illustrates one form of diagram for ontologies (there are many); this form uses a notation similar to UML class diagrams. A key for this kind of ontology diagram is given in Figure 3.
Fig. 3. Key to ontology diagrams
Fig. 4. Ontology diagram — numbers
For some reason it is rare to see an ontology diagram with individuals as well as concepts. Figure 4 shows an ontology of several types of number, with several individuals shown as well. The individual-of relationship is propagated transitively by subsumption, so that for example because Algebraic subsumes Rational, ½ is an algebraic number (a root of some polynomial with integer coefficients) as well as a rational number.
There are several terms that seem just about interchangeable with
ontology
in requirements engineering,
such as
conceptual map
and conceptual graph
.
Ontology-like things have been studied and used for decades,
for example
entity-relationship diagrams
which date back to the 1970s.
Description logic
provides a formal underpinning for ontologies,
and is the basis for the OWL Web Ontology Language,
supported by the
Protégé
ontology editor
and several semantic reasoners.
Alloy provides a relational logic notation
with which ontologies can be expressed formally,
and then checked using a software tool.
Once you have decided that two concepts T and t are related, you need to decide what kind of relationship they have. One way to decide is to consider the following questions, in sequence:
(It must not be possible for any t not to also be a T.)
(T and t must be the same sort of concept: both are physical objects, or both are mathematical concepts, or ….)
(It must not be possible for a particular t to be part of more than one T at the same time; if it is possible, then probably a t is a property of a T rather than a component part.)
(It must not be possible for any T to not have a t that describes it.)
Because the hierarchical
subsumption and whole-part relationships
are transitive,
you do not need to specify them
across more than one level of hierarchy.
For example,
if Toyota Prius
is a sub-concept of Toyota
,
and Toyota
is a sub-concept of car
,
you need not also say that Toyota Prius
is a sub-concept of car
,
because it is already implied.
Similarly, if tire
is a part of wheel
,
and wheel
is a part of car
,
you need not say that tire
is a part of car
because this is also already implied.
Relations are inherited down the subsumption hierarchy,
and these do not need to be explicitly stated either.
For example, car
is related to model-year
, so
you need not say that Toyota Prius
is related to model-year
because this is already implied.
Example: car, Toyota Prius, wheel, model year, driver, goal. What kinds of relationships do these have?
Toyota Priusis a sub-concept of
car.
wheeland
cardo not have a subsumption relationship. However, every car has wheels as some of its component parts, and both cars and wheels are physical objects, and it is not possible for a wheel to be part of more than one car at the same time. Therefore
carand
wheelhave a whole-part relationship, with
wheelbeing a part of
car.
model-yearand
cardo not have a subsumption relationship. Nor does every car have a model year as one of its component parts, because
carand
model yearare very different kinds of concepts. But every car is described by a model year, so
model yearis a property of
car.
driverand
cardo not have a subsumption relationship. Nor does every car have a driver as one of its component parts, or vice-versa, so
driverand
cardo not have a whole-part relationship. Nor is every car is described by specifying its driver, or vice versa, at least not in general (a particular driver may drive many cars, although not at the same time), so neither
drivernor
caris a property of the other. However, there is a relationship between a driver and a car, although it is none of the above kinds.
Carand
goaldo not appear to have any relationship. It's not necessary to state this specifically (unless a reader might be confused and assume some relationship exists), as most concepts are assumed to be unrelated unless some relationship is stated.
Subsumption relationships never have cardinalities; they make no sense for this kind of relationship.
A whole-part relationship or a property relationship has an implicit cardinality (at one end). If a t is a part of a T, then there is necessarily at most one T for every t already, and this should not be also specified as a cardinality. If a t is a property of a T, then there are ordinarily many Ts for every t already, and this should not be also specified as a cardinality. If the cardinality of the values for a particular property is important, the relationship should probably not be expressed as a property.
It is possible to have one cardinality at the part end of a whole-part relationship, or at the property end of a property relationship. A T may consist of n ts, for example, or be characterized by n values of property p.
Other relationships
can have cardinalities at either or both ends.
Example: car, Toyota Prius, wheel, model year, driver, goal. What kinds of cardinalities do these have?
Toyota Priusis a sub-concept of
car. Subsumption relationships do not have cardinalities.
Carand
wheelhave a whole-part relationship, with
wheelbeing a part of
car. In a whole-part relationship, the cardinality of the whole individual is never stated (it is implied to be 1). It is possible to give a cardinality for the number of parts, however. In this case, we would say that each car has 4 wheels. We might also give separate whole-part relations to determine the four wheels for a particular car, calling them
right-front,
left-front, etc.
Model yearis a property of
car, and
carand
model-yearhave an individual-property relationship (an instance of a car has a model year as a property). The cardinality of the individual is never or rarely stated (it is implied to be *). Each car has exactly one model year, however, and this should be stated.
Driverand
carhave a relationship that is none of the above kinds. It would be possible to specify cardinalities if these could be determined. A driver
drivesa car, so it would probably make sense to specify this as a cardinality (each driver can drive at most one car at a time) by labelling the line between the concepts; the cardinalities might be 0..1 drivers drive 0..1 cars (each driver drives either 0 or 1 car at a time, and each car is driven by either 0 or 1 driver at a time). An alternative relationship might be
can drive; for this relationship, the cardinalities might be * drivers can drive * cars (a driver can drive any of some unknown but potentially large number of cars, and vice versa).
Carand
goalhave no relationship, so it makes no sense to talk about cardinalities for these.
In general, one can test the correctness of an ontology by asking these questions:
yesfor every T)
yesfor every T)
yesfor every T)
yesfor every U)
yes)
yes)
no)
yes)
no)
yes)
no, at least for the purposes of discussing the domain)
yes)
no, unless T is a sub-concept that inherits P from its parent in which case
yesis acceptable)
yes)
The concepts, properties, organization, and relationships, of an ontology can be partially expressed in a diagram. This diagram is similar in some ways to a UML class diagram, but in other ways not similar.
Similar | (in an ontology) | (in a class diagram) |
---|---|---|
Both have a hierarchical organization | of concepts | of classes |
Both have relationships between things | between individuals of concepts | between objects of classes |
Both have ways to restrict relationships | cardinalities | cardinalities |
Not similar | (in an ontology) | (in a class diagram) |
Different kinds of things are in the diagram | Things in the problem space | Things in the system implementation |
Implementation-specific notation | — | operations (methods) associations as classes most of the stereotypes |
Fig. 5. The same approaches apply no matter what the concepts
In general,
there are certain questions you can (and should) ask about parts of an ontology,
even if you don't know what the concepts mean
(as in the Frooble
example diagram in Fig. 5).
an A)
A is P)
An A is a B)
yes)
yes)
no)
yesor
no)
yesor
no) (unlike UML class diagrams)
A is R with B)
You can ask these questions about any ontology, even if you don't know what the concepts in the ontology mean. The answers help test you understanding of the relations among the concepts