Upto: Table of Contents of full book

RDF Schema

RDF describes objects and relationships between them RDF Schema describes the semantics of these relationships. This allows a basic level of inferencing to take place, and is the simplest level of "Semantics" in the Semantic Web.



Schemes such as Dublin Core and Friend of a Friend allow relationships to be established between entities represented as liternals (strings, numbers) or as URIs. SKOS is a mechanism whereby other systems can be brought into the Web world. The predicates used in these relationships are described by RDF, and these are used to build the RDF triples relating entities.

But RDF does not attach any semantic meaning to these triples. As far as the machine is concerned, "John loves Mary" holds exactly as much meaning as "Foobar quarkles Thing-a-me-jig" - that is, none. That is where RDF Schema comes in: it has a standard set of meanings, and predicates can be given those meanings.

Now these meanings don't go as far as explaining what "loves" is. The RDFS meanings are still very general: for example, RDFS can be used to say that only Agents can love, while those Agents can love anything, but not more precise than that.

RDFS allows a simple level of syllogistic reasoning. See Wikipedia on Syllogisms for a list of possible deductions that can be made.

While many people think this is great, some are more cynical: for example, Clay Shirky says "[the Semantic Web] will improve all the areas of your life where you currently use syllogisms. Which is to say, almost nowhere." He claims that "we guess, extrapolate, intuit, we do what we did last time, we do what we think our friends would do or what Jesus or Joan Jett would have done, we do all of those things and more, but we almost never use actual deductive logic" That may be so, but by offloading such reasoning onto the computer, we can free ourselves of this burden in order to perform more human styles of reasoning, with the deductive basis to do the mundane parts for us.

Classes and sets

A set is a group of individuals. We usually talk about sets as having a shared set of characteristics, such as the set of red things, the set of living things, the set of books in a library and so on. But as Russell's paradox shows, this can lead to sets which don't exist, such as the library catalogue which doesn't contain itself.

Mathematicians have devised many subtle ways of avoiding such paradoxes, and the way used in RDFS is based on classes instead of sets. For those with a very strong mathematical bent, RDFS has a "model theory" which explains this. The interested reader should refer to the W3C documentation

A class is characterised by a property, and all instances of that class share that property. All of the instances may also form a set, which is the set associated with that class. Huh? Lets's look at the class defined by "having the email address jan@newmarch.name". Well, that class has only one instance, and that is me. So the set associated with that class is {'Jan Newmarch'}, a set with only one element. But I've got another email address, and that belongs to a different class: the class defined by "having the email address jan.newmarch@gmail.com". Well, that class has the same associated set, {'Jan Newmarch'}, but it isn't the same class! These classes have the same associated set, but have a different defining property.

Instances of a class

Resources form the instances of any class. There is a super-class which contains every instance, and that is the class rdfs:Resource. A class can have subclasses, so every class is a subclass (including itself) of rdfs:Resource.

There are several special subclasses


In RDF, properties have a URI. That makes them instances of the class rdf:Property. Properties are erlations between two resources, and the class of possible source instances forms the rdf:domain while the class of possible values forms the rdf:range of the property.

As a very loose example, we might have a property authorOf. The domain of this could be the class of Authors while the range could be Works. It's a loose example because (at this point) we haven't even begun to talk at any level below the most general.

Type of

if we have a resource, and we want to talk about its type, then we use the rdf:type property: for example,

	'A string' rdf:type rdf:Literal


Elephants are mammals: the class of elephants is a subclass of the class of mammals. This is expressed in RDFS using the property rdf:subClassOf, as in

	Elephants rdf:subClassOf Mammals

Subclass entailment

Entailment is the process of deriving new information from old. This is the process of semantic deduction. But what may seem obvious deductions to us aren't so obvious to a computer unless the steps are spelled out in v-e-r-y---t-e-d-i-o-u-s---d-e-t-a-i-l. Well, we've now (finally) reached the stage where we can do the simplest of derivations.

Rule rdfs9 in Section 9.2.1 of RDF 1.1 Semantics says

	if xxx rdfs:subClassOf yyy and
	zzz rdf:type xxx
	zzz rdf:type yyy 
That is
	if elephants are mammals and
	Baba is an elephant
	Baba is a mammal

I'm sorry if that sounds like an anticlimax, but this kind of thing is what the Semantic Web is all about: spend a lot of time building up classifications according to URIs and RDF predicates, and then make what seem to be very straightforward deductions based on rules of inference for a particular logic (here RDFS semantics).

Some further entailment patterns are given in this table.

RDFS entailment patterns.
If S contains: then S RDFS entails recognizing D: Example
rdfs1 any IRI aaa in D aaa rdf:type rdfs:Datatype .
rdfs2 aaa rdfs:domain xxx .
yyy aaa zzz .
yyy rdf:type xxx . If length-of-trunk has domain elephants and Baba's length-of-trunk is zzz , then Baba is an elephant
rdfs3 aaa rdfs:range xxx .
yyy aaa zzz .
zzz rdf:type xxx . If length-of-trunk has range metres and yyy's length-of-trunk is 2, then 2 is in metres
rdfs4a xxx aaa yyy . xxx rdf:type rdfs:Resource . If Baba's length-of-trunk is zzz then Baba is a Resource
rdfs4b xxx aaa yyy. yyy rdf:type rdfs:Resource . If xxx's length-of-trunk is 2, then 2 is a Resource
rdfs5 xxx rdfs:subPropertyOf yyy .
yyy rdfs:subPropertyOf zzz .
xxx rdfs:subPropertyOf zzz .
rdfs6 xxx rdf:type rdf:Property . xxx rdfs:subPropertyOf xxx .
rdfs7 aaa rdfs:subPropertyOf bbb .
xxx aaa yyy .
xxx bbb yyy .
rdfs8 xxx rdf:type rdfs:Class . xxx rdfs:subClassOf rdfs:Resource . If Mammal is a class then Mammal is a subclass of Resource
rdfs9 xxx rdfs:subClassOf yyy .
zzz rdf:type xxx .
zzz rdf:type yyy . If Mammal is a subclass of Animal and Baba is an elephant then Baba is an Animal
rdfs10 xxx rdf:type rdfs:Class . xxx rdfs:subClassOf xxx . If Mammal is a class then Mammal is a subclass of Mammal
rdfs11 xxx rdfs:subClassOf yyy .
yyy rdfs:subClassOf zzz .
xxx rdfs:subClassOf zzz . If Mammal is a subclass of Animal and Animal is a subclass of Living Thing then Mammal is a subclass of Living Thing
rdfs12 xxx rdf:type rdfs:ContainerMembershipProperty . xxx rdfs:subPropertyOf rdfs:member .
rdfs13 xxx rdf:type rdfs:Datatype . xxx rdfs:subClassOf rdfs:Literal .


RDFS allows a basic level of reasoning, essentially based on membeship and subclassing properties. It doesn't get you very far, but then it isn't intended to. For full-blown reasoning, you need Owl.


Copyright © Jan Newmarch, jan@newmarch.name

If you like this book, please contribute using Flattr
or donate using PayPal