rdfa 1.1: adding machine-readable hints to your webpage

27
RDFa 1.1 Adding Machine-readable Hints to your Webpage Neue Fähigkeiten zum einfachen Editieren und Konsumieren von RDFa Auszeichnungen Benjamin Adrian http://www.dfki.de/~adrian W3C Tag, 15.09.2010, Berlin

Upload: benjamin-adrian

Post on 01-Nov-2014

3.094 views

Category:

Technology


1 download

DESCRIPTION

This is a summary about RDFa (1.1) and the activities and contributions done by the RDFa Working Group. The talk was given at the W3C Day 2010 in Berlin.

TRANSCRIPT

RDFa 1.1

Adding Machine-readable Hints to your Webpage

Neue Fähigkeiten zum einfachen Editieren

und Konsumieren von

RDFa Auszeichnungen

Benjamin Adrianhttp://www.dfki.de/~adrian

W3C Tag, 15.09.2010, Berlin

What is RDFa about?

Goal: Add machine-readable hints to web pages

Generate RDF triples from a web page ...

RDF(a)

attributes awesome !!!

<http://my.safaribooksonline.com/0975841947> a gr:Offering ; rdfs:label "Safari Books Online" ; gr:includesObject [ a gr:TypeAndQuantityNode ; gr:amountOfThisGood "1"^^xsd:float ; gr:typeOfGood <urn:x-domain:oreilly.com:product:9780975841945.SAF> ] .

...

… and start scripting!

W3C Tag, 15.09.2010, Berlin

your personal vision

your machine's vision

The RDFa Working Group Member

Ben Adida

Ivan HermanBenjamin Adrian

Manu Sporny Steven Pamperton

Mark Birbeck

Jeffrey Sonstein

Knud Möller

Shane McCarron

Toby Inkster

John O'Donovan

Nan Ma

Robert Weir

Sarah Pulis

Markus Gylling

Bouba Fanta

Jean-PierreEvain

Abhijit Gaikwad

last update, 2010-09-13

What is new in RDFa 1.1

Goal: Make RDFa easier:

● for authors to write and to copy/paste content

● for developers to script

Current Contributions:

● Introduced prefix, profile, vocab instead of overloading xmlns

● Draft an RDFa API

● Let RDFa processors separate between a default RDF graph and a processor RDF graph containing error triples

● Use plain URIs in every RDFa attribute

W3C Tag, 15.09.2010, Berlin

W3C Tag, 15.09.2010, Berlin

Writing RDFa 1.1

How do I tell my computer what this means?

W3C Tag, 15.09.2010, Berlin

Your computer understands RDF

Benjamin Adrian

Neue Fähigkeiten zum einfachen Editieren undKonsumieren von RDFa Auszeichnungen

11:30

12:15

DFKI

Speak to your computer in RDF concepts

#ben

Benjamin Adrian

Neue Fähigkeiten zum einfachen Editieren undKonsumieren von RDFa Auszeichnungen

#rdfa_talk

http://www.dfki.de

2010-09-15T11:30:00

2010-09-15T12:15:00

dc:title

vcal:dtstart

vcal:dtend

vcal:organizer

foaf:name

foaf:workplaceHomepage

#dfki

DFKI

foaf:name

foaf:member

foaf:homepage

Same RDF in TURTLE Syntax

@prefix foaf: <http://xmlns.com/foaf/0.1/>@prefix vcard: <http://www.w3.org/2002/12/cal#>@prefix dc: <http://purl.org/dc/terms/>

<#ben>foaf:name „Benjamin Adrian“;foaf:workplaceHomepage <http://www.dfki.de>;foaf:member <#dfki>;vcard:organizer <#rdfa_talk>.

<#dfki>foaf:name „DFKI“;foaf:homepage <http://www.dfki.de>.

<#rdfa_talk>vcard:dtstart „2010-09-15T11:30:00“^xsd:DateTime;vcard:dtend „2010-09-15T12:15:00“^xsd:DateTime;dc:title „Neue Fähigkeiten zum einfachen

Editieren und Konsumieren von RDFa Auszeichnungen“.

W3C Tag, 15.09.2010, Berlin

Back to the HTML content

<tr> <td> <span>11:30</span> - <span>12:15</span> </td> <td> <div>Neue Fähigkeiten zum einfachen Editieren und Konsumieren von RDFa Auszeichnungen </div> <a href="/referenten-2010/details/adrian.html">Benjamin Adrian </a>, <span>DFKI</span> </td></tr>

W3C Tag, 15.09.2010, Berlin

CURIEs and prefixes … in RDFa

<tr prefix=“dc: http://purl.org/dc/terms/“> <td> <span>11:30</span> - <span>12:15</span> </td> <td> <div property=“dc:title“>Neue Fähigkeiten zum einfachen Editieren und Konsumieren von RDFa Auszeichnungen </div> <a href="/referenten-2010/details/adrian.html">Benjamin Adrian </a>, <span>DFKI</span> </td></tr>

Use prefix for resolving CURIEs.

(xmlns is depricated)

CURIE

W3C Tag, 15.09.2010, Berlin

Default Vocabularies … in RDFa

<tr prefix=“dc: http://purl.org/dc/terms/“ vocab=“http://www.w3.org/2002/12/cal#“> <td> <span property=“dtstart“>11:30</span> - <span property=“dtend“>12:15</span> </td> <td> <div property=“dc:title“>Neue Fähigkeiten zum einfachen Editieren und Konsumieren von RDFa Auszeichnungen </div> <a href="/referenten-2010/details/adrian.html">Benjamin Adrian </a>, <span>DFKI</span> </td></tr>

short name

W3C Tag, 15.09.2010, Berlin

Bundle vocabularies, prefixes … in RDFA

<div profile="http://www.heppnetz.de/grprofile/">

<span about="#company" typeof="gr:BusinessEntity“>

<span property="gr:legalName">

Hepp's bakery

</span>

, see also the

<a rel="rdfs:seeAlso" href="http://example.org/bakery">

home page of the bakery.

</a>

</div>

Use profile documents for defining a bundle of vocabularies or prefixes.

Profiles can be defined in RDFa, RDFXML, or Turtle.

W3C Tag, 15.09.2010, Berlin

Refine content … in RDFa

<tr prefix=“dc: http://purl.org/dc/terms/“ vocab="http://www.w3.org/2002/12/cal#"> <td> <span property=“dtstart“ content=“2010-09-15T11:30:00“>11:30</span> - <span property=“dtend“ content=“2010-09-15T12:15:00“>12:15</span> </td> <td> <div property=“dc:title“>Neue Fähigkeiten zum einfachen Editieren und Konsumieren von RDFa Auszeichnungen </div> <a href="/referenten-2010/details/adrian.html">Benjamin Adrian </a>, <span>DFKI</span> </td></tr>

W3C Tag, 15.09.2010, Berlin

Define multiple entities … in RDFa <tr prefix=“dc: http://purl.org/dc/terms/“ about=“#talk“

vocab=“http://www.w3.org/2002/12/cal#“ typeof=“Vevent“> <td> <span property=“dtstart“ content=“2010-09-15T11:30:00“>11:30</span> - <span property=“dtend“ content=“2010-09-15T12:15:00“>12:15</span> </td> <td> <div property=“dc:title“>Neue Fähigkeiten zum einfachen Editieren und Konsumieren von RDFa Auszeichnungen </div> <a about=“#ben“ property=“foaf:name“ href="/referenten-2010/details/adrian.html">Benjamin Adrian </a>, <span typeof=“foaf:Organization“

property=“foaf:name“>DFKI</span> </td></tr>

W3C Tag, 15.09.2010, Berlin

Connect entities … in RDFa <tr prefix=“dc: http://purl.org/dc/terms/“ about=“#talk“

vocab=“http://www.w3.org/2002/12/cal#“ typeof=“Vevent“> <td> <span property=“dtstart“ content=“2010-09-15T11:30:00“>11:30</span> - <span property=“dtend“ content=“2010-09-15T12:15:00“>12:15</span> </td> <td> <div property=“dc:title“>Neue Fähigkeiten zum einfachen Editieren und Konsumieren von RDFa Auszeichnungen </div> <a about=“#ben“ property=“foaf:name“

rel=“organizer“ resource=“#talk“ href="/referenten-2010/details/adrian.html">Benjamin Adrian </a>, <span typeof=“foaf:Organization“ property=“foaf:name“ inv=“foaf:member“ resource=“#ben“>DFKI</span> </td></tr>

W3C Tag, 15.09.2010, Berlin

W3C Tag, 15.09.2010, Berlin

Scripting with RDFa 1.1

3 steps to get your RDFa objects

1. Parsing DOM objects that contain embedded metadata

2. Extraction of the embedded metadata into a data store

3. Querying a data store in order to retrieve PropertyGroups

W3C Tag, 15.09.2010, Berlin

General Architecture

Basic data structures

Storage Level

Extract data, Provide views

Object-centric view of extracted data

Document Model

W3C Tag, 15.09.2010, Berlin

RDFa API

W3C Tag, 15.09.2010, Berlin

Retrieving PropertyGroups

Retrieves a list of PropertyGroups by their type.document.getItemsByType(type)

Retrieves a single PropertyGroup by its subject.

document.getItemBySubject(type)

Retrieves a list of PropertyGroups by a particular property and optional value.

document.getItemsByProperty(property, optional value)

RDFa API

W3C Tag, 15.09.2010, Berlin

Retrieving DOM Elements

Retrieves a list of DOM Nodes by the type of data that they express.

document.getElementsByType(type)

Retrieves a list of DOM Nodes by the subject associated with the data that they express.

document.getElementsBySubject(type)

Retrieves a list of DOM Nodes by a particular property and optional value that each expresses.

document.getElementsByProperty(property, optional value)

RDFa API

W3C Tag, 15.09.2010, Berlin

Advanced Processing

Retrieves an array of PropertyGroups based on a set of selection criteria.

document.data.query.select(query, template)

Filters a given DataStore by matching a given triple pattern.

document.data.store.filter(pattern)

Iterates through a DOM, using a low-memory, stream-based approach, matching on the given triple pattern.

document.data.parser.iterate(pattern)

RDFa API for beginners

var store = document.data.createStore();document.data.createParser("rdfa", store).parse();//document.data.createParser(“hCard“, store).parse();

document.data.context.setMapping(„foaf“, „http://xmlns.com/foaf/0.1/“);

for(var person : document.getItemsByType(„foaf:Person“)) {

for(var element: document.getElementsBySubject(person.get(„uri“))) {element.style.setProperty(“color“, “#00cc00“, null);addPopupOnClickEvent(person.get(„uri“), element);

}

}

W3C Tag, 15.09.2010, Berlin

RDFa API for advanced beginners

...var events = query.select( { „rdf:type“: „vcal:Event“ }, { „rdf:type“ : „type“ , „dc:title“ : „title“, „vcal:dtstart“: „start“, „vcal:dtend“: „end“ } );

for(var i = 0; i < events.length; i++) {

var event = events[i]; anchor = document.createElement(„a“); anchor.href = „http://www.google.com/calendar/event?“ + “action=TEMPLATE“ + „&text=“ + event.summary + „&dates=“ + event.start + „/“ + event.end; button = document.createElement(„img“); button.src = „http://www.google.com/calendar/images/ext/gc_button6.gif“; anchor.appendChild(button); event.info(„rdf:type“, „source“)[0].appendChild(anchor);}

W3C Tag, 15.09.2010, Berlin

Useful Tools

● Use check.rdfa for checking if your RDFa content is compliant with Google's Rich Snippet, or Facebook's Open Graph Protocol (http://check.rdfa.info/)

● Use the CMS system Drupal for adding RDFa data to your web pages.

● Use the RDFa distiller for extracting RDF triples from RDFa content (http://www.w3.org/2007/08/pyRdfa/)

W3C Tag, 15.09.2010, Berlin

Outlook

What's next in RDFa 1.1?

Improve support of RDFa in HTML lists

Self contained error handling

Publish a good RDFa Primer.

Eat your own dog food, means to really implement the RDFa API.

...

W3C Tag, 15.09.2010, Berlin

Thanks for your interest!

Have fun with RDFa

Benjamin Adrianhttp://www.dfki.de/~adrian