Presentation on theme: "RDFS: Resource Description Framework Schema slides are borrowed from Costello."— Presentation transcript:
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 Ocean Lake BodyOfWater River Stream Properties: length: Literal emptiesInto: BodyOfWater Sea NaturallyOccurringWaterSource Tributary Brook Rivulet RDF S motivation
4 What inferences can be made on this RDF/XML, given the taxonomy on the last slide? 6300 kilometers Inferences are made by examining a taxonomy that contains River. See next slide. RDF S motivation
5 Ocean Lake BodyOfWater River Stream Properties: length: Literal emptiesInto: BodyOfWater Sea NaturallyOccurringWaterSource TributaryBrook Inference Engine Inferences: - Yangtze is a Stream - Yangtze is an NaturallyOcurringWaterSource - is a BodyOfWater Yangtze.rdf Rivulet 6300 kilometers RDF S motivation
6 How does a taxonomy facilitate searching? Ocean Lake BodyOfWater River Stream Properties: length: Literal emptiesInto: BodyOfWater Sea NaturallyOccurringWaterSource Tributary Brook The taxonomy shows that when searching for "streams", any RDF/XML that uses the class Brook, Rivulet, River, or Tributary are relevant. See next slide. Rivulet RDF S motivation
7 Ocean Lake BodyOfWater River Stream Properties: length: Literal emptiesInto: BodyOfWater Sea NaturallyOccurringWaterSource TributaryBrook 6300 kilometers Search Engine 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 RDF S motivation
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) ... 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 and properties are defined within rdf:RDF Defines the River class Defines the Stream 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 the taxonomy! 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. Name of the class equivalent
12 rdfs:subClassOf is transitive Ocean Lake 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 ... 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 BodyOfWater emptiesInto 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. Name of the property ANDed equivalent
15 Properties can have multiple domain and range BodyOfWater range CoastalWater - the value of emptiesInto is a BodyOfWater and a CoastalWater.
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 ...
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 6300 kilometers 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 emptiesInto have a rdfs:domain of River, i.e., their domain asserts that these properties will be used in a River instance.
23 WaterResource Taxonomy Levee Dam WaterwayObstacle Ocean Lake BodyOfWater River Stream Properties: length: Literal emptiesInto: BodyOfWater obstacle: Sea NaturallyOccurringWaterSource Tributary Brook Rivulet
24 Defining the obstacle 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 type 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? Y angtze.rdf 6300 kilometers What inferences can be made about Yangtze, EsatChinaSea, and ThreeGorges? Inferences are made by examining the taxonomies that contains River and Dam.
26 Ocean Lake BodyOfWater River Stream Properties: length: Literal emptiesInto: BodyOfWater obstacle: Sea NaturallyOcurringWaterSource TributaryBrook 6300 kilometers Inference Engine Inferences: - Yangtze is a Stream - Yangtze is an NaturallyOcurringWaterSource - is a BodyOfWater - is a Dam Yangtze.rdf Rivulet Levee Dam WaterwayObstacle
27 Untyped resource 6300 kilometers 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). untyped resource
28 Defining length with no Type Information ... No rdfs:range specified. This means that we are providing no information on the type of value that length 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! 6300 kilometers There is no type shown for this resource. But that doesn't mean that this resource has no type. It only means that no type has been specified in this RDF/XML instance. In the RDF Schema we can specify what its type is. Advantage: now we can infer that the contents of length is of type Distance.
30 This RDF Schema: Does not mandate that the RDF/XML instance specify a type, e.g., 6300 kilometers It is perfectly fine to keep that class information isolated to the RDF Schema, e.g., 6300 kilometers (However, it is better practice to expose the type information in the RDF/XML instance.) Best Practice
31 Create RDF Schema for an RDF document Yangtze.rdf The River class has three properties containing typed literals. u om.xsd The referenced xml schema datatypes in Yangtze.rdf
33 Classes inherit properties from their ancestors Ocean Lake BodyOfWater River Stream Properties: emptiesInto: BodyOfWater obstacle: Sea NaturallyOccurringWaterSource Tributary Brook Rivulet Properties: length: Literal length has been defined to be a property of Stream. Therefore, all Stream subclasses inherit the length property. Note that the properties emptiesInto and 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 ... 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 6300 kilometers 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" 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 range to Sea. The property emptiesInto permits a range of BodyOfWater. This property, however, narrows the range to Sea.
41 rdfs:label, rdfs:comment Author/Creator 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: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 Lateral Thinking Edward de Bono 1973 Harper & Row Illusions: The Adventures of a Reluctant Messiah Richard Bach 1977 Dell Publishing Co.... Barnes_and_Noble_BookCatalogue.rdf Create an RDF Schema for the following RDF/XML instance:
43 Answer: ... PublishingOntology.rdfs
44 From 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) Subclass relationship Instance relationship
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)
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 y1 y2 Type(?p, FuncProp) (Type(?p, Property) ?r ?v1 ?v2 (PropVal(?p,?r,?v1) PropVal(?p,?r,?v2) ?v1 = ?v2 )) Example Type(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 Example PropVal(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))) Example PropVal(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), x D 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), y R 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