1 / 89

Chapter 2 Describing Web Resources : RDF

Chapter 2 Describing Web Resources : RDF. Grigoris Antoniou Paul Groth Frank van Harmelen Rinke Hoekstra. Lecture Outline. Introduction RDF : Data Model RDF Syntaxes RDFS : Adding Semantics RDF Schema : The Language RDF and RDF Schema in RDF Schema

Download Presentation

Chapter 2 Describing Web Resources : RDF

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Lecture Outline • 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 A Semantic Web Primer

  3. 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 A Semantic Web Primer

  4. 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> 4 A Semantic Web Primer

  5. 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 A Semantic Web Primer

  6. What does the Semantic Web need? • HTML was designed to communication 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 A Semantic Web Primer

  7. 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

  8. 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

  9. Lecture Outline 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

  10. 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 A Semantic Web Primer

  11. 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 dereferenceable 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

  12. Dereferenceable URI – definition from Wikipedia 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. 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-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. 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

  13. Properties • 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 A Semantic Web Primer

  14. Statements • 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 A Semantic Web Primer

  15. 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

  16. Graphs Amsterdam Baron Way Building 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

  17. 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

  18. 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

  19. 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

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

  21. 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

  22. 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

  23. 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

  24. Lecture Outline 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

  25. RDF Syntaxes • 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 A Semantic Web Primer

  26. 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 A Semantic Web Primer

  27. 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 A Semantic Web Primer

  28. 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

  29. 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 A Semantic Web Primer

  30. 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 A Semantic Web Primer

  31. 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

  32. 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

  33. 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.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

  34. 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.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

  35. Name 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

  36. 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

  37. An Example of Name Graphs <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. } named graph 37 Chapter 2 A Semantic Web Primer

  38. RDF/XML • 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 A Semantic Web Primer

  39. 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.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:swp=“http://www.semanticwebprimer.org/ontology/apartments.ttl#”> <rdf:Descriptionrdf:about=“http://www.semanticwebprimer.org/ontology/apartments.ttl#BaronWayApartment”> 39 Chapter 2 A Semantic Web Primer

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

  41. 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

  42. 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

  43. 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/apartments.ttl#”> xmlns:geo=“http://www.geonames.org/ontology#”> > <body> <H1> Baron Way Apartment for Sale </H1> 43 Chapter 2 A Semantic Web Primer

  44. 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>. 44 Chapter 2 A Semantic Web Primer

  45. 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> </div> </body> </html> 45 Chapter 2 A Semantic Web Primer

  46. RDFa 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

  47. Lecture Outline 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

  48. 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 A Semantic Web Primer

  49. 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. • Classesthat 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 A Semantic Web Primer

  50. 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 A Semantic Web Primer

More Related