5b7e3b8fbb1bd5637d356f1c7dcc3f22.ppt
- Количество слайдов: 93
Chapter 2 Describing Web Resources: RDF Grigoris Antoniou Paul Groth Frank van Harmelen Rinke Hoekstra A Semantic Web Primer
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 2 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
Introduction l The success of the Web has shown the power of having standard mechanisms to exchange and communicate information – – 3 HTML is the standard language for writing Web pages It allows anyone to publish a document Chapter 2 A Semantic Web Primer
Introduction l HTML and any exchange language should have three components: a syntax, a data model, and a semantics – – The data model tells us the structure/organization of the data – 4 The syntax tells us how to write data down The semantics tells us how to interpret that data Chapter 2 A Semantic Web Primer
A Snippet(片断)of HTML <html> <head> <title>Apartments for Rent</title> </head> <body> <ol> <li>Studio apartment on Florida Ave <li>3 bedroom Apartment on Baron Way </ol> <body> </html> 5 Chapter 2 A Semantic Web Primer
Syntax, Data Model, and Semantics of HTML l l 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 l The semantics of HTML tell us how the browser should interpret the Web page l 6 The syntax of HTML is text with tags written using angle brackets(尖括号) All are defined within HTML standards Chapter 2 A Semantic Web Primer
What does the Semantic Web need? l HTML was designed to communicate information about the structure of documents for human readers l The Semantic Web needs a data model that – – can be used by multiple applications needs to be domain-independent(与特定领域无关的) l 7 The Semantic Web needs a mechanism to assign semantics to the information represented in this data model l The Semantic Web needs a syntax Chapter 2 A Semantic Web Primer
Resource Description Framework (RDF) l The basic building block of RDF is an entity-propertyvalue 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” l l 8 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 Chapter 2 A Semantic Web Primer
A Standard Language for Exchanging Data l Together, these technologies define the components of a standard language for exchanging arbitrary data between machines: – – 9 RDF – the data model – l Turtle/RDFa/RDF-XML – the syntax 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 Chapter 2 A Semantic Web Primer
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 10 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
Resources l The fundamental(重要的)concepts of RDF are resources(资源), properties(属性), statements (陈述), and graphs(图) l We can think of a resource as an object, a “thing” we want to talk about – 11 E. g. authors, books, publishers, places, people, hotels, etc. Chapter 2 A Semantic Web Primer
Resources l Every resource has a URI, a Uniform Resource Identifier(统一资源标识符)and a URI can be – – l a URL (Uniform Resource Locator, or Web address) or another kind of unique(唯一的)identifier URI schemes(方案)have been defined not only for Web locations, but also for other unique identifiers – 12 e. g. ISBN numbers, telephone numbers, and geographical locations Chapter 2 A Semantic Web Primer
URI Schemes l l 13 The URI scheme provides a mechanism to unambiguously(清楚地)identify the “thing” we want to talk about, solving the homonym(同音异义 字)problem,例如light(光或轻的)、vain(徒劳的) 和vein(静脉) Using dereferenceable URIs for resource identifiers is considered good practice, enabling the retrieval of a resource itself or a further description of that resource Chapter 2 A Semantic Web Primer
Dereferenceable URI – definition from Wikipedia l A dereferenceable(可解引用的)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. l In the context of traditional HTML web pages, a URI refers to the page, and when requested the web server 14 returns a copy of it,e. g. http: //by. cuc. edu. cn Chapter 2 A Semantic Web Primer
Dereferenceable URI – definition from Wikipedia l In other non-dereferenceable 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, e. g. <h: table> 15 Chapter 2 A Semantic Web Primer
Dereferenceable URI – definition from Wikipedia l 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. 16 Chapter 2 A Semantic Web Primer
Properties l l They describe relations between resources – e. g. “written by”, “age”, “title”, etc. l Properties are also identified by URIs l 17 Properties are a special kind of resources We can dereference property URIs to find their descriptions Chapter 2 A Semantic Web Primer
Statements l Statements assert(断言)the properties of resources l 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) – l Values can be resources or literals(文字类型) – 18 It consists of a resource, a property, and a value Literals are atomic values (strings, numbers, or dates) 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#Baron Way. Building> <http: //dbpedia. org/ontology/location> <http: //dbpedia. org/resource/Amsterdam>. 19 Chapter 2 A Semantic Web Primer
Graphs Baron Way Building Location Amsterdam We can write this same statement down graphically – – Arcs are directed from subject to object of the statement – 20 Labeled nodes are connected by labeled arcs Labels on the nodes are identifiers of subject and object and labels on the arcs are identifiers of property Chapter 2 A Semantic Web Primer
Graphs l l 21 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 l A set of best practices encourage us to reuse and make available information to help create a global graph – – Use HTTP URIs so that people can look up those names – When someone looks up a URI, provide useful information using the standards (RDF) – 22 Use URIs as names for things Include links to other URIs so that they can discover more things Chapter 2 A Semantic Web Primer
Pointing to Statements and Graphs l 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. l One mechanism for doing so is reification(具体化) – 23 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 Creator Location Statement subject object predicate Baron Way Building 24 Chapter 2 location Amsterdam A Semantic Web Primer
Reification l l The notion of named graphs(命名图)was introduced in newer versions of RDF l An explicit identifier can be given to a statement or a set of statements l 25 Only triples are allowed in RDF, so this rather cumbersome(繁杂的、不方便的)approach is necessary This identifier can then be referred to in normal triples Chapter 2 A Semantic Web Primer
Dealing with Richer Predicates l l RDF offers only binary predicates l 26 We can think of a triple (x, P, y) as a logical formula (逻辑公式) P(x, y) where P is a binary predicate( 二元谓词) 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 l The intuitive meaning of broker(X, Y, Z) is X is the broker in a home sale between seller Y and buyer Z l We introduce a new auxiliary resource home-sale and binary predicates broker, seller, and buyer l broker(X, Y, Z) can be represented as follows: – – Seller(home-sale, Y) – 27 Broker(home-sale, X) Buyer(home-sale, Z) Chapter 2 A Semantic Web Primer
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 28 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
RDF Syntaxes l We have already introduced a graphical syntax – neither machine interpretable nor standardized l Terse RDF Triple Language (Turtle) is a standard machine interpretable syntax – – 29 Text-based syntax for RDF File extension used for Turtle text file is “. ttl” Chapter 2 A Semantic Web Primer
An Example Statement in Turtle <http: //www. semanticwebprimer. org/ontology/apartments. ttl#Baron Way. Building> <http: //dbpedia. org/ontology/location> <http: //dbpedia. org/resource/Amsterdam>. l l The subject, predicate, and object appear in order, followed by a period l 30 URLs are enclosed in angle brackets We can write a whole RDF graph using this approach Chapter 2 A Semantic Web Primer
Literals l l The data type tells us how to interpret a value l Data types are expressed as URLs l 31 In Turtle, we can write literals down by simply enclosing the values in quotes and appending it with the data type of the value It is recommended to use the data type defined by XML Schema Chapter 2 A Semantic Web Primer
Common Data Types Expressed using Turtle string — “Baron Way” integers — “ 1”^^<http: //www. w 3. org/2001/XMLSchema#integer> decimals — “ 1. 23”^^<http: //www. w 3. org/2001/XMLSchema#decimal> dates — “ 1982 -08 -30 ”^^<http: //www. w 3. org/2001/XMLSchema#date> time — “ 11: 24: 00” ^^<http: //www. w 3. org/2001/XMLSchema#time> date with a time — “ 1982 -08 -30 T 11: 24: 00” ^^<http: //www. w 3. org/2001/XMLSchema#date. Time> 32 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#Bar on. Way. Apartment> <http: //www. semanticwebprimer. org/ontology/apartments. ttl#has Number. Of. Bedrooms> “ 3”^^<http: //www. w 3. org/2001/XMLSchema#integer>. 33 Chapter 2 A Semantic Web Primer
Abbreviations l In our example, we define resources Baron Way Apartment and Baron Way Building at the same URL http: //www. semanticwebprimer. org/ontology/apartme nts. ttl l This URL is the namespace of those resources l Turtle takes advantage of this convention to allow URLs to be abbreviated – 34 introducing @prefix syntax to define short stand-ins (qualified names) for particular namespaces 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. w 3. org/2001/XMLSchema#>. swp: Baron. Way. Apartment swp: has. Number. Of. Bedrooms “ 3”^^<xsd: integer>. swp: Baron. Way. Apartment swp: is. Part. Of swp: Baron. Way. Building dbpedia-owl: location dbpedia: Amsterdam. 35 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. w 3. org/2001/XMLSchema#>. swp: Baron. Way. Apartment swp: has. Number. Of. Bedrooms “ 3”^^<xsd: integer>; swp: is. Part. Of swp: Baron. Way. Building dbpedia-owl: location dbpedia: Amsterdam. 36 Chapter 2 A Semantic Web Primer
Abbreviations 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. w 3. org/2001/XMLSchema#>. swp: Baron. Way. Apartment swp: has. Number. Of. Bedrooms “ 3”^^<xsd: integer>; swp: is. Part. Of swp: Baron. Way. Building dbpedia-owl: location dbpedia: Amsterdam, dbpedia: Netherlands. 37 Chapter 2 A Semantic Web Primer
Abbreviations 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. w 3. org/2001/XMLSchema#>. swp: Baron. Way. Apartment swp: has. Number. Of. Bedrooms 3; swp: is. Part. Of swp: Baron. Way. Building dbpedia-owl: location dbpedia: Amsterdam, dbpedia: Netherlands. 38 Chapter 2 A Semantic Web Primer
Named Graphs l l 39 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 Chapter 2 A Semantic Web Primer
An Example of Named 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/>. { default graph <http: //www. semanticwebprimer. org/ontology/apartments. ttl#> dc: creator <http: //www. cs. vu. nl/~frankh>. } 40 Chapter 2 A Semantic Web Primer
An Example of Named Graphs named graph <http: //www. semanticwebprimer. org/ontology/apartments. ttl#> { swp: Baron. Way. Apartment swp: has. Number. Of. Bedrooms 3; swp: is. Part. Of swp: Baron. Way. Building dbpedia-owl: location dbpedia: Amsterdam, dbpedia: Netherlands. } 41 Chapter 2 A Semantic Web Primer
RDF/XML l RDF/XML is an encoding of RDF in XML language – l Subjects are denoted by the rdf: about within an rdf: Description element – l 42 allows RDF to be used with existing XML processing tools <rdf: Description rdf: about=“http: //www. semanticwebprimer. org/ontology/apar tments. ttl#Baron. Way. Apartment”> Predicates and objects related to that subject are enclosed in the rdf: Description element Chapter 2 A Semantic Web Primer
An Example of RDF/XML <? 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. w 3. 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#Baro n. Way. Apartment”> 43 Chapter 2 A Semantic Web Primer
An Example of RDF/XML <swp: has. Number. Of. Bedrooms rdf: datatype=“http: //www. w 3. org/2001/XMLSchema#integer”> 3 </swp: has. Number. Of. Bedrooms> </rdf: Description> <rdf: Description rdf: about=“http: //www. semanticwebprimer. org/ontology/apartments. ttl#Ba ron. Way. Apartment”> <swp: is. Part. Of rdf: resource=“http: //www. semanticwebprimer. org/ontology/apartments. ttl #Baron. Way. Building”/> </rdf: Description> </rdf: RDF> 44 Chapter 2 A Semantic Web Primer
RDFa l One use case of RDF is to describe or mark up the content of HTML Web pages l RDFa syntax was introduced to make it easier – l 45 embeds RDF within the attributes of HTML tags We will use an example of advertisement for the Baron Way Apartment Chapter 2 A Semantic Web Primer
Web page without any machine readable description <html> <body> <H 1> Baron Way Apartment for Sale </H 1> 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> 46 Chapter 2 A Semantic Web Primer
Mark up Web page with RDFa <html xmlns: dbpedia-owl=“http: //www. dbpedia. org/ontology/” xmlns: dbpedia=“http: //dbpedia. org/resource/” xmlns: swp=“http: //www. semanticwebprimer. org/ontology/apartm ents. ttl#”> xmlns: geo=“http: //www. geonames. org/ontology#”> > <body> <H 1> Baron Way Apartment for Sale </H 1> 47 Chapter 2 A Semantic Web Primer
Mark up Web page with RDFa <div about=“[swp: Baron. Way. Apartment]”> The Baron Way Apartment has <span property=“swp: has. Number. Of. Bedrooms”>3</span> three bedrooms and is located in the family friendly <span rel=“swp: is. Part. Of” resource=“[swp: Baron. Way. Building]”>Baron Way Building</span>. 48 Chapter 2 A Semantic Web Primer
Mark up Web page with RDFa <div about=“[swp: Baron. Way. Building]”> 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> 49 Chapter 2 A Semantic Web Primer
RDFa l l RDF is encoded in tags so will not be rendered by browsers l In some cases, we use brackets to inform the parser prefixes are being used l 50 RDFa will produce the same RDF as expressed previously How to identify the subject, predicate, and object? Chapter 2 A Semantic Web Primer
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 51 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
RDF Schema: Adding Semantics l RDF is a universal language that lets users describe resources in their own vocabularies – l 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: – – 52 classes and properties class hierarchies(层次)and inheritance(继承) – property hierarchies Chapter 2 A Semantic Web Primer
Classes and their Instances l 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. l l 53 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 Chapter 2 A Semantic Web Primer
Why Classes are Useful l 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 – – 54 e. g. A + 1, where A is an array The same is needed in RDF Chapter 2 A Semantic Web Primer
Nonsensical Statements disallowed through the Use of Classes l Baron Way Apartment rents Jeff Meyer – – l Amsterdam has the number of bedrooms 3 – – 55 Buildings do not rent people Restriction on values of the property “rents” (range restriction,值域限制) Cities do not have bedrooms This imposes a restriction on the objects to which the property can be applied (domain restriction, 定义域限制) Chapter 2 A Semantic Web Primer
Class Hierarchies l Classes can be organized in hierarchies – – l l 56 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 B 1 and B 2 Chapter 2 A Semantic Web Primer
Class Hierarchy Example Unit Commercial Unit Office 57 Residential Unit Apartment Chapter 2 House A Semantic Web Primer
Inheritance in Class Hierarchies l l Baron Way Apartment is an apartment and does not qualify as a Residential unit --- no statement specifies that it is a residential unit l Baron Way Apartment inherits the ability to be rented from the class of residential units l 58 Range restriction: People can only rent residential units This is done in RDF Schema by fixing the semantics of “is a subclass of” Chapter 2 A Semantic Web Primer
Property Hierarchies l Hierarchical relationships for properties – – l The converse is not necessarily true – – l 59 e. g. , “rents” is a subproperty of “resides at” If a person p rents a residential unit r, then p also resides at r 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 Chapter 2 A Semantic Web Primer
RDF Layer vs RDF Schema Layer l l l 60 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: – sub. Class. Of, Class, Property, sub. Property. Of, Resource, etc. Chapter 2 A Semantic Web Primer
Literal range address domain resides. At range sub. Property. Of Person domain rents Unit sub. Class. Of range sub. Class. Of Apartment Residential Unit sub. Class. Of House RDFS RDF Jeff Meyer 61 rents Baron Way Apartment
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 62 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
RDF Schema: The Language l The modeling primitives(建模原语)of RDF Schema are defined using resources and properties (RDF itself is used!) l To declare that “apartment” is a subclass of “residential unit” – – – 63 l Define resources apartment, residential unit, and sub. Class. Of Define property sub. Class. Of (属性是特殊的资源!) Write triple (apartment, sub. Class. Of, residential unit) We use one of the standard syntaxes for RDF Chapter 2 A Semantic Web Primer
Core Classes l l rdfs: Class, the class of all classes l rdfs: Literal, the class of all literals (strings) l rdf: Property, the class of all properties l 64 rdfs: Resource, the class of all resources rdf: Statement, the class of all reified statements Chapter 2 A Semantic Web Primer
Core Properties for Defining Relationships l rdf: type, which relates a resource to its class – l rdfs: sub. Class. Of, which relates a class to one of its superclasses – l 65 The resource is declared to be an instance of that class All instances of a class are instances of its superclass rdfs: sub. Property. Of, relates a property to one of its superproperties Chapter 2 A Semantic Web Primer
Core Properties for Restricting Properties l rdfs: domain, which specifies the domain(定义域) of a property P – – l rdfs: range, which specifies the range(值域)of a property P – 66 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 and states that the value of a given property is an instance of the range classes Chapter 2 A Semantic Web Primer
Examples swp: address rdfs: domain swp: Unit. swp: address rdfs: range rdf: Literal. 67 Chapter 2 A Semantic Web Primer
Relationships Between Core Classes and Properties l rdfs: sub. Class. Of and rdfs: sub. Property. Of are transitive(传递的), by definition l rdfs: Class is a subclass of rdfs: Resource – l rdfs: Resource is an instance of rdfs: Class – l rdfs: Resource is the class of all resources, so it is a class Every class is an instance of rdfs: Class – 68 Because every class is a resource For the same reason Chapter 2 A Semantic Web Primer
Useful Properties for Reification l l rdf: predicate, relates a reified statement to its predicate l 69 rdf: subject, relates a reified statement to its subject rdf: object, relates a reified statement to its object Chapter 2 A Semantic Web Primer
Container(容器)Classes l rdf: Bag, the class of bags, an unordered container (无序容器), allowing multiple occurrences – l rdf: Seq, the class of sequences, an ordered container (有序容器), which may contain multiple occurrences – 70 e. g. members of the faculty board, documents in a folder e. g. modules of a course, items on an agenda, an alphabetized list of staff members (order is imposed) Chapter 2 A Semantic Web Primer
Container Classes l rdf: Alt, the class of alternatives – l 71 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 Chapter 2 A Semantic Web Primer
Example for a Bag <rdf: Description rdf: ID="949352"> <rdf: type rdf: resource="http: //www. mydomain. org/unins#Professor"/> <uni: name>Grigoris Antoniou</uni: name> <uni: courses. Taught> <rdf: Bag> <rdf: _1 rdf: resource="#CIT 1112"/> <rdf: _2 rdf: resource="#CIT 3116"/> </rdf: Bag> </uni: courses. Taught> </rdf: Description> 72 Chapter 2 A Semantic Web Primer
Example for Alternative <rdf: Description rdf: ID="CIT 1111"> <uni: course. Name>Discrete Mathematics </uni: course. Name> <uni: lecturer> <rdf: Alt> <rdf: li rdf: resource="#949352"/> <rdf: li rdf: resource="#949318"/> </rdf: Alt> </uni: lecturer> </rdf: Description> 73 Chapter 2 A Semantic Web Primer
Utility(实用)Properties l l rdfs: is. Defined. By is a subproperty of rdfs: see. Also and relates a resource to the place where its definition, typically an RDF schema, is found l rdfs: comment. Comments, typically longer text, can be associated with a resource l 74 rdfs: see. Also relates a resource to another resource that explains it rdfs: label. A human-friendly label (name) is associated with a resource Chapter 2 A Semantic Web Primer
Example: Housing @prefix swp: <http: //www. semanticwebprimer. org/ontology/apartments. ttl#>. @prefix rdf: <http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#>. @prefix rdfs: <http: //www. w 3. 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. ”. 75 Chapter 2 A Semantic Web Primer
Example: Housing swp: Residential. Unit rdf: type rdfs: Class. Swp: Residential. Unit rdfs: sub. Class. Of swp: Unit rdfs: comment “The class of all units or places where people live. ”. … swp: resides. At rdf: type rdfs: Property. swp: reside. At rdfs: comment “Relates persons to their residence. ”. swp: reside. At rdfs: domain swp: Person. swp: reside. At rdfs: range swp: Residential. Unit. 76 Chapter 2 A Semantic Web Primer
Example: Housing swp: rents rdf: type rdfs: Property. swp: rents rdfs: comment “It inherits domain (swp: Person) and range (swp: Residential. Unit) from its superproperty (swp: reside. At). ”. swp: rents rdfs: sub. Property. Of swp: reside. At. … 77 Chapter 2 A Semantic Web Primer
Class Hierarchy for the Motor Vehicles Example 78 Chapter 2 A Semantic Web Primer
A Simple Ontology of Motor Vehicles @prefix rdf: <http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#>. @prefix rdfs: <http: //www. w 3. org/2000/01/rdf-schema#>. <#mini. Van> rdf: type rdfs: Class; rdfs: sub. Class. Of <#passenger. Vehicle>, <#van>. <#motor. Vehicle> rdf: type rdfs: Class. <#passenger. Vehicle> rdf: type rdfs: Class; rdfs: sub. Class. Of <#motor. Vehicle>. … 79 Chapter 2 A Semantic Web Primer
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 80 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
The Namespace of RDF <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"/> 81 Chapter 2 A Semantic Web Primer
The Namespace of RDF <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> 82 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: sub. Class. Of rdf: resource="#Resource"/> </rdfs: Class> 83 Chapter 2 A Semantic Web Primer
The Namespace of RDF Schema <rdf: Property rdf: ID="sub. Property. Of"> <rdfs: domain rdf: resource="&rdf; Property"/> <rdfs: range rdf: resource="&rdf; Property"/> </rdf: Property> <rdf: Property rdf: ID="sub. Class. Of"> <rdfs: domain rdf: resource="#Class"/> <rdfs: range rdf: resource="#Class"/> </rdf: Property> 84 Chapter 2 A Semantic Web Primer
Namespace versus Semantics l Consider rdfs: sub. Class. Of – – l 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 l External definition of semantics required – 85 Respected by RDF/RDFS processing software Chapter 2 A Semantic Web Primer
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 86 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
Semantics based on Inference Rules l l … and a sound and complete inference system l 87 RDF has been given a semantics in terms of RDF triples instead of restating RDF in terms of first-order logic 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 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: sub. Class. Of, ? v) and (? v, rdfs: subclass. Of, ? w) THEN E also contains the triple (? u, rdfs: sub. Class. Of, ? w) 88 IF E contains the triples (? x, rdf: type, ? u) and (? u, rdfs: sub. Class. Of, ? v) THEN E also contains the triple (? x, rdf: type, ? v) 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) l Any resource ? y which appears as the value of a property ? p can be inferred to be a member of the range of ? p – 89 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 Chapter 2 A Semantic Web Primer
Lecture Outline 1. 2. RDF: Data Model 3. RDF Syntaxes 4. RDFS: Adding Semantics 5. RDF Schema: The Language 6. RDF and RDF Schema in RDF Schema 7. 90 Introduction A Direct Inference System for RDF and RDFS 8. Summary Chapter 2 A Semantic Web Primer
Summary l l RDF has a graph-based data model l RDF has three standard syntaxes (Turtle, RDF/XML, and RDFa) to support syntactic interoperability l 91 RDF provides a foundation for representing and processing machine readable metadata RDF has a decentralized philosophy and allows incremental building of knowledge, and its sharing and reuse Chapter 2 A Semantic Web Primer
Summary l RDF is domain-independent - RDF Schema provides a mechanism for describing specific domains l RDF Schema is a primitive ontology language – l 92 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 Chapter 2 A Semantic Web Primer
Points for Discussion in Subsequent Chapters l l Many desirable modeling primitives are missing l 93 RDF Schema is quite primitive as a modeling language for the Web Therefore we need an ontology layer on top of RDF and RDF Schema Chapter 2 A Semantic Web Primer
5b7e3b8fbb1bd5637d356f1c7dcc3f22.ppt