Chapter 2 Describing Web Resources: RDF

Slides:



Advertisements
Similar presentations
CH-4 Ontologies, Querying and Data Integration. Introduction to RDF(S) RDF stands for Resource Description Framework. RDF is a standard for describing.
Advertisements

RDF Schemata (with apologies to the W3C, the plural is not ‘schemas’) CSCI 7818 – Web Technologies 14 November 2001 Van Lepthien.
CS570 Artificial Intelligence Semantic Web & Ontology 2
Shelley Powers, O’Reilly SNU IDB Lab. Hyewon Kim
RDF Tutorial.
Chapter 3 RDF Syntax 1. Topics Basic concepts of RDF resources, properties, values, statements, triples URIs and URIrefs RDF graphs Literals and Qnames.
Dr. Alexandra I. Cristea RDF.
Chapter 3A Semantic Web Primer 1 Chapter 3 Describing Web Resources in RDF Grigoris Antoniou Frank van Harmelen.
State of the Art in Semantic Web standards and technologies Andreas Duscher.
Knowledge Technologies Manolis Koubarakis 1 An Introduction to RDF Schema.
More RDF CS 431 – Carl Lagoze – Cornell University Acknowledgements: Eric Miller Dieter Fensel.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
The RDF meta model: a closer look Basic ideas of the RDF Resource instance descriptions in the RDF format Application-specific RDF schemas Limitations.
1 Introduction to Semantic Web with XML RDF Dickson K.W. Chiu PhD, SMIEEE Text: Antoniou & van Harmelen: A Semantic Web PrimerA Semantic Web Primer (Chapter.
Cornell CS 502 Resource Description Framework Building the Semantic Web CS 502 – Carl Lagoze – Cornell University Acknowledgements: Eric Miller.
LDK R Logics for Data and Knowledge Representation Resource Description Framework (RDF) Fausto Giunchiglia and Biswanath Dutta Fall’2011.
Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA.
Chapter 3A Semantic Web Primer 1 Chapter 3 Describing Web Resources in RDF Grigoris Antoniou Frank van Harmelen.
Nancy Ide Vassar College USA Resource Definition Framework A Tutorial EUROLAN 2003 July 28 - August 8 Bucharest - Romania.
Chapter 3A Semantic Web Primer 1 Chapter 3 Querying the Semantic Web Grigoris Antoniou Paul Groth Frank van Harmelen Rinke Hoekstra.
Visual Models for Knowledge Engineering Madalina Croitoru
RDF (Resource Description Framework) Why?. XML XML is a metalanguage that allows users to define markup XML separates content and structure from formatting.
Chapter 3 RDF Schema.
Okech Odhiambo Faculty of Information Technology Strathmore University
The Semantic Web Service Shuying Wang Outline Semantic Web vision Core technologies XML, RDF, Ontology, Agent… Web services DAML-S.
INF 384 C, Spring 2009 Ontologies Knowledge representation to support computer reasoning.
Logics for Data and Knowledge Representation
© Copyright 2008 STI INNSBRUCK RDF and RDF Schema Semantic Web Lecture Lecture III – xx 2009 Dieter Fensel Slides.
Of 41 lecture 4: rdf – basics and language. of 41 RDF basic ideas the fundamental concepts of RDF  resources  properties  statements ece 720, winter.
Part I: Set Constructs. RDF Schema (RDFS) RDF does not provide mechanisms to define domain classes and properties RDFS is a vocabulary that provides many.
RDF and XML 인공지능 연구실 한기덕. 2 개요  1. Basic of RDF  2. Example of RDF  3. How XML Namespaces Work  4. The Abbreviated RDF Syntax  5. RDF Resource Collections.
Chapter 3 RDF and RDFS Semantics. Introduction RDF has a very simple data model But it is quite liberal in what you can say Semantics can be given using.
RQL: RDF Query language Jianguo Lu University of Windsor The following slides are from Grigoris Antoniou, Frank van Harmelen, “A Semantic Web Primer”
Turtle – RDF Graph. Turtle – Basic Syntax Triples are terminated with a full stop URLs are encoded in angle brackets ( ) Literals are enclosed by double.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
EEL 5937 Ontologies EEL 5937 Multi Agent Systems Lecture 5, Jan 23 th, 2003 Lotzi Bölöni.
RDF & RDF Schema Machine Understandable Metadata for the Web Semantic Web - Spring 2006 Computer Engineering Department Sharif University of Technology.
Part II. Property domain and range restriction RDFS allows us to put restriction on the properties by specifying their domain and range, providing the.
Of 35 lecture 5: rdf schema. of 35 RDF and RDF Schema basic ideas ece 627, winter ‘132 RDF is about graphs – it creates a graph structure to represent.
RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources.
Introduction The Resource Description Framework (RDF) is recommended by the World Wide Web Consortium (W3C) to model meta-data about the resources of the.
Understanding RDF. 2/30 What is RDF? Resource Description Framework is an XML-based language to describe resources. A common understanding of a resource.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
The RDF meta model Basic ideas of the RDF Resource instance descriptions in the RDF format Application-specific RDF schemas Limitations of XML compared.
Metadata : an overview XML and Educational Metadata, SBU, London, 10 July 2001 Pete Johnston UKOLN, University of Bath Bath, BA2 7AY UKOLN is supported.
Important Concepts from the W3C RDF Vocabulary/Schema Sungtae Kim SNU OOPSLA Lab. August 19, 2004.
Description of Information Resources: RDF/RDFS (an Introduction)
RDF/RDFS Tutorial. Introduction The Resource Description Framework (RDF) is recommended by the World Wide Web Consortium (W3C) to model meta-data about.
Practical RDF Ch.4 Specialized RDF Relationships: Reification, Containers, and Collections Kim, Jong-Nam SNU OOPSLA Lab. August 12, 2004.
Doc.: IEEE /0169r0 Submission Joe Kwak (InterDigital) Slide 1 November 2010 Slide 1 Overview of Resource Description Framework (RFD/XML) Date:
Chapter 3A Semantic Web Primer 1 Chapter 3 Describing Web Resources in RDF Grigoris Antoniou Frank van Harmelen.
Of 38 lecture 6: rdf – axiomatic semantics and query.
Semantic web course – Computer Engineering Department – Sharif Univ. of Technology – Fall RDF & RDF Schema Machine Understandable Metadata for the.
Knowledge Technologies Manolis Koubarakis 1 Some Other Useful Features of RDF.
Chapter 5 The Semantic Web 1. The Semantic Web  Initiated by Tim Berners-Lee, the inventor of the World Wide Web.  A common framework that allows data.
Other RDF Capabilities. Exercise: Write the following information into a set of statements (triples) and then draw them into and RDF graph The article.
Describing Web Resources in RDF Semantic Web. Knowledge Technologies Manolis Koubarakis 2 The Semantic Web “Layer Cake”
The Semantic Web SDBI 2010 Most of the slides are book slides of Semantic Web Primer, by Grigoris Antoniou and Frank van Harmelen.
Linked Data & Semantic Web Technology The Semantic Web Part 7. RDF Semantics Dr. Myungjin Lee.
Setting the stage: linked data concepts Moving-Away-From-MARC-a-thon.
Service-Oriented Computing: Semantics, Processes, Agents
Charlie Abela Department of Intelligent Computer Systems
The Semantic Web By: Maulik Parikh.
Service-Oriented Computing: Semantics, Processes, Agents
Service-Oriented Computing: Semantics, Processes, Agents
Chapter 2 Describing Web Resources: RDF
Introduction to RDF and RDFS Editor: MR3
ece 720 intelligent web: ontology and beyond
Resource Description Framework (RDF)
Semantic Web Basics (cont.)
Presentation transcript:

Chapter 2 Describing Web Resources: RDF Grigoris Antoniou Paul Groth Frank van Harmelen Rinke Hoekstra A Semantic Web Primer

Lecture Outline 2 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 2 Chapter 2 A Semantic Web Primer

Introduction The success of the Web has shown the power of having standard mechanisms to exchange and communicate information HTML is the standard language for writing Web pages It allows anyone to publish a document HTML and any exchange language should have three components: a syntax(语法), a data model(数据模型), and a semantics(语义) The syntax tells us how to write data down The data model tells us the structure/organization of the data The semantics tells us how to interpret that data 3 Chapter 2 A Semantic Web Primer

A Snippet of HTML 4 <html> <head> <title>Apartments for Rent</title> </head> <body> <ol> <li>Studio apartment on Florida Ave <li>3 bedroom Apartment on Baron Way </ol> </html> 4 Chapter 2 A Semantic Web Primer

Syntax, Data Model, and Semantics of HTML The syntax of HTML is text with tags written using angle brackets The data model of HTML is known as the Document Object Model (DOM), and defines the organization of these elements defined by tags into a hierarchical tree structure The semantics of HTML tell us how the browser should interpret the Web page All are defined within HTML standards 5 Chapter 2 A Semantic Web Primer

What does the Semantic Web need? HTML was designed to communicate information about the structure of documents for human readers The Semantic Web needs a data model that can be used by multiple applications needs to be domain-independent The Semantic Web needs a mechanism to assign semantics to the information represented in this data model The Semantic Web needs a syntax 6 Chapter 2 A Semantic Web Primer

Resource Description Framework (RDF) The basic building block of RDF is an entity-property-value(实体-属性-值) triple, called a statement(陈述) Examples include “The Baron Way Apartment is an Apartment”, and “The Baron Way Apartment is part of the Baron Way Building” RDF is domain independent so it is necessary for users to define the terminology they use in these statement This is where the RDF Schema (RDFS) comes in—it allows users to precisely define how their vocabulary should be interpreted 7 Chapter 2 A Semantic Web Primer

A Standard Language for Exchanging Data Together, these technologies define the components of a standard language for exchanging arbitrary data between machines: Turtle/RDFa/RDF-XML – the syntax RDF – the data model RDFS – the semantics Note that RDF is primarily the data model within this language, it is often used as the name for the whole of it 8 Chapter 2 A Semantic Web Primer

Lecture Outline 9 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 9 Chapter 2 A Semantic Web Primer

Resources The fundamental concepts of RDF are resources (资源), properties (属性), statements (陈述), and graphs (图) We can think of a resource as an object, a “thing” we want to talk about E.g. authors, books, publishers, places, people, hotels, etc. Every resource has a URI, a Uniform Resource Identifier and a URI can be a URL (Uniform Resource Locator, or Web address) or another kind of unique identifier 10 Chapter 2 A Semantic Web Primer

URI Schemes URI schemes have been defined not only for Web locations, but also for other unique identifiers e.g. ISBN numbers, telephone numbers, and geographical locations It provides a mechanism to unambiguously identify the “thing” we want to talk about, solving the homonym (一词多义) problem Using dereferencable (解引用的)URIs for resource identifiers is considered good practice, enabling the retrieval of a resource itself or a further description of that resource 11 Chapter 2 A Semantic Web Primer

Dereferencable URI – definition from Wikipedia A dereferencable URI is a resource retrieval mechanism that uses any of the internet protocols (e.g. HTTP) to obtain a copy or representation of the resource it identifies. In the context of traditional HTML web pages, a URI refers to the page, and when requested the web server returns a copy of it. In other non-dereferencable contexts, such as XML Schema, the namespace identifier is still a URI, but this is simply an identifier (i.e. a namespace name). There is no intention that this can or should be dereferenced. In the case of Linked Data, the representation takes the form of a document (typically HTML or XML) that describes the resource that the URI identifies. In either case, the mechanism makes it possible for a user (or software agent) to "follow your nose" to find out more information related to the identified resource. 12 Chapter 2 A Semantic Web Primer

Properties 13 Properties are a special kind of resources They describe relations between resources e.g. “written by”, “age”, “title”, etc. Properties are also identified by URIs We can dereference property URIs to find their descriptions 13 Chapter 2 A Semantic Web Primer

Statements 14 Statements assert the properties of resources A statement is an entity-attribute-value triple (we often use the word subject to refer to the entity and object to refer to its value) It consists of a resource, a property, and a value Values can be resources or literals (文字) Literals are atomic values (strings, numbers, or dates) 14 Chapter 2 A Semantic Web Primer

An Example RDF Statement “Baron Way Building is located in Amsterdam.” We can write this as: <http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayBuilding> <http://dbpedia.org/ontology/location> <http://dbpedia.org/resource/Amsterdam>. 15 Chapter 2 A Semantic Web Primer

Graphs 16 We can write this same statement down graphically Baron Way Building Amsterdam Location We can write this same statement down graphically Labeled nodes are connected by labeled arcs Arcs are directed from subject to object of the statement Labels on the nodes are identifiers of subject and object and labels on the arcs are identifiers of property 16 Chapter 2 A Semantic Web Primer

Graphs The graphical representation highlights the notion that RDF is graph-centric The graph can be expanded with more information and can be created in a distributed fashion by multiple different participants, allowing knowledge to be reused Chapter 2 A Semantic Web Primer

Linked Data Principles A set of best practices encourage us to reuse and make available information to help create a global graph Use URIs as names for things Use HTTP URIs so that people can look up those names When someone looks up a URI, provide useful information using the standards (RDF) Include links to other URIs so that they can discover more things Chapter 2 A Semantic Web Primer

Pointing to Statements and Graphs Sometimes it is useful to be able to point to particular statements and parts of graphs e.g. we may want to say that the statement about the location of the Baron Way Building was created by a person, Frank. One mechanism for doing so is reification (具体化) The key idea is to introduce an auxiliary(辅助)object and relates it to the three components of the original statement through the properties subject, predicate, and object Chapter 2 A Semantic Web Primer

An Example of Reification Frank Location Statement Creator location Amsterdam Baron Way Building subject predicate object Chapter 2 A Semantic Web Primer

Reification Only triples are allowed in RDF, so this rather cumbersome approach is necessary The notion of named graphs(命名图)was introduced in newer versions of RDF An explicit identifier can be given to a statement or a set of statements This identifier can then be referred to in normal triples Chapter 2 A Semantic Web Primer

Dealing with Richer Predicates We can think of a triple (x, P, y) as a logical formula P(x, y) where P is a binary predicate RDF offers only binary predicates(二元谓词) For certain cases in which we may need more than two arguments, we can use binary predicates to simulate such predicates Chapter 2 A Semantic Web Primer

Binary Predicates to Simulate Predicates with Three Arguments The intuitive meaning of broker(X,Y,Z) is X is the broker in a home sale between seller Y and buyer Z We introduce a new auxiliary resource home-sale and binary predicates broker, seller, and buyer broker(X,Y,Z) can be represented as follows: Broker(home-sale, X) Seller(home-sale, Y) Buyer(home-sale, Z) Chapter 2 A Semantic Web Primer

Lecture Outline 24 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 24 Chapter 2 A Semantic Web Primer

RDF Syntaxes 25 We have already introduced a graphical syntax neither machine interpretable nor standardized Terse RDF Triple Language (Turtle) is a standard machine interpretable syntax Text-based syntax for RDF File extension used for Turtle text file is “.ttl” 25 Chapter 2 A Semantic Web Primer

An Example Statement in Turtle <http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayBuilding> <http://dbpedia.org/ontology/location> <http://dbpedia.org/resource/Amsterdam>. URLs are enclosed in angle brackets The subject, predicate, and object appear in order, followed by a period We can write a whole RDF graph using this approach 26 Chapter 2 A Semantic Web Primer

Literals In Turtle, we can write literals down by simply enclosing the values in quotes and appending it with the data type of the value The data type tells us how to interpret a value Data types are expressed as URLs It is recommended to use the data type defined by XML Schema 27 Chapter 2 A Semantic Web Primer

Common Data Types Expressed using Turtle string — “Baron Way” integers — “1”^^<http://www.w3.org/2001/XMLSchema#integer> decimals — “1.23”^^<http://www.w3.org/2001/XMLSchema#decimal> dates — “1982-08-30 ”^^<http://www.w3.org/2001/XMLSchema#date> time — “11:24:00” ^^<http://www.w3.org/2001/XMLSchema#time> date with a time — “1982-08-30T11:24:00” ^^<http://www.w3.org/2001/XMLSchema#dateTime> 28 Chapter 2 A Semantic Web Primer

Using Data Types in Statement Suppose we want to add to our graph that the Baron Way Apartment has three bedrooms <http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayApartment> <http://www.semanticwebprimer.org/ontology/apartments.ttl#hasNumberOfBedrooms> “3”^^<http://www.w3.org/2001/XMLSchema#integer>. 29 Chapter 2 A Semantic Web Primer

Abbreviations In our example, we define resources Baron Way Apartment and Baron Way Building at the same URL http://www.semanticwebprimer.org/ontology/apartments.ttl This URL is the namespace(命名空间)of those resources Turtle takes advantage of this convention(约定)to allow URLs to be abbreviated introducing @prefix syntax to define short stand-ins (qualified names) for particular namespaces 30 Chapter 2 A Semantic Web Primer

Abbreviations @prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>. @prefix dbpedia: <http://dbpedia.org/resource/>. @prefix dbpedia-owl: <http://dbpedia.org/ontology/>. @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. swp:BaronWayApartment swp:hasNumberOfBedrooms “3”^^<xsd:integer>. swp:BaronWayApartment swp:isPartOf swp:BaronWayBuilding. swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam. 31 Chapter 2 A Semantic Web Primer

Abbreviations Turtle allows us not to repeat particular subjects when they are used repeatedly @prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>. @prefix dbpedia: <http://dbpedia.org/resource/>. @prefix dbpedia-owl: <http://dbpedia.org/ontology/>. @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. swp:BaronWayApartment swp:hasNumberOfBedrooms “3”^^<xsd:integer>; swp:isPartOf swp:BaronWayBuilding. swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam. 32 Chapter 2 A Semantic Web Primer

Abbreviations 33 If both a subject and predicate are used repeatedly, @prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>. @prefix dbpedia: <http://dbpedia.org/resource/>. @prefix dbpedia-owl: <http://dbpedia.org/ontology/>. @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. swp:BaronWayApartment swp:hasNumberOfBedrooms “3”^^<xsd:integer>; swp:isPartOf swp:BaronWayBuilding. swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam, dbpedia:Netherlands. 33 Chapter 2 A Semantic Web Primer

Abbreviations 34 Turtle allows us to abbreviate common data types @prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>. @prefix dbpedia: <http://dbpedia.org/resource/>. @prefix dbpedia-owl: <http://dbpedia.org/ontology/>. @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. swp:BaronWayApartment swp:hasNumberOfBedrooms 3; swp:isPartOf swp:BaronWayBuilding. swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam, dbpedia:Netherlands. 34 Chapter 2 A Semantic Web Primer

Named Graphs For example, we might want to say that our statements about the Baron Way Apartments were created by a person, Frank,identified by the URL http://www.cs.vu.nl/~frankh We can put brackets around the set of statements we want and assign a URL to that set of statements 35 Chapter 2 A Semantic Web Primer

An Example of Name Graphs @prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>. @prefix dbpedia: <http://dbpedia.org/resource/>. @prefix dbpedia-owl: <http://dbpedia.org/ontology/>. @dc: <http://purl.org/dc/terms/>. { <http://www.semanticwebprimer.org/ontology/apartments.ttl#> dc: creator <http://www.cs.vu.nl/~frankh>. } default graph 36 Chapter 2 A Semantic Web Primer

An Example of Name Graphs named graph <http://www.semanticwebprimer.org/ontology/apartments.ttl#> { swp:BaronWayApartment swp:hasNumberOfBedrooms 3; swp:isPartOf swp:BaronWayBuilding. swp:BaronWayBuilding dbpedia-owl:location dbpedia:Amsterdam, dbpedia:Netherlands. } 37 Chapter 2 A Semantic Web Primer

RDF/XML 38 RDF/XML is an encoding of RDF in XML language allows RDF to be used with existing XML processing tools Subjects are denoted by the rdf:about within an rdf:Description element <rdf:Description rdf:about=“http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayApartment”> Predicates and objects related to that subject are enclosed in the rdf:Description element 38 Chapter 2 A Semantic Web Primer

An Example of RDF/XML 39 <?xml version=“1.0” encoding=“utf-8”?> <rdf:RDF xmlns:dbpedia-owl=“http://www.dbpedia.org/ontology/” xmlns:dbpedia=“http://dbpedia.org/resource/” xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:swp=“http://www.semanticwebprimer.org/ontology/apartments.ttl#”> <rdf:Description rdf:about=“http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayApartment”> 39 Chapter 2 A Semantic Web Primer

An Example of RDF/XML <swp:hasNumberOfBedrooms rdf:datatype=“http://www.w3.org/2001/XMLSchema#integer”> 3 </swp:hasNumberOfBedrooms> </rdf:Description> <rdf:Description rdf:about=“http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayApartment”> <swp:isPartOf rdf:resource=“http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayBuilding”/> </rdf:RDF> 40 Chapter 2 A Semantic Web Primer

RDFa One use case of RDF is to describe or mark up the content of HTML Web pages RDFa syntax was introduced to make it easier embeds RDF within the attributes of HTML tags We will use an example of advertisement for the Baron Way Apartment 41 Chapter 2 A Semantic Web Primer

Web page without any machine readable description <html> <body> <H1> Baron Way Apartment for Sale </H1> The Baron Way Apartment has three bedrooms and is located in the family friendly Baron Way Building. The Building is located in the north of Amsterdam. </body> </html> 42 Chapter 2 A Semantic Web Primer

Mark up Web page with RDFa <html xmlns:dbpediaowl=“http://www.dbpedia.org/ontology/” xmlns:dbpedia=“http://dbpedia.org/resource/” xmlns:swp=“http://www.semanticwebprimer.org/ontology/apartments.ttl#” xmlns:geo=“http://www.geonames.org/ontology#” > <body> <H1> Baron Way Apartment for Sale </H1> 43 Chapter 2 A Semantic Web Primer

Mark up Web page with RDFa <div about=“[swp:BaronWayApartment]”> The Baron Way Apartment has <span property=“swp:hasNumberOfBedrooms”>3</span> three bedrooms and is located in the family friendly <span rel=“swp:isPartOf” resource=“[swp:BaronWayBuilding]”>Baron Way Building</span>. <div about=“[BaronWayApartment]”> The Baron Way Apartment has <span property=“swp:hasNumberOfBedrooms”>3</span> three bedrooms and is located in the family friendly <span rel=“swp:isPartOf” resource=“[swp:BaronWayBuilding]”>Baron Way Building</span>. 44 Chapter 2 A Semantic Web Primer

Mark up Web page with RDFa <div about=“[swp:BaronWayBuilding]”> The Building is located in the north of Amsterdam. <span rel=“dbpediaowl:location” resource=“[dbpedia:Amsterdam]”></span> <span rel=“dbpediaowl:location” resource=“[dbpedia:Netherlands]”></span> </div> </body> </html> <div about=“[swp:BaronWayBuilding]”> The Building is located in the north of Amsterdam. <span rel=“dbpediaowl:location” resource=“[dbpedia:Amsterdam]”></span> <span rel=“dbpediaowl:location” resource=“[dbpedia:Netherlands]”></span> </div> </body> </html> 45 Chapter 2 A Semantic Web Primer

RDFa 46 RDFa will produce the same RDF as expressed previously RDF is encoded in tags so will not be rendered by browsers In some cases, we use brackets to inform the parser prefixes are being used How to identify the subject, predicate, and object? 46 Chapter 2 A Semantic Web Primer

Lecture Outline 47 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 47 Chapter 2 A Semantic Web Primer

RDF Schema: Adding Semantics RDF is a universal language that lets users describe resources in their own vocabularies RDF does not make assumption about any particular domain, nor does it define semantics of any domain The user can do so in RDF Schema using: classes and properties class hierarchies and inheritance property hierarchies 48 Chapter 2 A Semantic Web Primer

Classes and their Instances When describing a particular domain, we must distinguish between Concrete “things” (individual objects,个体对象) in the domain: Discrete Maths, David Billington etc. Classes that define the type of objects: 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 defined through rdf:type 49 Chapter 2 A Semantic Web Primer

Why Classes are Useful An important use of classes is to impose restrictions on what can be stated in an RDF document using the schema As in programming languages, typing(类型)is used to disallow nonsense from being stated e.g. A + 1, where A is an array The same is needed in RDF 50 Chapter 2 A Semantic Web Primer

Nonsensical Statements disallowed through the Use of Classes Baron Way Apartment rents Jeff Meyer Buildings do not rent people Restriction on values of the property “rents” (range restriction) Amsterdam has the number of bedrooms 3 Cities do not have bedrooms This imposes a restriction on the objects to which the property can be applied (domain restriction) 51 Chapter 2 A Semantic Web Primer

Class Hierarchies 52 Classes can be organized 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, e.g. class A is a subclass of both B1 and B2 52 Chapter 2 A Semantic Web Primer

Class Hierarchy Example Unit Commercial Residential Office Apartment House 53 Chapter 2 A Semantic Web Primer

Inheritance in Class Hierarchies Range restriction: People can only rent residential units Baron Way Apartment is an apartment and does not qualify as a Residential unit --- no statement specifies that it is a residential unit Baron Way Apartment inherits the ability to be rented from the class of residential units This is done in RDF Schema by fixing the semantics of “is a subclass of” 54 Chapter 2 A Semantic Web Primer

Property Hierarchies 55 Hierarchical relationships for properties e.g., “rents” is a subproperty of “resides at” If a person p rents a residential unit r, then p also resides at r The converse is not necessarily true e.g., p may be a child living with a family and not paying rent, or a visitor P is a subproperty(子属性)of Q, if Q(x,y) is true whenever P(x,y) is true 55 Chapter 2 A Semantic Web Primer

RDF Layer vs RDF Schema Layer Consider the RDF statement Jeff Meyer rents the Baron Way Apartment The schema for this statement contain classes such as person, apartments, houses, and units, properties such as rents, resides at, or address The schema is itself written in a formal language, RDF Schema, that can express its ingredients: subClassOf, Class, Property, subPropertyOf, Resource, etc. 56 Chapter 2 A Semantic Web Primer

57 Literal address residesAt Residential rents Unit Apartment House Person domain subPropertyOf Residential Unit Apartment House subClassOf range address Literal Jeff Meyer Baron Way RDFS RDF 57

Lecture Outline 58 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 58 Chapter 2 A Semantic Web Primer

RDF Schema: The Language The modeling primitives(建模原语)of RDF Schema are defined using resources and properties (RDF itself is used!) To declare that “apartment” is a subclass of “residential unit” Define resources apartment, residential unit, and subClassOf Define property subClassOf Write triple (apartment, subClassOf, residential unit) We use one of the standard syntaxes for RDF 59 Chapter 2 A Semantic Web Primer

Core Classes 60 rdfs:Resource, the class of all resources rdfs:Class, the class of all classes rdfs:Literal, the class of all literals (strings) rdf:Property, the class of all properties rdf:Statement, the class of all reified statements 60 Chapter 2 A Semantic Web Primer

Core Properties for Defining Relationships rdf:type, which relates a resource to its class The resource is declared to be an instance of that class rdfs:subClassOf, which relates a class to one of its superclasses All instances of a class are instances of its superclass rdfs:subPropertyOf, relates a property to one of its superproperties 61 Chapter 2 A Semantic Web Primer

Core Properties for Restricting Properties rdfs:domain, which specifies the domain of a property P and states that any resource that have a given property is an instance of the domain classes If the domain is not specified, then any resource can be the subject rdfs:range, which specifies the range of a property P and states that the value of a given property is an instance of the range classes 62 Chapter 2 A Semantic Web Primer

Examples 63 swp:address rdfs:domain swp:Unit. swp:address rdfs:range rdf:Literal. 63 Chapter 2 A Semantic Web Primer

Relationships Between Core Classes and Properties rdfs:subClassOf and rdfs:subPropertyOf are transitive(传递的), by definition rdfs:Class is a subclass of rdfs:Resource Because every class is a resource rdfs:Resource is an instance of rdfs:Class rdfs:Resource is the class of all resources, so it is a class Every class is an instance of rdfs:Class For the same reason 64 Chapter 2 A Semantic Web Primer

Useful Properties for Reification rdf:subject, relates a reified statement to its subject rdf:predicate, relates a reified statement to its predicate rdf:object, relates a reified statement to its object 65 Chapter 2 A Semantic Web Primer

Container Classes rdf:Bag, the class of bags, an unordered container(无序容器), allowing multiple occurrences e.g. members of the faculty board, documents in a folder rdf:Seq, the class of sequences, an ordered(有序) container, which may contain multiple occurrences e.g. modules of a course, items on an agenda, an alphabetized list of staff members (order is imposed) 66 Chapter 2 A Semantic Web Primer

Container Classes 67 rdf:Alt, the class of alternatives(可选项) e.g. the document home and mirrors, translations of a document in various languages rdfs:Container, which is a superclass of all container classes, including the three above 67 Chapter 2 A Semantic Web Primer

Example for a Bag 68 <rdf:Description rdf:ID="949352"> <rdf:type rdf:resource="http://www.mydomain.org/uni- ns#Professor"/> <uni:name>Grigoris Antoniou</uni:name> <uni:coursesTaught> <rdf:Bag> <rdf:_1 rdf:resource="#CIT1112"/> <rdf:_2 rdf:resource="#CIT3116"/> </rdf:Bag> </uni:coursesTaught> </rdf:Description> 68 Chapter 2 A Semantic Web Primer

Example for Alternative <rdf:Description rdf:ID="CIT1111"> <uni:courseName>Discrete Mathematics </uni:courseName> <uni:lecturer> <rdf:Alt> <rdf:li rdf:resource="#949352"/> <rdf:li rdf:resource="#949318"/> </rdf:Alt> </uni:lecturer> </rdf:Description> 69 Chapter 2 A Semantic Web Primer

Utility Properties rdfs:seeAlso relates a resource to another resource that explains it rdfs:isDefinedBy is a subproperty of rdfs:seeAlso and relates a resource to the place where its definition, typically an RDF schema, is found rdfs:comment. Comments, typically longer text, can be associated with a resource rdfs:label. A human-friendly(用户友好) label (name) is associated with a resource 70 Chapter 2 A Semantic Web Primer

Example: Housing @prefix swp: <http://www.semanticwebprimer.org/ontology/apartments.ttl#>. @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. swp:Person rdf:type rdfs:Class. swp:Person rdfs:comment “The class of people”. swp:Unit rdf:type rdfs:Class. swp:Unit rdfs:comment “A self-contained section of accommodations in a larger building or group of buildings.”. 71 Chapter 2 A Semantic Web Primer

Example: Housing 72 swp:ResidentialUnit rdf:type rdfs:Class. Swp:ResidentialUnit rdfs:subClassOf swp:Unit. swp:Unit rdfs:comment “The class of all units or places where people live.”. … swp:residesAt rdf:type rdfs:Property. swp:resideAt rdfs:comment “Relates persons to their residence.”. swp:resideAt rdfs:domain swp:Person. swp:resideAt rdfs:range swp:ResidentialUnit. 72 Chapter 2 A Semantic Web Primer

Example: Housing 73 swp:rents rdf:type rdfs:Property. swp:rents rdfs:comment “It inherits its domain (swp:Person) and range (swp:ResidentialUnit) from its superproperty (swp:resideAt).”. swp:rents rdfs:subPropertyOf swp:resideAt. … 73 Chapter 2 A Semantic Web Primer

Class Hierarchy for the Motor Vehicles Example 74 Chapter 2 A Semantic Web Primer

A Simple Ontology of Motor Vehicles @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. <#miniVan> rdf:type rdfs:Class; rdfs:subClassOf <#passengerVehicle>, <#van>. <#motorVehicle> rdf:type rdfs:Class. <#passengerVehicle> rdf:type rdfs:Class; rdfs:subClassOf <#motorVehicle>. … 75 Chapter 2 A Semantic Web Primer

Lecture Outline 76 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 76 Chapter 2 A Semantic Web Primer

The Namespace of RDF 77 <rdfs:Class rdf:ID="Statement" rdfs:comment="The class of triples consisting of a predicate, a subject and an object (that is, a reified statement)"/> <rdfs:Class rdf:ID="Property" rdfs:comment="The class of properties"/> <rdfs:Class rdf:ID="Bag" rdfs:comment="The class of unordered collections"/> 77 Chapter 2 A Semantic Web Primer

The Namespace of RDF 78 <rdf:Property rdf:ID="predicate" rdfs:comment="Identifies the property of a statement in reified form"/> <rdfs:domain rdf:resource="#Statement"/> <rdfs:range rdf:resource="#Property"/> </rdf:Property> 78 Chapter 2 A Semantic Web Primer

The Namespace of RDF Schema <rdfs:Class rdf:ID="Resource" rdfs:comment="The most general class"/> <rdfs:Class rdf:ID="Class" rdfs:comment="The concept of classes. All classes are resources"/> <rdfs:subClassOf rdf:resource="#Resource"/> </rdfs:Class> 79 Chapter 2 A Semantic Web Primer

The Namespace of RDF Schema <rdf:Property rdf:ID="subPropertyOf"> <rdfs:domain rdf:resource="&rdf;Property"/> <rdfs:range rdf:resource="&rdf;Property"/> </rdf:Property> <rdf:Property rdf:ID="subClassOf"> <rdfs:domain rdf:resource="#Class"/> <rdfs:range rdf:resource="#Class"/> 80 Chapter 2 A Semantic Web Primer

Namespace versus Semantics Consider rdfs:subClassOf The namespace specifies only that it applies to classes and has a class as a value The meaning of being a subclass not expressed The meaning cannot be expressed in RDF document If it could RDF Schema would be unnecessary External definition of semantics required Respected by RDF/RDFS processing software 81 Chapter 2 A Semantic Web Primer

Lecture Outline 82 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 82 Chapter 2 A Semantic Web Primer

Semantics based on Inference Rules RDF has been given a semantics in terms of RDF triples instead of restating RDF in terms of first-order logic … and a sound and complete inference system This inference system consists of inference rules of the form: IF E contains certain triples THEN add to E certain additional triples where E is an arbitrary set of RDF triples 83 Chapter 2 A Semantic Web Primer

Examples of Inference Rules IF E contains the triple (?x,?p,?y) THEN E also contains (?p,rdf:type,rdf:Property) IF E contains the triples (?u,rdfs:subClassOf,?v) and (?v,rdfs:subclassOf,?w) THEN E also contains the triple (?u,rdfs:subClassOf,?w) IF E contains the triples (?x,rdf:type,?u) and (?u,rdfs:subClassOf,?v) THEN E also contains the triple (?x,rdf:type,?v) 84 Chapter 2 A Semantic Web Primer

Examples of Inference Rules IF E contains the triples (?x,?p,?y) and (?p,rdfs:range,?u) THEN E also contains the triple (?y,rdf:type,?u) Any resource ?y which appears as the value of a property ?p can be inferred to be a member of the range of ?p This shows that range definitions in RDF Schema are not used to restrict the range of a property, but rather to infer the membership of the range 85 Chapter 2 A Semantic Web Primer

Lecture Outline 86 Introduction RDF: Data Model RDF Syntaxes RDFS: Adding Semantics RDF Schema: The Language RDF and RDF Schema in RDF Schema A Direct Inference System for RDF and RDFS Summary 86 Chapter 2 A Semantic Web Primer

Summary RDF provides a foundation for representing and processing machine readable metadata RDF has a graph-based data model RDF has three standard syntaxes (Turtle, RDF/XML, and RDFa) to support syntactic interoperability RDF has a decentralized philosophy and allows incremental building of knowledge, and its sharing and reuse 87 Chapter 2 A Semantic Web Primer

Summary 88 RDF is domain-independent - RDF Schema provides a mechanism for describing specific domains RDF Schema is a primitive ontology language It offers certain modeling primitives with fixed meaning Key concepts of RDF Schema are class, subclass relations, property, subproperty relations, and domain and range restrictions 88 Chapter 2 A Semantic Web Primer

Points for Discussion in Subsequent Chapters RDF Schema is quite primitive as a modeling language for the Web Many desirable modeling primitives are missing Therefore we need an ontology layer on top of RDF and RDF Schema 89 Chapter 2 A Semantic Web Primer