Copyright ©2005 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
Animal
)
as a property value (e.g., topic or book subject) when building an ontology. While
OWL Full and RDF Schema do not put any restriction on using classes as property
values, in OWL DL and OWL Lite most properties cannot have classes as their values. We
illustrate the direct approach for representing classes as property values in
OWL-Full and RDF Schema. We present various alternative mechanisms for representing
the required information in OWL DL and OWL Lite. For each approach, we discuss
various considerations that the users should keep in mind when choosing the best
approach for their purposes.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document is a Working Group Note, produced by the Ontology Engineering and Patterns Task Force in the Semantic Web Best Practices and Deployment Working Group, part of the W3C Semantic Web Activity. This document is one of a series of documents that is produced by the task force. Comments on this document may be sent to public-swbp-wg@w3.org, a mailing list with a public archive.
Publication as a Working Group Note does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
Animal
) as a property
value (e.g., topic or book subject) when building an ontology. While OWL Full
[OWL Overview] and RDF Schema [RDFS]
do not put any restriction on using classes as property values, in OWL DL
and OWL Lite most properties cannot have classes as their values.
More specifically, consider two book examples: (1) "Lions: Life in the Pride", which is a book that "presents an introduction to lions describing their physical characteristics, habitat, young, food, predators, and relationship to people"; and (2) "The African Lion," which "describes the physical characteristics, habitat, and behavior of the" African lions. We would like to specify that the first book describes the animal species of lion, and the second describes a species of African lion. We also want to retrieve the second book when a query is about lions, not just African lions.
We consider species of animals to be subjects of the books
and
would like to use the Dublin Core property dc:subject
for this annotation. Furthermore, we would like to use as our
subjects
various species from an existing class hierarchy of different animal
species.
We examine representation of this information in OWL and RDF Schema and suggest different ways of capturing this information in OWL DL and OWL Lite.
One goal of the web publisher is to enable maximum reuse of published information. It will be common on the Semantic Web to import and reuse other published ontologies. Any reuse of existing ontologies on the Semantic Web (in our case, a hierarchy of animal species) should preserve the original intended semantics in the new context. If the semantics changes, other applications already using the ontology may be adversely affected. Interoperation with existing applications using this ontology will also be error-prone (since there will be two different interpretations of the same ontology). Some of the patterns that we suggest below change the interpretation of the hierarchy of classes used for property values. We suggest that users take this approach only if they know that no one will be adversely affected by such re-interpretation.
This issue arises in general when we have a hierarchy of classes and would
like to use it as a terminology to annotate other classes or individuals.
Consider using a hierarchy of different genres to annotate music CDs, or linking
classes or individuals in an ontology to the corresponding terms in a standard
reference terminology. For example, UMLS is a standard reference
terminology for many medical applications. One may want to have a hasDiagnosis
relation from an instance of a patient to a class representing a disease indicating
the patient was diagnosed with that disease. Other use cases for using
classes as property values include meta-modeling and semantic interoperability
between systems.
This note uses a particular example (classes as the subjects of books) to illustrate a more general representation issue: using classes as property values. This note should not be interpreted as a general discussion of how to represent subject hierarchies or terminologies on the semantic web.
dc:subject
property). We can define a class Book
to represent all books.
For simplicity, in the hierarchy of animals, we omit classes for other
animals, such as mammals and felines (Figure 1).
Figure 1. Using classes directly as property values.
Here is a definition of an individual (a specific book that we are annotating) with the corresponding subject (for simplicity, we assume that each book discusses only one species of animal):
:LionsLifeInThePrideBook
a :Book ;
rdfs:seeAlso <http://isbn.nu/0736809643> ;
:bookTitle "Lions: Life in the Pride" ;
dc:subject :Lion .
:TheAfricanLionBookAnd the class
a :Book ;
rdfs:seeAlso <http://isbn.nu/089686328X> ;
:bookTitle "The African Lion" ;
dc:subject :AfricanLion .
AfricanLion
is a subclass of the class Lion
:
:AfricanLion
a owl:Class;
rdfs:subClassOf :Lion .
Lion
(the subject of the LionsLifeInThePrideBook
individual) is a subclass of Animal
and that AfricanLion
(the subject of the TheAfricanLionBook
individual) is a
subclass
of Lion
.dc:subject
property, then we need to create an additional class for such a restriction.
For instance, we may want to define a class of all books about animals—BookAboutAnimals
—that
our animal books will be instances of and we want to restrict the range of
values for the dc:subject
property for the BookAboutAnimals
class to the class Animal
and its subclasses. One way to define
such restriction is as follows:
:BookAboutAnimalsHere we say that the class
a owl:Class ;
rdfs:subClassOf :Book ;
rdfs:subClassOf
[ a owl:Class ;
owl:unionOf ([ a owl:Restriction ;
owl:onProperty dc:subject ;
owl:hasValue Animal
]
[ a owl:Restriction ;
owl:onProperty dc:subject ;
owl:someValuesFrom
[ a owl:Restriction ;
owl:onProperty rdfs:subClassOf;
owl:hasValue Animal
]
])
] .
BookAboutAnimals
is a subclass of
the
class Book
. The class BookAboutAnimals
is also a
subclass
of the class of all things that must have either the class Animal
itself, or any class that is a subclass of Animal
as one of
the
values of the dc:subject
property.dc:subject
values or do not care that you also need to use classes as subjects to implement
this restriction.
dc:subject
property (Figure 2).
Figure 2. Using a hierarchy of subjects and a parallel set of subject individuals.
Thus, we will have, for example, an individual LionSubject
that
will be an instance of the Lion
class:
:LionSubjectWe can then use the
a :Lion .
LionSubject
as the value of the property dc:subject
for the LionsLifeInThePrideBook
individual:
:LionsLifeInThePrideBook
a :Book ;
rdfs:seeAlso <http://isbn.nu/0736809643> ;
:bookTitle "Lions: Life in the Pride" ;
dc:subject :LionSubject .
Lion
has an instance that is the subject lion.
Creating an instance of the Lion
class to represent a specific
lion at the zoo would be inconsistent with this interpretation. Therefore,
we will need to have a different class to represent lions at the zoo.
This change has important implications if the hierarchy of animals is not
created by us, but we imported it from somewhere else. Applications will interpret
the reference to imported classes according to their original definitions.
Other ontologies importing the same hierarchy of animals will in fact use
the original definition. Therefore, there may be inconsistency not only in
our own interpretation but also when our ontology is integrated with others
importing the same resource. This consideration is not a problem when interoperability
is not an issue.LionSubject
individual defined
above
and, for example, an AfricanLionSubject
individual, which is
an
instance of AfricanLion
:
:AfricanLionSubjectAn application trying to utilize this relation (for example, to extract books about African lions when asked for books about lions), will need to be aware of this specific approach and know to trace back to the corresponding classes, their subclasses, and respective instances. A general-purpose reasoner will not be able to use this information directly. Note however that the individual
a :AfricanLion .
AfricanLionSubject
is also an instance of the Lion
class. Therefore, if we ask
for
all books where dc:subject
is an instance of the Lion
class we will get the books that are annotated with AfricanLionSubject
.dc:subject
property for the class BookAboutAnimals
is straightforward.
We
define a someValuesFrom
restriction that states that some
values
of the dc:subject
property are instances of the class Animal
:
:BookAboutAnimals
a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:someValuesFrom :Animal ;
owl:onProperty dc:subject
] .
Subject
and make all the subjects to
be individuals that are instances of this class Subject
(Figure 3):
:LionSubject
a :Subject ;
rdfs:seeAlso :Lion .
Figure 3. Using a property other than rdfs:subClassOf
to organize the subject hierarchy
rdfs:seeAlso
to link the LionSubject
individual to the Lion
class. Note that rdfs:seeAlso
is an annotation property and hence giving it a value that is a class does not
take us out of OWL DL. In this approach, we are essentially using individuals
as surrogates for classes.
We can then create explicit relations between different subjects, which will re-create the hierarchy for animals that we have in mind.
:parentSubjectWhile we create our own property
a owl:TransitiveProperty , owl:ObjectProperty ;
rdfs:domain :Subject ;
rdfs:range :Subject ;
rdfs:seeAlso <http://www.w3.org/2004/02/skos/core#broader> .
:AfricanLionSubject
a :Subject ;
rdfs:seeAlso :AfricanLion ;
:parentSubject :LionSubject .
parentSubject
, we can also use the
corresponding
properties from the SKOS-Core
1.0 schema, which is an RDF schema for representing thesauri and
similar
types of knowledge organization systems. So, for example parentSubject
is similar to skos:broader
. The SKOS schema provides a rich
vocabulary
for handling subject hierarchy, with additional properties such as skos:narrower
,
skos:related
,
and so on.
parentSubject
property in RDF Schema.AnimalSubject
is a parentSubject
of AfricanLionSubject
. However, a DL reasoner will
not be able to infer that a book that has LionSubject
as the
value
for dc:subject
is also about Animals. More specialized
reasoners
may be able to infer this information.rdfs:seeAlso
. Annotation properties
however, are usually ignored by inference engines.Lion
can be different from the semantics of the
class
of lions. Having subjects in a separate hierarchy, would allow us to
define
for example that the subject Africa
is a parent subject of
the
subject AfricanLion
.parentSubject
property—are consistent with each other. However, developers can
instrument
tools that would maintain this consistency automatically.dc:subject
property for the class BookAboutAnimals
is straightforward.
We
restrict the values of the dc:subject
property to the
instances
of the class Subject
:
:BookAboutAnimals
a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:someValuesFrom :Subject ;
owl:onProperty dc:subject
] .
This approach enables us to use a DL reasoner to infer, for example, that a
book that has Lion
as a subject also has Animal
as
its subject. In this approach, we create a new class to represent a class of
all books with a particular subject. For example, we create a class BookAboutLions
to represent all books that have Lion
as one of their subjects.
We then assign a subject to a specific book by making the book an instance of
one of these classes, instead of explicitly setting a property value for the
instance. Thus, for example the individual LionsLifeInThePrideBook
will be an instance of the class BookAboutLions
(Figure 4). We create similar classes for any subject category
of books that we are interested in, such as BookAboutAnimals
, BookAboutAfricanLions
.
Figure 4. Using members of a class as values for properties.
The key in this pattern is the definition of the new book classes. Because
these classes represent all the books about a particular subject, we include
subject in the definition. The following, for example, is the definition of
the class BookAboutLions
:
:BookAboutLionsA specific instance of this class
a owl:Class ;
owl:equivalentClass
[ a owl:Class ;
owl:intersectionOf ([ a owl:Restriction ;
owl:onProperty dc:subject ;
owl:someValuesFrom :Lion
]
:Book)
] .
LionsLifeInThePrideBook
would
then be defined as follows:
:LionsLifeInThePrideBook
a :BookAboutLions ;
rdfs:seeAlso <http://isbn.nu/0736809643> ;
:bookTitle "Lions: Life in the Pride" .
The code above says, literally, that this book instance (LionsLifeInThePrideBook
)
is an instance of a class, all of whose members have at least one instance of
the class Lion
as the value for the dc:subject
property.
In OWL, it is not necessary to create any explicit instances of these classes
that we use in the someValuesFrom
restriction (e.g., Lion
above). In Figure 4, we include these instances in the diagram as if
they were explicit, and use dotted lines to denote that they may not actually
exist.
This approach approximates the interpretation that we used in the previous
approaches by using unspecified members of a class rather than the class itself
as property values (Figure 4). We define the class BookAboutAnimals
as a class of books where the subject is some (unidentified) animal or
animals. Similarly, a BookAboutLions
class will be a class of books
where a subject is some (unidentified) lion or lions.
A DL reasoner will be able to classify LionsLifeInThePrideBook
as an instance of the class BookAboutAnimals.
Note that there a correspondence between the hierarchy of classes of books
on specific subjects (such as BookAboutAnimals
, BookAboutLions
,
and BookAboutAfricanLions
) and the classes in the species hierarchy
that we use as subjects (Animal
, Lion
, AfricanLion
).
The hierarchy of books essentially parallels the hierarchy of subjects, although
it does not have to have a book class corresponding to each subjects—only
the subjects that we are interested in. If the book classes are defined as above,
a DL reasoner will be able to infer automatically the hierarchy of book classes,
based on the hierarchy of subjects.
There is a variant to this approach in which we merge the two steps into one.
Instead of creating an explicit named class, BookAboutLions
, and
then creating an instance of this class, we create the instance and assign its
type to be an anonymous class of type owl:Restriction
. In this
variant, there is no explicitly named class corresponding to BookAboutLions
.
For example, we can define LionsLifeInThePrideBook
as follows:
:LionsLifeInThePrideBook
a :Book;
[ a owl:Restriction ;
owl:onProperty dc:subject ;
owl:someValuesFrom :Lion
];
rdfs:seeAlso <http://isbn.nu/0736809643> ;
:bookTitle "Lions: Life in the Pride" .
Lion
class—rather than
the Lion
class itself . In this case, a book about lions is a book
about some lions, even if that happens to be all lions.LionsLifeInThePrideBook
that has an instance of a Lion
class as its subject as an instance of both the class BookAboutLions
and BookAboutAnimals
. It will also be able to classify the class
BookAboutLions
defined above as a subclass of the class BookAboutAnimals
(defined in a similar way).dc:subject
as an annotation property:
dc:subject
a owl:AnnotationProperty .
:LionsLifeInThePrideBook
a :Book ;
rdfs:seeAlso <http://isbn.nu/0736809643> ;
:bookTitle "Lions: Life In The Pride" ;
dc:subject :Lion .
Figure 5. Using classes as values for annotation properties.
dc:subject
(or another property you want to use) is defined elsewhere as an object
property or a datatype property, it cannot be used as an annotation
property.BookAboutAnimals
must all be subclasses of the Animal
class.This document is a product of the Ontology Engineering and Patterns Task Force of the Semantic Web Best Practices and Deployment Working Group.