83
Drupal Camp Jamie Taylor

Drupal and the Semantic Web

Embed Size (px)

DESCRIPTION

Presented at Drupal Camp SF (6/6/09) Three part presentation: 1) Provides an overview of how semantic technologies can simplify data management and integration. 2) Gives a brief introduction to RDF/RDFa. 3) Looks at the Drupal RDF module, SPARQL module, Exhibit module, Freebase Suggest and the upcoming Common Tag module.

Citation preview

Page 1: Drupal and the Semantic Web

Drupal CampJamie Taylor

Page 2: Drupal and the Semantic Web
Page 3: Drupal and the Semantic Web

What can semantic web technologies do for you?

Page 4: Drupal and the Semantic Web

Tag your content

Page 5: Drupal and the Semantic Web

Topic Hubs

Page 6: Drupal and the Semantic Web

RDFa Powered Search

Page 7: Drupal and the Semantic Web

Data Exploration Widgets

Page 8: Drupal and the Semantic Web

A Brief History of Data ModelingPhoto CC-BY: http://en.wikipedia.org/wiki/File:McDonalds_on_Interstate_44.jpg

Why Semantics?

Page 9: Drupal and the Semantic Web

Ugly Tabular Data

Page 10: Drupal and the Semantic Web

A Simple Restaurant Schema

Page 11: Drupal and the Semantic Web

A Simple Restaurant Schema

Page 12: Drupal and the Semantic Web

Big Ugly Schema

Page 13: Drupal and the Semantic Web

What Went Wrong?

Things change

Requirements change

User expectations change

Data structures change

Our data models aren’t keeping up

Scripting Languagesfacilitate change

....where is the data model that does the same?

Page 14: Drupal and the Semantic Web

Graph Data Models

Deli Liiama

$

DeliS1Cuisine

Price

Name

Page 15: Drupal and the Semantic Web

Graph Data Models

Deli Liiama

San Francisco

North Beach

$

DeliS1

S4

Cuisine

Price

Name

Name

Contained-by

Location

Peking Inn

Name

F7

Location

Chinese

Cuisine

Page 16: Drupal and the Semantic Web

Extending Graph Data Models

Deli Liiama

San Francisco

North Beach

$

DeliS1

S4

Cuisine

Price

Name

Name

Contained-by

Location

Live DJ

Music

Urban ChicDecor

Page 17: Drupal and the Semantic Web

Integrating Graph Data Models

Deli Liiama

$

DeliS1Cuisine

Price

Name

OnTap

LeinenkugelZ6

Pabst BRBrand

Brand

Deli Liiama

A2

Name

Page 18: Drupal and the Semantic Web

Semantic Representation

Relationships are represented explicitly

Schema can be represented as a graph

Data integration is the union of two graphs

This makes creating, extending, and combining data much easier than before

Page 19: Drupal and the Semantic Web

Data

Data

Data

Data

Semantics allows an application to utilize unanticipated new data sources

Plugable Data

Page 20: Drupal and the Semantic Web

Plugable Data

Page 21: Drupal and the Semantic Web

Data Portability

Data

Data

Data

Data

Semantics allows data to be utilized by unanticipated new applications

Page 22: Drupal and the Semantic Web

Data Portability

http://dev.mqlx.com/~jamie/simile/timeline.html

Page 23: Drupal and the Semantic Web

Data Portability

Page 24: Drupal and the Semantic Web

Semantics facilitate shared meaning through

• Subject Identity

• Strong and Consistent Semantics

• Open APIS + Open Data

These principles make it much easier to extend, combine, and integrate data

Why Does This Work?

Page 25: Drupal and the Semantic Web

Just enough RDF

Page 26: Drupal and the Semantic Web

Just Enough RDF

RDF is a Data Model

A very simple model!

Page 27: Drupal and the Semantic Web

Cosmos was written by Carl Sagan

Page 28: Drupal and the Semantic Web

(Cosmos) (was written by) (Carl Sagan)

Page 29: Drupal and the Semantic Web

Subject ObjectPredicate

(Cosmos) (was written by) (Carl Sagan)

Page 30: Drupal and the Semantic Web

Subject ObjectPredicate

(Cosmos) (was written by) (Carl Sagan)

authorCosmosCarl

Sagan

Page 31: Drupal and the Semantic Web

(Cosmos)

Subject Which Cosmos?

Page 32: Drupal and the Semantic Web

(Cosmos)

Subject Which Cosmos?

Page 33: Drupal and the Semantic Web

Identifiers are Everywhere

Page 34: Drupal and the Semantic Web

The humble URI

•URI’s provide strong references

•Much like pointing in the physical world

“this is red”“this is a pen”

•a URIref is an unambiguous pointer to something of meaning

Page 35: Drupal and the Semantic Web

(Cosmos)

Subject

http://rdf.freebase.com/ns/authority.openlibrary.book.OL3568862M

Which Cosmos?

Page 36: Drupal and the Semantic Web

authorCosmosCarl

Sagan

http://rdf.freebase.com/ns/book.written_work.author

What do you mean, author?

vocabulary

Page 37: Drupal and the Semantic Web

authorCosmos

There are billions of Carl Sagans...http://rdf.freebase.com/ns/en.carl_sagan

Page 38: Drupal and the Semantic Web

authorCosmosCarl

Sagan

published “1980”

Page 39: Drupal and the Semantic Web

RDF Data Model

Nodes (“Subjects”)

connect via Links (“Predicates”)

to Objects• either Nodes or Literals

Page 40: Drupal and the Semantic Web

Expressions of RDF

RDF has many (inconvenient) serializations

•RDF-XML•N3

•Turtle•NTriples

•RDFa

Page 42: Drupal and the Semantic Web

published

<http://rdf.freebase.com/ns/authority/openlibrary/book/OL3568862M>

“1980”

<http://rdf.freebase.com/ns/book.written_work.date_of_first_publication>

“1980” .

Cosmos

In N-Triples:

Page 43: Drupal and the Semantic Web

URIs provide identityhttp://rdf.freebase.com/ns/en.robert_cook

Stability

Simplicity

Manageability

PURL.org

Page 44: Drupal and the Semantic Web

Not all URL’s are good identifiers

Page 45: Drupal and the Semantic Web

A socially managed semantic database

Page 46: Drupal and the Semantic Web

All objects in Freebase have strong identifiers

http://rdf.freebase.com/ns/en.yorkie

Page 47: Drupal and the Semantic Web
Page 48: Drupal and the Semantic Web
Page 49: Drupal and the Semantic Web
Page 50: Drupal and the Semantic Web
Page 51: Drupal and the Semantic Web
Page 52: Drupal and the Semantic Web
Page 53: Drupal and the Semantic Web

Types of things in Freebase

Page 54: Drupal and the Semantic Web

5,203,825 Topics

14,110,006 Named Entites

Page 55: Drupal and the Semantic Web

Sources of Freebase Data

Page 56: Drupal and the Semantic Web

Freebase is user writable

Page 57: Drupal and the Semantic Web

schema = vocabulary

Page 58: Drupal and the Semantic Web

Freebase Suggest

Page 59: Drupal and the Semantic Web

Freebase Suggest in Drupal

Page 60: Drupal and the Semantic Web

Freebase Suggest in Drupal

Page 61: Drupal and the Semantic Web

jQuery Freebase Drupal Module

Thomas Bonte - Belgium

http://drupal.org/project/jquery_freebase

if (module_exists('jquery_freebase')) { jq_add('freebase'); drupal_add_js(

"$(document).ready(function() { $('#edit-taglabel').freebaseSuggest({}) .bind('fb-select', function(e, data) {

$('#edit-taguri').val('http://rdf.freebase.com/ns/' + new String(data.id).substring(1).replace(/\//g, '.'));})

});",

'inline' ); }

Page 62: Drupal and the Semantic Web

RDF Graphs

CarrieFisher

Star Wars

Harrison Ford

Blade Runner

Daryl Hannah

Starred In

Starred In

Starred In

Starred In

Page 63: Drupal and the Semantic Web

SPARQL Query

carrie_fisher starred_in star_warsharrison_ford starred_in star_warsharrison_ford starred_in blade_runnerdaryl_hannah starred_in blade_runner

CarrieFisher

Star Wars

Harrison Ford

Blade Runner

Daryl Hannah

Starred In

Starred In

Starred In

Starred In

Page 64: Drupal and the Semantic Web

SPARQL Query

SELECT ? actor WHERE { fb:harrison_ford fb:starred_in ?movie . ?actor fb:starred_in ?movie .

}

carrie_fisher starred_in star_warsharrison_ford starred_in star_warsharrison_ford starred_in blade_runnerdaryl_hannah starred_in blade_runner

FILTER (fb:harrison_ford != ?actor)

Page 65: Drupal and the Semantic Web
Page 66: Drupal and the Semantic Web
Page 67: Drupal and the Semantic Web
Page 68: Drupal and the Semantic Web

Review:Why is identity important?

Page 69: Drupal and the Semantic Web

A

B

C

EF

E

D

C

B

A

Data Integration

Page 70: Drupal and the Semantic Web

W3C VisionTim Berners-Lee’s Giant Global Graph

Page 71: Drupal and the Semantic Web

The Caketaken from http://www.w3.org/2007/Talks/0130-sb-W3CTechSemWeb/layerCake-4.png

The Layer Cake

Page 72: Drupal and the Semantic Web

taken from http://www.w3.org/2007/Talks/0130-sb-W3CTechSemWeb/layerCake-4.png

Take What You Need

Page 73: Drupal and the Semantic Web

Linked Open Data Cloud(LOD)

Page 74: Drupal and the Semantic Web
Page 75: Drupal and the Semantic Web

Drupal is a part of the LOD Cloud

http://drupal.deri.ie/cheese/node/20

Page 76: Drupal and the Semantic Web

Drupal is a part of the LOD Cloud

http://xxx/?q=node/X/rdf

<http://drupal.deri.ie/cheese/node/20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://drupal.deri.ie/cheese/ns#Cheese> .<http://drupal.deri.ie/cheese/node/20> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ov:Cheese> .<http://drupal.deri.ie/cheese/node/20> <http://drupal.deri.ie/cheese/ns#cheese_Title> "Ardrahan Cheese" .<http://drupal.deri.ie/cheese/node/20> <http://drupal.deri.ie/cheese/ns#created> "2009-01-16T11:05:11Z"^^http://www.w3.org/2001/XMLSchema#dateTime .<http://drupal.deri.ie/cheese/node/20> <http://drupal.deri.ie/cheese/ns#changed> "2009-04-27T13:20:43Z"^^http://www.w3.org/2001/XMLSchema#dateTime .<http://drupal.deri.ie/cheese/node/20> <http://drupal.deri.ie/cheese/ns#cheese_Source_milk> "cow" .<http://drupal.deri.ie/cheese/node/20> <http://drupal.deri.ie/cheese/ns#cheese_Country_origin> "Ireland" .<http://drupal.deri.ie/cheese/node/20> <ov:origin> "Ireland" .<http://drupal.deri.ie/cheese/node/20> <http://drupal.deri.ie/cheese/ns#cheese_Picture> <http://drupal.deri.ie/cheese/sites/default/files/Ardrahan_cheese_1.jpg> .<http://drupal.deri.ie/cheese/node/20> <http://xmlns.com/foaf/0.1/depiction> <http://drupal.deri.ie/cheese/sites/default/files/Ardrahan_cheese_1.jpg> .<http://drupal.deri.ie/cheese/node/20> <http://drupal.deri.ie/cheese/ns#cheese_Description> "Ardrahan is a type of semi-soft cheese with a pungent aroma, Ardrahan cheese has buttery textured honey-coloured centre with a complex delicate flavour. It has a washed rind which grows into a golden colour, and its size and weight tend to vary slightly due to the fact that it is a hand-made product. In general the large wheel weighs about 1.5 kg. There is also a small consumer wheel which weighs 300g. It is yellow-coloured.

Ardrahan also develops a nutty flavour with maturity. It has a unique flavour that lingers, leaving a very pleasant after-taste. It contains only 25% fat approximately. It is hand made using traditional methods and only whole milk and vegetarian rennet are used. " .<http://drupal.deri.ie/cheese/node/20> <http://purl.org/dc/elements/1.1/description> "Ardrahan is a type of semi-soft cheese with a pungent aroma, Ardrahan cheese has buttery textured honey-coloured centre with a complex delicate flavour. It has a washed rind which grows into a golden colour, and its size and weight tend to vary slightly due to the fact that it is a hand-made product. In general the large wheel weighs about 1.5 kg. There is also a small consumer wheel which weighs 300g. It is yellow-coloured.

Ardrahan also develops a nutty flavour with maturity. It has a unique flavour that lingers, leaving a very pleasant after-taste. It contains only 25% fat approximately. It is hand made using traditional methods and only whole milk and vegetarian rennet are used. " .

Page 77: Drupal and the Semantic Web

SUBJECT@about - a URI, stating the RDF subject

PREDICATE@rel - CURIEs, expressing relationships between two resources@property - CURIEs, expressing relationships between a resource and a literal@rev - CURIEs, expressing reverse relationship between two resources

OBJECT@content - a string, representing a literal RDF object@href - a URI resource expressing the RDF object (as in-line clickable)@src - a URI resource expressing the RDF object (as in-line embedded item)@resource - a URI resource expressing the RDF object

Special Predicate@typeof - CURIEs expressing the RDF type of a subject (rdf:type)

RDF in HTML = RDFa

Page 78: Drupal and the Semantic Web

SUBJECT@about - a URI, stating the RDF subject

PREDICATE@rel - CURIEs, expressing relationships between two resources

OBJECT@resource - a URI resource expressing the RDF object

<div xmlns:fb=”http://rdf.freebase.com/ns/” about=”http://rdf.freebase.com/ns/en.jamie_taylor” rel=fb:people.person.place_of_birth>

<span resource=”http://rdf.freebase.com/ns/en.saint_paul”/>

</div>

RDF in HTML = RDFa

Page 79: Drupal and the Semantic Web

SUBJECT@about - a URI, stating the RDF subject

PREDICATE@property - CURIEs, expressing relationships between a resource and a literal

OBJECT@content - a string, representing a literal RDF object

<div xmlns:fb=”http://rdf.freebase.com/ns/” about=”http://rdf.freebase.com/ns/en.carl_sagan” property=fb:people.person.date_of_birth>

<span content=”1934-11-09”/>

</div>

RDF in HTML = RDFa

Page 80: Drupal and the Semantic Web

What “concepts” are covered in content

Like existing tagging,

but with strong identifiers!<resource>

Tag

tagged

meanslabel

<resource>"text"

taggingDate "2001-01-01"

Strong identifier goes here!

Page 81: Drupal and the Semantic Web

Drupal Module

Page 82: Drupal and the Semantic Web

<div class="rdfa" xmlns:ctag="http://commontag.org/ns#">

NASA's

<a typeof="ctag:Tag"

rel="ctag:means"

href="http://rdf.freebase.com/ns/en.phoenix_mars_mission"

property="ctag:label">Phoenix Mars Lander</a>

has deployed its robotic arm.

</div>

<resource>

Tag

tagged

meanslabel

<resource>"text"

taggingDate "2001-01-01"

Page 83: Drupal and the Semantic Web