RDFS: Resource Description Framework Schema slides are borrowed from Costello.

68
RDFS: Resource Description Framework Schema slides are borrowed from Costello

Transcript of RDFS: Resource Description Framework Schema slides are borrowed from Costello.

RDFS: Resource Description Framework Schema

slides are borrowed from Costello

2

Lecture schedule

• Ontology• Syntax of RDF and RDFS

– Basic Ideas of RDF – Three representations of RDF– Basic Concepts of RDF Schema– Τhe Language of RDF Schema

• Axiomatic Semantics for RDF and RDFS• Applications of RDF and RDFS

– Querying of RDF/RDFS Documents

3

RDF Schema is about creating Taxonomies

OceanLake

BodyOfWater

River

Stream

Properties: length: Literal emptiesInto: BodyOfWater

Sea

NaturallyOccurringWaterSource

TributaryBrook

Rivulet

RD

F S

motiva

tion

4

What inferences can be made on this RDF/XML, given the taxonomy on the last slide?

<?xml version="1.0"?><River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"> <length>6300 kilometers</length> <emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/></River>

Inferences are made by examining a taxonomy that contains River.See next slide.

RD

F S

motiva

tion

5

OceanLake

BodyOfWater

River

Stream

Properties: length: Literal emptiesInto: BodyOfWater

Sea

NaturallyOccurringWaterSource

TributaryBrook

InferenceEngine

Inferences: - Yangtze is a Stream - Yangtze is an NaturallyOcurringWaterSource - http://www.china.org/geography#EastChinaSea is a BodyOfWater

Yangtze.rdf

Rivulet

<?xml version="1.0"?><River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"> <length>6300 kilometers</length> <emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/></River>

RD

F S

motiva

tion

6

How does a taxonomy facilitate searching?

OceanLake

BodyOfWater

River

Stream

Properties: length: Literal emptiesInto: BodyOfWater

Sea

NaturallyOccurringWaterSource

TributaryBrook

The taxonomy shows that when searching for "streams", any RDF/XML thatuses the class Brook, Rivulet, River, or Tributary are relevant. See next slide.

Rivulet

RD

F S

motiva

tion

7

OceanLake

BodyOfWater

River

Stream

Properties: length: Literal emptiesInto: BodyOfWater

Sea

NaturallyOccurringWaterSource

TributaryBrook

<River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"> <length>6300 kilometers</length> <emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/></River>

SearchEngine

Results: - Yangtze is a Stream, so this document is relevant to the query.

"Show me all documents that contain info about Streams"

Yangtze.rdf

Rivulet

From Costello

8

You now know everything about RDF Schemas!

• RDF Schemas is all about defining taxonomies (class hierarchies).

• a taxonomy can be used to make inferences and to facilitate searching.

• That's all there is to RDF Schemas!• The rest is just syntax …

– The previous slide showed the taxonomy in a graphical form. – we need to express the taxonomy in a form that is machine-

processable. – RDF Schemas provides an XML vocabulary to express

taxonomies.

From Costello

RD

F S

motiva

tion

9

Lecture Schedule

• Ontology• Syntax of RDF and RDFS

– Basic Ideas of RDF – Three representations of RDF– Basic Concepts of RDF Schema– Τhe Language of RDF Schema

• Axiomatic Semantics for RDF and RDFS• Applications of RDF and RDFS

– Querying of RDF/RDFS Documents using RQL

10

Defining a class (e.g., River)

<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.geodesy.org/water/naturally-occurring">

<rdfs:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/> </rdfs:Class>

<rdfs:Class rdf:ID="Stream"> <rdfs:subClassOf rdf:resource="#NaturallyOccurringWaterSource"/> </rdfs:Class>

...

</rdf:RDF>

This is read as: "I hereby define a River Class. River is a subClassOf Stream." "I hereby define a Stream Class. Stream is a subClassOf NaturallyOccurringWaterSource." ...

All classes andproperties aredefined withinrdf:RDF

Defines theRiver class

Defines theStream class

Since the Stream class is defined in the same document we can reference it using a fragment identifier.

1

2 Assigns a namespace to thetaxonomy!

3

4

5

From Costello

11

rdfs:Class

• This type is used to define a class.• The rdf:ID provides a name for the class.• The contents are used to indicate the

members of the class.– The contents are ANDed together.

<rdfs:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/></rdfs:Class>

Name of the class

<rdf:Description rdf:ID="River"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> <rdfs:subClassOf rdf:resource="#Stream"/></rdf:Description>

equivalent

12

rdfs:subClassOf is transitive

OceanLake

BodyOfWater

River

Stream

Sea

NaturallyOccurringWaterSource

TributaryBrook

Rivulet

Consider the above class hierarchy. It says, for example, that: - A Rivulet is a Brook. - A Brook is a Stream. Therefore, since subClassOf is transitive, a Rivulet is a Stream. (Note that a Rivulet is also a NaturallyOccurringWaterSource.)

13

Defining properties

<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.geodesy.org/water/naturally-occurring">

<rdf:Property rdf:ID="emptiesInto"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="#BodyOfWater"/> </rdf:Property> ...

</rdf:RDF>

This is read as: "I hereby define an emptiesInto Property. The domain (class) in which emptiesInto is used is River. The range (of values) for emptiesInto are instances of BodyOfWater." That is, the emptiesInto Property relates (associates) a River to a BodyOfWater.

NaturallyOccurringWaterSource.rdfs (snippet)

River BodyOfWateremptiesInto

domain range

14

Rdf:Property

• This type is used to define a property.• The rdf:ID provides a name for the property.• The contents are used to indicate the usage of the

property.– The contents are ANDed together.

<rdf:Property rdf:ID="emptiesInto"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="#BodyOfWater"/></rdf:Property>

Name of the property

ANDed

<rdf:Description rdf:ID="emptiesInto"> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="#BodyOfWater"/></rdf:Description>

equivalent

15

Properties can have multiple domain and range

BodyOfWater

range

CoastalWater

- the value of emptiesInto is a BodyOfWater and a CoastalWater.

<rdf:Property rdf:ID="emptiesInto"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="#BodyOfWater"/> <rdfs:range rdf:resource="http://www.geodesy.org/coast#CoastalWater"/></rdf:Property>

16

Note that properties are defined separately from classes• OO: when a class is defined the properties

(attributes) are simultaneously defined. – E.g, "I hereby define a Rectangle class, and its attributes are

length and width.”• In RDF: classes and properties are defined

separately. – define the Rectangle class, and indicate that it is a subclass of

GeometricObject. – Separately, define a length property, indicate its domain

(Retangle) and range.• Advantage: anyone, anywhere, anytime can

create a property and state that it is usable with the class!

17

The XML Representation of the taxonomy<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.geodesy.org/water/naturally-occurring">

<rdfs:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/> </rdfs:Class>

<rdfs:Class rdf:ID="Stream"> <rdfs:subClassOf rdf:resource="#NaturallyOccurringWaterSource"/> </rdfs:Class>

<rdf:Property rdf:ID="emptiesInto"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="#BodyOfWater"/> </rdf:Property>

<rdf:Property rdf:ID="length"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/> </rdf:Property>

...

</rdf:RDF>

18

NaturallyOccurringWaterSource Ontology!

• NaturallyOccurringWaterSource.rdfs defines – a set of classes and how the classes are related. – a set of properties and indicates the type of values they may

have and what classes they may be associated with.

• That is, it defines an ontology for NaturallyOccurringWaterSources!

• RDF Schema– Classes and Properties– Class and instances (RDFS and RDF)– Class Hierarchies and Inheritance– Property Hierarchies

19

Classes and their Instances

• We must distinguish between– Concrete “things” (individual objects) in the domain: Discrete

Maths, David Billington etc.– Sets of individuals sharing properties called classes: lecturers,

students, courses etc.

• Individual objects that belong to a class are referred to as instances of that class

• The relationship between instances and classes in RDF is through rdf:type

20

Why Classes are Useful

• Impose restrictions on what can be stated in an RDF document using the schema – As in programming languages– E.g. A+1, where A is an array– Disallow nonsense from being stated

• “Discrete Maths is taught by Concrete Maths”– We want courses to be taught by lecturers only – Restriction on values of the property “is taught by” (range

restriction)

• “Room MZH5760 is taught by David Billington”– Only courses can be taught– This imposes a restriction on the objects to which the property

can be applied (domain restriction)

21

Class hierarchy

• Classes can be organised in hierarchies– A is a subclass of B if every

instance of A is also an instance of B

– Then B is a superclass of A• A subclass graph need not

be a tree – A class may have multiple

superclasses

22

Inferring a resource's class from the properties' domain

<rdf:Description rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"> <length>6300 kilometers</length> <emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/></rdf:Description>

Notice that in this RDF/XML instance the class of the resource (Yangtze) is not identified:

However, we can infer that Yangtze is a River because length and emptiesIntohave a rdfs:domain of River, i.e., their domain asserts that these properties willbe used in a River instance.

23

WaterResource Taxonomy

LeveeDam

WaterwayObstacle

OceanLake

BodyOfWater

River

Stream

Properties: length: Literal emptiesInto: BodyOfWater obstacle: http://www.ussdam.org#Dam

Sea

NaturallyOccurringWaterSource

TributaryBrook

Rivulet

24

Defining the obstacle property

<rdf:Property rdf:ID="obstacle"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="http://www.ussdam.org#Dam"/></rdf:Property>

Read this as: "I hereby define a property called obstacle. The type of value that this property will have is of type Dam (more specifically, of typehttp://www.ussdam.org#Dam). This property will be used in a River Class”

the River class is defined locally, so we simply use a fragment identifier.

25

What inferences can be made on this RDF/XML?

Yangtze.rdf

<River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"> <length>6300 kilometers</length> <emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/> <obstacle rdf:resource="http://www.china.org/geography/river/dam#ThreeGorges"/></River>

What inferences can be made about Yangtze, EsatChinaSea, and ThreeGorges?

Inferences are made by examining the taxonomies that contains River and Dam.

26

OceanLake

BodyOfWater

River

Stream

Properties: length: Literal emptiesInto: BodyOfWater obstacle: http://www.ussdams.org#Dam

Sea

NaturallyOcurringWaterSource

TributaryBrook

<River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"> <length>6300 kilometers</length> <emptiesInto rdf:resource="http://www.geodesy.org/water#EastChinaSea"/> <obstacle rdf:resource="http://www.china.org/geography/river/dam#ThreeGorges"/></River>

InferenceEngine

Inferences: - Yangtze is a Stream - Yangtze is an NaturallyOcurringWaterSource - http://www.geodesy.org/water#EastChinaSea is a BodyOfWater - http://www.china.org/geography/river/dam#ThreeGorges is a Dam

Yangtze.rdf

Rivulet

LeveeDam

WaterwayObstacle

27

Untyped resource

<River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#" xmlns:uom="http://www.nist.org#"> <length> <rdf:Description> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </rdf:Description> </length> <emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/> <obstacle rdf:resource="http://www.china.org/geography/river/dam#ThreeGorges"/></River>

Create an RDF Schema for the following RDF document:

Note that the property length has a value that has no type indicated.What is the corresponding property declaration? Note that the property units is from a different namespace (a different taxonomy).

untypedresource

28

Defining length with no Type Information

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.geodesy.org/water/naturally-occurring">

<rdfs:Class rdf:ID="River"> <rdfs:subClassOf rdf:resource="#Stream"/> </rdfs:Class>

<rdf:Property rdf:ID="length"> <rdfs:domain rdf:resource="#River"/> </rdf:Property>

...

</rdf:RDF>

No rdfs:range specified.This means that we areproviding no informationon the type of value thatlength will have.

NaturallyOccurringWaterSource.rdfs (snippet)

Disadvantage: this way of defining length yields no inferencing capability about its value.

29

A resource that doesn't have a type specified may nonetheless be typed!

<length> <rdf:Description> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </rdf:Description></length>

There is no type shown for thisresource. But that doesn't meanthat this resource has no type. Itonly means that no type has beenspecified in this RDF/XML instance.In the RDF Schema we can specifywhat its type is.

<rdf:Property rdf:ID="length"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="http://www.nist.org#Distance"/></rdf:Property>

Advantage: now we can infer that the contents of length is of type Distance.

30

<rdf:Property rdf:ID="length"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="http://www.nist.org#Distance"/></rdf:Property>

This RDF Schema:

Does not mandate that the RDF/XML instance specify a type, e.g.,

<length> <uom:Distance> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </uom:Distance></length>

It is perfectly fine to keep that class information isolated to the RDF Schema, e.g.,

<length> <rdf:Description> <rdf:value>6300</rdf:value> <uom:units>kilometers</uom:units> </rdf:Description></length>

(However, it is better practiceto expose the type informationin the RDF/XML instance.)

Best P

racticeBes

t Pra

ctic

e

31

Create RDF Schema for an RDF document <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"><rdf:Description rdf:ID="Yangtze”> <length rdf:datatype="http://www.nist.org#kilometer">6300</length> <maxWidth rdf:datatype="http://www.nist.org#meter">175</maxWidth> <maxDepth rdf:datatype="http://www.nist.org#meter">55</maxDepth> </rdf:Description> </rdf:RDF>

Yangtze.rdf

The River class has three properties containing typed literals.

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.nist.org#">

<simpleType name="kilometer"> <restriction base="integer"> </restriction> </simpleType>

<simpleType name="meter"> <restriction base="integer"> </restriction> </simpleType>

</schema>uom.xsd

The referenced xml schema datatypes in Yangtze.rdf

32

<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.geodesy.org/water/naturally-occurring">

<rdf:Property rdf:ID="length"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="http://www.nist.org#kilometer"/> </rdf:Property>

<rdfs:Datatype rdf:about="http://www.nist.org#kilometer"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> </rdfs:Datatype>

<rdf:Property rdf:ID="maxWidth"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="http://www.nist.org#meter"/> </rdf:Property>

<rdfs:Datatype rdf:about="http://www.nist.org#meter"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> </rdfs:Datatype> ...</rdf:RDF>

NaturallyOccurringWaterSource.rdfs (snippet)

33

Classes inherit properties from their ancestors

OceanLake

BodyOfWater

River

Stream

Properties: emptiesInto: BodyOfWater obstacle: http://www.ussdam.org#Dam

Sea

NaturallyOccurringWaterSource

TributaryBrook

Rivulet

Properties: length: Literal

length has been defined to be a property of Stream. Therefore, all Streamsubclasses inherit the length property. Note that the properties emptiesIntoand obstacle are defined to be local to River.

34

Table showing what properties are applicable to each class

Stream Brook Rivulet

length

emptiesInto

obstacle

X X X

X

X

Properties

Classes River Tributary

X X

35

Defining length and emptiesInto

<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.geodesy.org/water/naturally-occurring">

<rdf:Property rdf:ID="length"> <rdfs:domain rdf:resource="#Stream"/> <rdfs:range rdf:resource="http://www.nist.org#Distance"/> </rdf:Property>

<rdf:Property rdf:ID="emptiesInto"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="#BodyOfWater"/> </rdf:Property> ...

</rdf:RDF>

NaturallyOccurringWaterSource.rdfs (snippet)

36

rdfs:subPropertyOf

length

officialLength

"rdfs:subPropertyOf"

estimatedLength

Property Hierarchy:

You can define a property to be a specialization of another property:

"rdfs:subPropertyOf"

Notes:1. The subproperties inherit the rdfs:range and rdfs:domain values from the parent property. 2. If a subproperty is true, then its parent property is true, e.g., if the Yangtze River has an officialLength of 6300 kilometers then it also has a length of 6300 kilometers.

if P is a subproperty of Q, P(x,y) -> Q(x,y).

37

Table showing what properties are applicable to each class

Stream Brook Rivulet

length

emptiesInto

obstacle

X X X

X

X

Properties

Classes River Tributary

X X

estimatedLength

officialLength

X

X

X

X

X

X

X

X

X

X

38

Making inferences with subproperties

<?xml version="1.0"?><River rdf:ID="Yangtze" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.geodesy.org/water/naturally-occurring#"> <estimatedLength>6300 kilometers</estimatedLength> <emptiesInto rdf:resource="http://www.china.org/geography#EastChinaSea"/></River>

Inference: Since estimatedLength is a subproperty of length, we can infer that the Yangtze has a length of 6300 kilometers.

What inferences can we make on the estimatedLength property:

39

Another example of inferencing using property hierarchies

parent

father

Property Hierarchy:

"rdfs:subPropertyOf"

<?xml version="1.0"?><Person rdf:ID="Mary" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.genealogy.org#"> <father> <Person rdf:about="#John"/> </father></Person>

Inference: Since father is a subproperty of parent, we can infer that Mary has a parent named John.

"Mary has a father named John."

40

A subproperty can narrow the range and/or domain

emptiesInto: BodyOfWater

emptiesIntoSea: Sea

Property Hierarchy:

"rdfs:subPropertyOf"

This subproperty narrows the rangeto Sea.

<rdf:Property rdf:ID="emptiesInto"> <rdfs:domain rdf:resource="#River"/> <rdfs:range rdf:resource="#BodyOfWater"/></rdf:Property>

<rdf:Property rdf:ID="emptiesIntoSea"> <rdfs:subPropertyOf rdf:resource="#emptiesInto"/> <rdfs:range rdf:resource="#Sea"/></rdf:Property>

The property emptiesInto permitsa range of BodyOfWater. Thisproperty, however, narrows therange to Sea.

41

rdfs:label, rdfs:comment

<rdf:Property rdf:ID="Creator"> <rdfs:label xml:lang="EN">Author/Creator</rdfs:label> <rdfs:comment xml:lang="EN">The person or organization primarily responsible for creating the intellectual content of the resource. For example, authors in the case of written documents, artists, photographers, or illustrators in the case of visual resources. </rdfs:comment></rdf:Property>

rdfs:label is used to provide a human-readable version of the property/class name.

rdfs:comment is used to provide a human-readable description of the property/class.

42

Exercise

<?xml version="1.0"?><Catalogue rdf:ID="BookCatalogue" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.publishing.org#" xmlns:dc="http://pur1.org/metadata/dublin-core#" xml:base="http://www.bn.com"> <item> <Book rdf:ID="_0-06-099325-2" xml:base="http://www.publishing.org/book"> <dc:Title>Lateral Thinking</dc:Title> <dc:Creator>Edward de Bono</dc:Creator> <dc:Date>1973</dc:Date> <dc:Publisher>Harper &amp; Row</dc:Publisher> </Book> </item> <item> <Book rdf:ID="_0-440-34319-4" xml:base="http://www.publishing.org/book"> <dc:Title>Illusions: The Adventures of a Reluctant Messiah</dc:Title> <dc:Creator>Richard Bach</dc:Creator> <dc:Date>1977</dc:Date> <dc:Publisher>Dell Publishing Co.</dc:Publisher> </Book> </item> ...</Catalogue>

Barnes_and_Noble_BookCatalogue.rdf

Create an RDF Schema for the following RDF/XML instance:

43

Answer:

<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://www.publishing.org">

<rdfs:Class rdf:ID="Catalogue"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/> </rdfs:Class>

<rdfs:Class rdf:ID="Book"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/> </rdfs:Class>

<rdf:Property rdf:ID="item"> <rdfs:domain rdf:resource="#Catalogue"/> <rdfs:range rdf:resource="#Book "/> </rdf:Property>

...

</rdf:RDF>

PublishingOntology.rdfs

44From Antoniou et al

45

Lecture schedule

• Ontology• Syntax of RDF and RDFS

– Basic Ideas of RDF – Three representations of RDF– Basic Concepts of RDF Schema– Τhe Language of RDF Schema

• Axiomatic Semantics for RDF and RDFS• Applications of RDF and RDFS

– Querying of RDF/RDFS Documents

46

Axiomatic Semantics

• Example: what is the meaning (semantics) of subClass? PropVal(subClassOf,?c,?c')

(Type(?c,Class) Type(?c',Class) ?x (Type(?x,?c) Type(?x,?c')))

• Formalize the meaning of the modeling primitives of RDF and RDF Schema – By translating into first-order logic;– Make the semantics unambiguous and machine accessible;– Provide a basis for reasoning support by automated reasoners manipulating

logical formulas.• All language primitives in RDF and RDF Schema are represented

by constants:– Such as Resource, Class, Property, subClassOf, etc.

• A few predefined predicates are used as a foundation for expressing relationships between the constants– Such as PropVal, Type

• We use predicate logic with equality• Variable names begin with ?• All axioms are implicitly universally quantified

47

Basic predicates

• PropVal(P, R, V)– A predicate with 3 arguments, which is used to represent an

RDF statement with resource R, property P and value V– An RDF statement (triple) (P,R,V) is represented as

PropVal(P, R, V).

• Type(R, T)– Short for PropVal(type,R,T)– Specifies that the resource R has the type T

Type(?r,?t) PropVal(type,?r,?t)

48

RDF Classes

• Constants: Class, Resource, Property, Literal– All classes are instances of

Class

Type(Class,Class)Type(Resource,Class)Type(Property,Class)Type(Literal,Class)

• The predicate in an RDF statement must be a property

PropVal(?p,?r,?v) Type(?p,Property)• Resource is the most general

class: every class and every property is a resource

Type(?p,Property) Type(?p,Resource)Type(?c,Class) Type(?c,Resource)

rdfs:Resource

rdfs:Class rdf:Property rdfs:Literal

rdfs:Datatype rdf:XMLLiteral

rdfs:Class

rdfs:Resource rdf:Property rdfs:Literal

rdfs:Datatype rdf:XMLLiteral

Subclass relationship

Instance relationship

rdf:Property

rdfs:domain

rdf:range

rdf:type

rdfs:subClassOf rdfs:subPropertyOf

49

Type property

• type is a property

PropVal(type,type,Property)

• type can be applied to resources (domain) and has a class as its value (range)

Type(?r,?c) Type(?r,Resource) Type(?c,Class)

rdf:Property

rdfs:domain

rdf:range

rdf:type

rdfs:subClassOf rdfs:subPropertyOf

50

Functional property

• P is a functional property if, and only if, – it is a property, and – there are no x, y1 and y2 with P(x,y1), P(x,y2 ) and y1y2

Type(?p, FuncProp) (Type(?p, Property) ?r ?v1 ?v2

(PropVal(?p,?r,?v1) PropVal(?p,?r,?v2) ?v1 = ?v2))

• ExampleType(square, FuncProp)

(Type(square, Property) ?r ?v1 ?v2

(PropVal(square,?r,?v1) PropVal(square,?r,?v2) ?v1 = ?v2))

51

Subclass

• subClassOf is a property:

Type(subClassOf, Property)

• If a class C is a subclass of a class C', then all instances of C are also instances of C':

PropVal(subClassOf,?C,?C') (Type(?C, Class) Type(?C', Class) ?x (Type(?x, ?C) Type(?x, ?C')))

– C is a subset of C’– Compare the subclass in OO programming

• ExamplePropVal(subClassOf, professor, staff)

(Type(professor, Class) Type(staff, Class) ?x (Type(?x, professor) Type(?x, staff)))

52

subProperty

• P is a subproperty of P', iff P'(x,y) is true whenever P(x,y) is true:

Type(subPropertyOf,Property)

PropVal(subPropertyOf,?p,?p') (Type(?p,Property) Type(?p',Property) ?r ?v (PropVal(?p,?r,?v) PropVal(?p',?r,?v)))

• ExamplePropVal(subPropertyOf, father, parent)

(Type(father, Property) Type(parent, Property) ?r ?v (PropVal(father,?r,?v) PropVal(parent,?r,?v)))

53

Domain and range

• If the domain of P is D, then for every P(x,y), xD

PropVal(domain, ?p, ?d) ?x ?y (PropVal(?p,?x,?y) Type(?x,?d))

e.g.,

PropVal(domain, length, River) ?x ?y (PropVal(length, ?x, ?y) Type(?x, River))

• If the range of P is R, then for every P(x,y), yR

PropVal(range,?p,?r) ?x ?y (PropVal(?p,?x,?y) Type(?y,?r))

54

Summary of RDF

• RDF provides a foundation for representing and processing metadata

• RDF has a graph-based data model • RDF has an XML-based syntax to support

syntactic interoperability. – XML and RDF complement each other because RDF supports

semantic interoperability

• RDF has a decentralized philosophy and allows incremental building of knowledge, and its sharing and reuse.

55

Summary of RDFS

• RDF Schema provides a mechanism for describing specific domains

• RDF Schema is a primitive ontology language– It offers certain modelling primitives with fixed meaning

• Key concepts of RDF Schema– class, subclass relations– property, subproperty relations, and domain and range

restrictions

• There exist query languages for RDF and RDFS

56

RDF Schema vs XML Schema

• XML Schemas is all about syntax.– An XML Schema tool is intended to validate that an XML

instance conforms to the syntax specified by the XML Schema.

• RDF Schema is all about semantics.– An RDF Schema tool is intended to provide additional facts to

supplement the facts in RDF/XML instances.

57

RDF Schema vs OO

• In OO, properties (attributes) are defined within classes.

• In RDFS, classes and properties are defined separately.

• They are for different purposes

58

UML diagram

The following slides are from Enrico Franconi

59

ER diagram

60

Basic constructs

• A class is a set of instances• A relations/property is a set of pairs of instances

61

A world is described by a set of instances

62

A relational representation

63

Meaning of attribute

64

Meaning of IS-A

65

Meaning of disjointness

66

The meaning of relationship

67

Meaning of cardinality

68

Meaning of the ER (OO) diagram