29
Copyright 2007 Digital Enterprise Research Institute. All rights reserved. www.deri.org Digital Enterprise Research Institute www.deri.ie RDFa: putting RDF on the Web [email protected] 1

RDFa: putting RDF on the Web

Embed Size (px)

DESCRIPTION

These slides explain (1) the motivation for using RDFa, for embedding structured data on web pages, (2) RDF as the foundation of RDFa, and (3) RDFa through examples.

Citation preview

Page 1: RDFa: putting RDF on the Web

Chapter Copyright 2007 Digital Enterprise Research Institute. All rights reserved. www.deri.org

Digital Enterprise Research Institute www.deri.ie

RDFa: putting RDF on the Web

[email protected]

1

Page 2: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Overview

Part 1: MotivationUse case for embedding RDF on XHTML pages

Bonus: Explaining “what do I do?” at a Christmas party

Part 2: The foundation: RDF in a nutshelldata model

formal semantics

Part 3: RDFa with examplesthe RDFa attributes

visible and invisible embedding

handle with care: CURIEs and implicit blank nodes

tools for consuming and publishing RDFa

2

Page 3: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

About me

Research interest: bringing the Semantic Web to the IT mainstream by applying software engineering methodologies

currently looking for a PhD Thesis topic Master thesis topic:

Transitioning web application frameworkstowards the Semantic Web

worked with Eyal Oren (ActiveRDF) and Max Völkel (RDF2Go, RDFReactor)

Student research topic: simplifying RDF semantics

3

Page 4: RDFa: putting RDF on the Web

Chapter Copyright 2007 Digital Enterprise Research Institute. All rights reserved. www.deri.org

Digital Enterprise Research Institute www.deri.ie

Motivation

4

Page 5: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Publishing structured content

5

Current Web: written for humans (mostly) Interesting information for machine agents exists

Example: music events in Galway (date, performer, venue)

Problem: web page mark-up does not explicitly encode information

scraping of web pages is expensive: web page may change without warning human intervention is necessary

Part 1: Motivation

Page 6: RDFa: putting RDF on the Web

Benjamin Heitmannof 286

A potential provider of event data

Part 1: Motivation

Page 7: RDFa: putting RDF on the Web

Benjamin Heitmannof 287

A potential consumer of event data

Part 1: Motivation

Page 8: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 288

Possible solution

Embed machine readable data on the same web page Benefits:

write and publish once

readable by humans and machine agentseasy maintenance for publisher

easy consuming of data after discovery

Two approaches: Microformats:

– fixed vocabulary, not extendable and customisable

RDFa– all the benefits of RDF: flexible and customisable– all the overhead of RDF: data model and formal semantics

Part 1: Motivation

Page 9: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

A side note: Explaining “what do you do?” at a party

Quicker use case suitable for explaining “what do you actually do?” like, lets say, for the Christmas holidays

What can Google do today? List Restaurants in Dublin

Can Google also give you this information?Restaurants in Dublin, open on Thursday late, serving

Pepperoni Pizza for under 15 Euro

RDFa (and the Semantic Web) could make this possible!

9

Page 10: RDFa: putting RDF on the Web

Chapter Copyright 2007 Digital Enterprise Research Institute. All rights reserved. www.deri.org

Digital Enterprise Research Institute www.deri.ie

The foundation: RDF in a nutshell

10

Page 11: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Show of hands

11

Who can answer these questions:

1.What is the RDF data model?

2.What is the formal semantics of RDF?

Part 2: RDF Foundation

Page 12: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

RDF data model: A graph

Graph with nodes and directed arcs

Graph consists of triples Each triple has a

subject, predicate and object

Contrast with other data models: SQL: tables and relations

XML: tree of nodes with attributes

12 Part 2: RDF Foundation

Page 13: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

RDF data model: node types

1.Uniform Resource Identifier (URI): basically like in the

browser location field

globally unique

2.Literal like a string

can optionally have either a data type or a language tag

3.Blank Node place holder

only locally unique

13

URI LiteralBlank Node

Subject

Predicate

Object

X X

X

X X X

Part 2: RDF Foundation

Page 14: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

An example with all three types

14 Part 2: RDF Foundation

Page 15: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

RDF formal semantics

uses “model theory” to provide “a globally coherent notion of meaning”

provides basis for inference rules specifies the semantics of RDF Fundamental property:

open world semantics and monotonic reasoningFacts: I go to work from Monday to Friday.

Question: Will I go to work on the weekend?Closed world semantics: no facts about the weekend ->

answer: no.

Open world semantics: answer not possible

Monotonic reasoning: adding new data always possible

15 Part 2: RDF Foundation

Page 16: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Model theory example

Three triples: <ex:a> <ex:b> <ex:c> .

<ex:c> <ex:a> <ex:a> .

<ex:c> <ex:b> <ex:a> .

True with this interpretation:

16 Part 2: RDF Foundation

Page 17: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

What to remember about RDF

RDF is the foundation of the Semantic Web

defines the data model provides base layer

semantics other standards extend

these semantics (like RDF Schema and OWL)

domain ontologies provide domain specific semantics (like FOAF) on top of RDF Schema

17 Part 2: RDF Foundation

Page 18: RDFa: putting RDF on the Web

Chapter Copyright 2007 Digital Enterprise Research Institute. All rights reserved. www.deri.org

Digital Enterprise Research Institute www.deri.ie

RDFa with examples

18

Page 19: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

What is RDFa?

19

syntax for embedding an RDF graph in an XHTML document

uses XHTML attributes for expressing RDF properties properties about

same page

or external URI

properties can reuse visible page content or be invisible

XHTML documents with RDFa are backwards compatible

GRDDL transformation to extract RDF exists

Part 3: RDFa

Page 20: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

RDFa Example: Graph

20 Part 3: RDFa

Page 21: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

RDFa Example: Source

<div xmlns:foaf="http://xmlns.com/foaf/0.1/" about="#me" rel="foaf:knows">

<ul>

<li typeof="foaf:Person">

<a property="foaf:name" rel="foaf:homepage" href="http://example.com/bob">Bob</a>

</li>

<li typeof="foaf:Person">

<a property="foaf:name" rel="foaf:homepage" href="http://example.com/eve">Eve</a>

</li>

<li typeof="foaf:Person">

<a property="foaf:name" rel="foaf:homepage" href="http://example.com/manu">Manu</a>

</li>

</ul>

</div>

21 Part 3: RDFa

Page 22: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

What just happened?

RDFa works a little bit like RDF/XML xmlns:foaf declares the FOAF namespace about=”#me” defines the subject of a triple rel=”foaf:knows” defines the predicate typeof=”foaf:Person” defines a resource type typeof without explicit URLs leads to blank nodes property=”foaf:name” uses the literal “Bob” rel=”foaf:homepage” uses the href

That’s 12 triples for just 8 XML nodes

22 Part 3: RDFa

Page 23: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

CURIEs versus URIs

Not all of the 10 RDFa attributes can use URIs CURIE (Compact URI )

example: foaf:Person

curie := [ [ prefix ] ':' ] referenceprefix is either a defined name space or the default

namespace

URI (like http://dbpedia.org/resource/London) SafeCURIE

CURIE in square brackets, example: [wiki:Biome]

prevents ambiguities between URIs and CURIEs

Idea: Subject and Object can be external, use URIs. Predicate should be internal, so use CURIE.

23 Part 3: RDFa

Page 24: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Attributes for subjects

@about : URI or SafeCURIEdefine a subject of a triple

@src : URIa not clickable resource object, like a picture or multimedia object

24 Part 3: RDFa

Page 25: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Attributes for predicates

@rel : CURIEsexpress relationship between resources

@rev : CURIEsexpress reverse relationship between resources

@property : CURIEsexpress relationship between a subject and a literal

25 Part 3: RDFa

Page 26: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Attributes for objects

@resource : URI or SafeCURIEan invisible resource object, that is not clickable

@href : URIa resource object that is clickable like a link

@content : stringinvisible literal object for a triple

@datatype : XML data for a literal@typeof : specify class of a subject

26 Part 3: RDFa

Page 27: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Another RDFa example

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:cal="http://www.w3.org/2002/12/cal/ical#"

xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

<head><title>Jo's Friends and Family Blog</title></head>

<body>

<p typeof="cal:Vevent">

I'm holding

<span property="cal:summary">

one last summer Barbecue

</span>,

on

<span property="cal:dtstart" content="2007-09-16T16:00:00-05:00"

datatype="xsd:dateTime">

September 16th at 4pm

</span>.

</p>

</body>

</html>

27 Part 3: RDFa

Page 28: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Publishing and consuming RDFa

28

Publishing RDFause any CMS that has custom templates

Drupal

Wordpress (use pods plugin for wp 2.7)

Consuming RDFause GRDDL to convert any web page with RDFa to RDF/XML

Operator Plug-in for Firefox

Take a look at http://rdfa.info/wiki/Tools for more

Part 3: RDFa

Page 29: RDFa: putting RDF on the Web

Digital Enterprise Research Institute www.deri.ie

Benjamin Heitmannof 28

Summary

29

RDF provides the data model and formal semantics for the Semantic Web

RDFa embeds the data model in XHTML pagesvery flexible, can express any RDF graph

lots of nested tagscan reuse existing visible content

or can be completely invisible

beware of the difference between URIs and CURIEs watch out for implicit blank nodes generic tools for publishing and consuming exist