How to Build Linked Data Sites with Drupal 7 and RDFa

140
! "#$%&'()* +,,- .'('*/0 12*3&$&'43 5343/&6) 724*'*8*39 :00 &'()*4 &343&;3<9 !"#"$%& ()$*+,+"-* .*-*%+/0 1)-$"$2$* 33345*+"4"* =#> *# ?8'0< @'2A3< ./*/ B'*34 >'*) .&8$/0 C /2< 5.D/ B*E$)/23 "#&0#4F83*G @'2 "0/&AG :03H/2<&3 I/44/2*G :H30 I#003&34 B3JK36) +,L, B/2 D&/26'46# M823 +N*)G +,L,

description

Slides of the tutorial Stéphane Corlosquet, Lin Clark and Alexandre Passant presented at SemTech 2010 in San Francisco http://semtech2010.semanticuniverse.com/sessionPop.cfm?confid=42& proposalid=2889

Transcript of How to Build Linked Data Sites with Drupal 7 and RDFa

Page 1: How to Build Linked Data Sites with Drupal 7 and RDFa

! !"#$%&'()*!+,,-!.'('*/0!12*3&$&'43!5343/&6)!724*'*8*39!:00!&'()*4!&343&;3<9

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

=#>!*#!?8'0<!@'2A3<!./*/!B'*34!

>'*)!.&8$/0!C!/2<!5.D/

B*E$)/23!"#&0#4F83*G!@'2!"0/&AG!:03H/2<&3!I/44/2*G!:H30!I#003&34

B3JK36)!+,L,

B/2!D&/26'46#

M823!+N*)G!+,L,

Page 2: How to Build Linked Data Sites with Drupal 7 and RDFa

�������������� �� ������ ����� ���������

�� ��

"%�����������&�� �������!

���(������)�����

Page 3: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

72$8+"%&'82$&")*

! 72*&#<86*'#2!*#!B3J/2*'6!/2<!843O80!;#6/P80/&'34!QLGN!)R

! S3**'2(!4*/&*3<!>'*)!.&8$/0!CT!'24*/00/*'#2!/2<!

6#2O'(8&/*'#2!QLGN!)R

" U43!6/43

" =/2<4V#2!.3J#

! 5.D!'2!.&8$/0!C!QW)R

" :&6)'*36*8&3

" .3O/80*!5.D!J/$$'2(4

Page 4: How to Build Linked Data Sites with Drupal 7 and RDFa

! !"#$%&'()*!+,,-!.'('*/0!12*3&$&'43!5343/&6)!724*'*8*39!:00!&'()*4!&343&;3<9

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

")/$*3&

72*&#<86*'#2!*#!*)3!=3>/2*'6!?3@

Page 5: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Semantic Web benefits

! Programs and sites can exchange information

1

my-site.net your-site.orgcompany.com

+

! Search engines can display more relevant information in results

! Data mashers can combine data from different datasets to find new and astounding things

Page 6: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Key (confusing) terms

RDF

2

Machine UnderstandableLinked Data

SPARQL

Federated DatasetGiantGlobalGraph

Page 7: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Machine Understandable

3

The Semantic Web helps machines understand what the information on a Web page is...

linclark.jpg

is a picture

of a person

named

Lin Clark

Page 8: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF

R

4

DF

esource

escription

ramework

Page 9: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF

Everything is a resource

5

A resource is a named thing

A resource is a uniquely named thing

thishttp://lin-clark.com/page.html#this

lin:this

URICURIENamespace

xmlns:lin=”http://lin-clark.com/page.html#

Page 10: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF

6

A resource can be a document

dblp:this

foaf:Document

Page 11: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF

7

A resource can be a company

deri:this

foaf:Organization

Page 12: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF

8

A resource can even be a person

lin:me

foaf:Person

Page 13: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF

9

You can describe properties of that person...

lin:me

foaf:name Lin Clark

foaf:mbox [email protected]

foaf:birthday 07-01

Page 14: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF

10

and describe how that person is related to other resources

lin:me

deri:thisdblp:this

swrc:employsfoaf:made

Page 15: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Federated Dataset

11

Because we are using http URIs,

these resources don’t need to be in the same database

lin:me

deri:thisdblp:this

swrc:employsfoaf:made

Page 16: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Federated Dataset

12

the resources can be distributed across the Web

in a federated datagraph

Page 17: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Giant Global Graph

13

And when all resources are described this way,

the Web becomes one giant database...

Page 18: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SPARQL

14

Find and retrieve information from the graph

using SPARQL

Page 19: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Semantic Web

RDF

15

Machine UnderstandableLinked Data

SPARQL

Federated DatasetGiantGlobalGraph

Page 20: How to Build Linked Data Sites with Drupal 7 and RDFa

! Copyright 2009 Digital Enterprise Research Institute. All rights reserved.

Digital Enterprise Research Institute www.deri.ie

The Semantic Web

Page 21: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Web - Initial Proposal (1989)

2 of XYZ

http://www.w3.org/History/1989/proposal.html

Page 22: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Web - Circa 2010

3 of XYZ

??

??

??

Page 23: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Web – 1994 Vision

To a computer, the Web is a flat, boring world, devoid of meaning. This is a pity, as in fact documents on the Web describe real objects and imaginary concepts, and give particular relationships between them. For example, a document might describe a person. The title document to a house describes a house and also the ownership relation with a person. Adding semantics to the Web involves two things: allowing documents which have information in machine-readable forms, and allowing links to be created with relationship values. Only when we have this extra level of semantics will we be able to use computer power to help us exploit the information to a greater extent than our own reading.

Tim Berners-Lee, 1st World Wide Web Conference, Geneva, May 1994

4 of XYZ

Page 24: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Web – 1994 Vision

5 of XYZ

http://www.slideshare.net/danbri/when-presentation-849447

Page 25: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Semantic Web

!  Bridging the gap from a Web of Documents to a Web of Data "  With typed objects and typed relationships: The Web as a

giant decentralized database

!  Adding machine-readable meta-data to existing content "  So that information can be parsed, queried, reused

!  Defining shared semantics for this meta-data "  For interoperability between applications and for advanced

purposes, such as reasoning

!  Enabling machine-readable knowledge at Web scale, making information more easy to find and process

6 of XYZ

Page 26: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Page 27: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

A Bit of History

!  Memex "  1945 ! - Vannevar Bush

"  A memex is “a device in which an individual stores all his books, records, and communications.”

!  Augmenting Human Intellect "  1960 - Douglas Engelbart

"  “By ‘augmenting human intellect’ we mean increasing the capability of a man to approach a complex problem situation, to gain comprehension to suit his particular needs, and to derive solutions to problems.”

8 of XYZ

Page 28: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

More recently

!  SHOE "  http://www.cs.umd.edu/projects/plus/SHOE/

"  “SHOE is a small extension to HTML which allows web page authors to annotate their web documents with machine-readable knowledge. SHOE makes real intelligent agent software on the web possible.“

9 of XYZ

Page 29: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Semantic Web, right now

!  Standardisation work in W3C "  http://w3.org

!  Semantic Web activity "  http://www.w3.org/2001/sw/

!  Incubator Groups, Working Groups, Interest Groups "  SPARQL - http://www.w3.org/2009/sparql/wiki/Main_Page

"  RDB2RDF – http://www.w3.org/2005/Incubator/rdb2rdf

"  RIF - http://www.w3.org/2005/rules/

"  HCLS - http://www.w3.org/2001/sw/hcls/

"  …

10 of XYZ

Page 30: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Semantic Web stack

11 of XYZ

http://www.w3.org/2007/03/layerCake.png

Page 31: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Semantic Web stack

12 of XYZ

http://www.w3.org/2007/03/layerCake.png

Page 32: How to Build Linked Data Sites with Drupal 7 and RDFa

! Copyright 2009 Digital Enterprise Research Institute. All rights reserved.

Digital Enterprise Research Institute www.deri.ie

URIs, RDF(S) and OWL

Page 33: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

URIs

14

!  A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource as of RFC3986

!  URIs are used to identify everything in a unique and non-ambiguous way "  Not only pages (as on the current Web), but any resource

(people, documents, books, interests …)

"  A URI for a person is different from a URI for a document about the person, because a person is not a document !

!  Example "  http://apassant.net/alex - myself

"  http://apassant.net - my homepage

Page 34: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Resource Description Framework

15

!  URI represent resources "  But how define things about these resources ?

"  E.g. “Drupal is a CMS”, “DERI is in Galway”

!  RDF – Resource Description Framework "  RDF abstract syntax, a data model: a directed, labeled

graph based on URIs

"  RDF is not XML ! RDF/XML is only one of the multiple way to serialize RDF data (N3, RDFa …)

!  RDF is based on triples "  <subject> <predicate> <object> .

"  Subjects and predicates are URIs

"  Objects can be either URIs or litterals

Page 35: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF by example

@prefix dct: <http://purl.org/dc/terms/> . !

<http://semtech2010.semanticuniverse.com/talk/2889#id>! dct:title “How to build Linked Data sites with Drupal7 and

RDFa” ; ! dct:author <http://apassant.net/alex> ;! dct:subject <http://dbpedia.org/resource/Drupal> .!

16

How to build Linked Data sites with

Drupal7 and RDFadct:title http://semtech2010.semanticuniverse.com/talk/2889#id

http://apassant.net/alex http://dbpedia.org/resource/Drupal

dct:author dct:subject

Page 36: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDFa

!  A way of embedding RDF in (X)HTML documents: "  One page for both humans and machines

"  Don’t need to repeat yourself

"  Introducing new XHTML attributes

"  http://www.w3.org/TR/xhtml-rdfa-primer/

!  Current work is ongoing on RDFa 1.1: "  For profiles, etc.

Page 37: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDFa by example

Page 38: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDFa by example

Page 39: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDFa and prefixes

!  http://sdow2009.semanticweb.org "  Header contains prefixes and links to the GRDDL

transformation

Page 40: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Extracting other serialisations

!  http://sdow2009.semanticweb.org "  Webpage can be translated to native RDF/XML using an

RDFa distiller - http://www.w3.org/2007/08/pyRdfa/

Page 41: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Ontologies

!  RDF provides a way to write assertions "  But what about their semantics

"  E.g. how can one know thathttp://xmlns.com/foaf/0.1/knows identifies an acquaintance relationship ?

!  Ontologies provide common semantics for resources on the Semantic Web "  “An ontology is a specification of a conceptualization.”

!  Developing ontologies for the Semantic Web "  Main languages are RDFS (RDF Schema) and OWL (Web

Ontology Language)

"  Growing expressivity levels

22 of XYZ

Page 42: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Ontologies

!  Classes and properties "  :Person a rdfs:Class .

"  :father a rdfs:Property .

"  :father rdfs:domain :Person .

"  :father rdfs:range :Person .

23 of XYZ

Page 43: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Metadata and ontologies

Page 44: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDFS

!  RDFS defines classes, properties and subsumption relations between classes and properties "  ex:Person rdfs:subClassOf ex:humanLiving .

"  ex:worksWith rdfs:subPropertyOf ex:knows .

!  Such relationships are used to infer new statements "  :alex rdf:type ex:Person .

"  :Alex ex:worksWith :Axel .

"  Is enough to say that Alex is a humanLiving and knows Axel

25 of XYZ

Page 45: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDFS by example

26 of XYZ

Page 46: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

OWL

!  OWL goes further than RDFS by introducing new axioms "  Disjunction (e.g. person / document)

"  Transitivity (e.g. ancestor)

"  Symmetry (e.g. sibling)

"  Cardinality constraints (e.g. ancestor > 1)

!  OWL2 introduces a lot of useful features, especially for reasoning "  Property Chains (parent + brother -> uncle)

27 of XYZ

Page 47: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

OWL by example

28 of XYZ

Page 48: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

OWL2 Property chain example

ex:uncle rdf:type owl:ObjectProperty .

ex:parent rdf:type owl:ObjectProperty .

ex:brother rdf:type owl:ObjectProperty .

[] rdfs:subPropertyOf ex:uncle;!!

owl:propertyChain (!

ex:parent!!

ex:brother!!

).

:alice ex:parent :bob .

:bob ex:brother :joe .

=>

:alice ex:uncle :joe .

29 of XYZ

Page 49: How to Build Linked Data Sites with Drupal 7 and RDFa

! Copyright 2009 Digital Enterprise Research Institute. All rights reserved.

Digital Enterprise Research Institute www.deri.ie

Linked Data

Page 50: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Linked Data

!  Building a “Web of Data” to enhance the current Web

!  Exposing, sharing and connecting data about things via dereferenceable URIs

!  The Linking Open Data (LOD) project: "  http://linkeddata.org/

"  Translating existing datasets into RDF and linking them together, for example DBpedia (Wikipedia) and GeoNames, Freebase, BBC programmes, etc.

"  Governement data also available as Linked Data

Page 51: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The Linked Data principles

!  http://www.w3.org/DesignIssues/LinkedData.html

!  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, SPARQL)

!  Include links to other URIs. so that they can discover more things

!  E.g. http://dbpedia.org/resource/SPARQL

32

Page 52: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The LOD cloud

2008

2007

Page 53: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The LOD cloud

2009

2008

Page 54: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

image from richard.cyganiak.de/2007/10/lod/lod-datasets_2009-07-14.png

Page 55: How to Build Linked Data Sites with Drupal 7 and RDFa

! Copyright 2009 Digital Enterprise Research Institute. All rights reserved.

Digital Enterprise Research Institute www.deri.ie

Some Ontologies used in Drupal7

Page 56: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Which ontologies to use ?

!  SearchMonkey Vocabularies "  http://developer.yahoo.com/searchmonkey/smguide/

profile_vocab.html

37

Page 57: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Which ontologies to use ?

!  How to Publish Linked Data on the Web "  http://www4.wiwiss.fu-berlin.de/bizer/pub/

LinkedDataTutorial/

38

Page 58: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Extending ontologies ?

!  What if existing ontologies are not enough for your needs ? "  Create a new ontology

"  … or extend an existing one !

!  Ontologies can be extended in a decentralized way "  E.g. Anyone can create a subproperty of foaf:knows,

“metInSemtech”, in his own ontology and publish it online

!  Open.vocab.org "  A collaborative platform to manage ontologies

"  http://open.vocab.org

39

Page 59: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Drupal7

!  The following models are used in Drupal7

!  RSS Content module "  http://web.resource.org/rss/1.0/modules/content/

!  DublinCore "  http://dublincore.org/

!  FOAF "  http://foaf-project.org

!  SIOC and its Types module "  http://sioc-project.org

!  SKOS "  http://www.w3.org/2004/02/skos/

Page 60: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RSS Content

Page 61: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

DublinCore

!  DublinCore "  DCMI Metadata Terms

"  http://purl.org/dc/terms/

!  Some properties "  dc:title

"  dc:subject

"  dc:created

"  dc:date

"  dc:modified

Page 62: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

DublinCore by example

Page 63: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF – Friend Of A Friend

Page 64: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF – Friend Of A Friend

!  An ontology for describing people and the relationships that exist between them: "  http://foaf-project.org/

"  Identity, personal profiles and social networks "  Can be integrated with other SW vocabularies

!  FOAF on the Web: "  LiveJournal, MyOpera, identi.ca, MyBlogLog, hi5, Fotothing,

Videntity, FriendFeed, Ecademy, Typepad

Page 65: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF (Friend-of-a-Friend)

Page 66: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF (Friend-of-a-Friend)

Page 67: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF at a glance

Page 68: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF from Flickr

Page 69: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF from Twitter

Page 70: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Distributed identity with FOAF

Page 71: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Interlinking identities and networks

Page 72: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

FOAF+SSL: Secured authentication

Page 73: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SIOC

!  Semantically-Interlinked Online Communities "  http://sioc-project.org/

!  Addressing interoperability issues on the (Social) Web "  To fully describe content / structure of social websites and

to create new connections between online discussion posts and items, forums and containers

"  Various domains: Web 2.0, enterprise information integration, HCLS, e-government

"  Widely deployed (SearchMonkey, Talis, etc.)

Page 74: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Page 75: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

The SIOC core ontology

Page 76: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SIOC by example

Page 77: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SIOC Types

!  Additional information is required for finer-grained representation of Web 2.0 content "  Differentiating a blog post from a wiki page or from a

microblogging status update

!  SIOC Types "  http://rdfs.org/sioc/types

!  Use-case in HCLS "  http://www.w3.org/TR/hcls-sioc/

Page 78: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SIOC Types

Page 79: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SIOC Types

Page 80: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SIOC Types by example

Page 81: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS

!  SKOS - Simple Knowledge Organization System "  http://www.w3.org/TR/2009/REC-skos-

reference-20090818/

!  Thesaurus, subject headings and classifications "  skos:Concept

"  skos:semanticRelation –  skos:related, skos:narrower, skos:broader

–  A different semantics than in RDFS/OWL hierarchies

!  Used by: "  NY Times, Library of Congress, DBpedia, etc.

Page 82: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

ex:Semantic_Webex:SPARQL ex:Web

skos:Concept

rdf:type

rdf:type

rdf:type

Page 83: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

ex:Semantic_Webex:SPARQL

skos:broader

ex:Web

skos:broader

skos:Concept

rdf:type

rdf:type

rdf:type

Page 84: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

ex:Semantic_Webex:SPARQL

skos:broader

ex:Web

skos:broader

skos:narrowerskos:narrower

skos:Concept

rdf:type

rdf:type

rdf:type

Page 85: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

ex:Semantic_Webex:SPARQL

skos:broader

ex:Web

skos:broader

skos:narrowerskos:narrower

skos:Concept

rdf:type

rdf:type

rdf:type

skos:semanticRelation

Page 86: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

Page 87: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

Page 88: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

Page 89: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SKOS by example

Page 90: How to Build Linked Data Sites with Drupal 7 and RDFa

! Copyright 2009 Digital Enterprise Research Institute. All rights reserved.

Digital Enterprise Research Institute www.deri.ie

Querying RDF data with SPARQL

Page 91: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

SPARQL

!  RDF(S)/OWL useful to produce data "  A need to query it

!  SPARQL "  SPARQL Protocol and RDF Query Language

"  The “SQL” of the Semantic Web

!  FAQ "  http://www.thefigtrees.net/lee/sw/sparql-faq

!  SPARQL Query Recommendation / tutorial "  http://www.w3.org/TR/rdf-sparql-query/

!  Currently under standardization for SPARQL1.1 "  http://www.w3.org/2009/sparql/wiki/Main_Page

Page 92: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

How it works ?

!  Graph Pattern Matching "  Identifying if a requested graph matches the underlying

RDF data

!  Four different operators "  SELECT, DESCRIBE, CONSTRUCT, ASK

"  Combined with query patterns and optional features (union, filters …)

!  A Protocol "  To query RDF data using SPARQL endpoints via HTTP

!  Most of endpoints are associated with an RDF store "  A place that stores RDF data and provides open access to

it – e.g. http://dbpedia.org/sparql

Page 93: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

74

Example of SELECT queries

“select persons older than 30”

SELECT ?X WHERE { ?X a foaf:Person. ?X ex:age ?Y. FILTER (?Y > 30) }

Page 94: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Querying DBpedia

!  People Born in Galway "  Simple triple pattern

"  http://dbpedia.org/ontology/birthplace

!  Answer SELECT ?who!WHERE {! ?who !<http://dbpedia.org/ontology/birthplace> :Galway .!}!

Page 95: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Querying DBpedia

!  Japanese name of Galway

!  Using the FILTER by LANG clause "  FILTER(lang(?x) = "ja")

!  Answer SELECT ?name!WHERE {! :Galway rdfs:label ?name .! FILTER (lang(?name) = "ja") .!}!

Page 96: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Querying DBpedia

!  Irish cities at the east of Galway!

Page 97: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Querying DBpedia

!  FILTER by type and comparison of coordinates

!  Answer PREFIX yago: <http://dbpedia.org/class/yago/>!SELECT DISTINCT ?place ?long WHERE {! :Galway dbpedia2:westCoord ?glong .! ?place rdf:type! yago:CitiesInTheRepublicOfIreland ;! dbpedia2:westCoord ?long .! FILTER (?long < ?glong) !}!

Page 98: How to Build Linked Data Sites with Drupal 7 and RDFa

! !"#$%&'()*!+,,-!.'('*/0!12*3&$&'43!5343/&6)!724*'*8*39!:00!&'()*4!&343&;3<9

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

")/$*3&

=)%!.&8$/0

Page 99: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

What is Drupal?

2

Page 100: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

What IS Drupal?

Content Management System

CMS

Content Management Framework

CMF

3

Page 101: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

What IS Drupal?

CMS A package that a non-developer (or non-Web developer) can download and install quickly and easily to create a complex website

Runs on many servers, particularly Apache and MySQL which are used by many hosting providers

With Drupal 7, setup should take less than 10 minutes

A collection of modules that can be plugged into the

main package to bring advanced functionality to the site

At last count in Spring of 2009, there were 4400 modules on Drupal.org

Common quote: “There’s a module for that”

4

Page 102: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

What IS Drupal?

CMF Gets Web developers up and running with functionality quickly, but allows for a very high level of customization

A number of APIs for things such as form creation and processing

Hook system allows external modules to act when something happens in the main body of code

All templates can be overridden at a granular level

Allows Web developers to package up any custom functionality or configuration and distribute it widely to developers and non-developers alike

Modules

Themes

Installation Profiles and Features

5

Page 103: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

What does RDF in Drupal mean?

CMS Out of the box, content structures are mapped to RDF

Contributed modules offer advanced functionality without having to code anything

CMF RDF Mapping API in Drupal core package

A collection of RDF functions in a contributed API

15

Page 104: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Why Drupal?

1

Similarities

•Both have structured data

•Data is structured in a similar way—instances of types with properties and relationships

Page 105: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Why Drupal?

2

Differences

•Drupal’s structure stays hidden in the database, RDF structure is exposed on the page

•Drupal’s field names are unique to the site and not explicitly defined,RDF terms are universally dereferencable and explicitly defined

Page 106: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Default RDF mappings in core

5

•Node titles

•Submission information

•Comment count and comment relationships

•Users, names and homepages

•Taxonomy terms

•Featured images

... And you can define your own mappings for your content types or alter mappings for existing ones

Page 107: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

7

sioc:Item,

foaf:DocumentProduce and Consume

Linked Data with Drupal dc:title

dc:modified

sioc:num_replies

dc:created, dc:dateposted on October 22

content:encodedProduce and Consume Linked Data with Drupal! is the

title of the paper I will be presenting next week at

the 8th International Semantic Web Conference

(ISWC 2009) in Washington, DC. sioc:Post,

sioct:Comment

dc:modified

by Stéphane

foaf:name

foaf:homepage

sioc:User

sioc:

has_creator

sioc:reply_of

dc:title

Wow, that’s rad! dc:created, dc:date

posted on October 23 by Lincontent:encoded

Nice work!

Drupal ISWC RDFa

skos:Concept

skos:prefLabel,

rdfs:label

skos:description

sioc:topic

Page 108: How to Build Linked Data Sites with Drupal 7 and RDFa

posted on

<span property="dc:date dc:created"

content="2009-10-22T08:03:26-05:00"

datatype="xsd:dateTime">

October 22

</span>

by

<span rel="sioc:has_creator">

<span about="/user/6"

typeof="sioc:User"

property="foaf:name">

stephane

</span>

</span>

Digital Enterprise Research Institute www.deri.ie

8

Produce and Consume

Linked Data with Drupal

posted on October 22

Produce and Consume Linked Data with Drupal! is the

title of the paper I will be presenting next week at

the 8th International Semantic Web Conference

(ISWC 2009) in Washington, DC.

Drupal ISWC RDFa

by Stéphane

Wow, that’s rad!

posted on October 23 by Lin

Nice work!

Page 109: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF Mapping User Interface

User interface for site administrators to define new

mappings or alter existing mappings.

10

Page 110: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF SPARQL Endpoint

A RDF store that makes your site information available for SPARQL queries.

11

Page 111: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

RDF Proxy

A way of connecting nodes to RDF sources across the Web and automatically syncing your site’s information with the external source.

12

Page 112: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

14

Item for salegr:Offering

gr:hasPriceSpecification

gr:hasWarrantyScope

gr:hasWarrantyPromise

E-Commerce Module

Page 113: How to Build Linked Data Sites with Drupal 7 and RDFa

! !"#$%&'()*!+,,-!.'('*/0!12*3&$&'43!5343/&6)!724*'*8*39!:00!&'()*4!&343&;3<9

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

")/$*3&

=3**'2(!4*/&*3<!>'*)!.&8$/0!?

@!

A43!6/43

Page 114: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

.2))")#'*6%7,&*8'9+#%)":%$";)

Page 115: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

.2))")#'*6%7,&*8'9+#%)":%$";)

Page 116: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

.2))")#'*6%7,&*8'9+#%)":%$";)

! !"#$%&'$(&)%*+&(,*-.&/(*0&(1*2".3$/4

5 67(,"%$/*8$($*9"):*3.-/&;$(&)%*+,"<&;,+*=/&>,*2?@AB

5 @&>,*-.(()%*9)"*C$;,-))>

Page 117: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

.2))")#'*6%7,&*

Page 118: How to Build Linked Data Sites with Drupal 7 and RDFa

! !"#$%&'()*!+,,-!.'('*/0!12*3&$&'43!5343/&6)!724*'*8*39!:00!&'()*4!&343&;3<9

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

")/$*3&

=3**'2(!4*/&*3<!>'*)!.&8$/0!?

@!

A/2<4@#2!<3B#

Page 119: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Site Configuration

1

•Edit your site informationadmin/config/system/site-information

•Create a front pagenode/add & admin/config/system/site-information

•Change your site design and logoadmin/appearance

•Install modulesadmin/modules

•Configure Wysiwyg editoradmin/config/content/wysiwyg

Page 120: How to Build Linked Data Sites with Drupal 7 and RDFa

Digital Enterprise Research Institute www.deri.ie

Site Configuration

2

•Create Content Types & Add Fieldsadmin/structure/types

•Manage menusadmin/structure/menu/manage/main-menu

Review and find out more at:youtube.com/linwclark

Page 121: How to Build Linked Data Sites with Drupal 7 and RDFa

! !"#$%&'()*!+,,-!.'('*/0!12*3&$&'43!5343/&6)!724*'*8*39!:00!&'()*4!&343&;3<9

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

")/$*3&

5.=!'2!.&8$/0!>

Page 122: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

673%+5-'.!8'")'!+2,%&'/7+*

?@'<3#!A&#B!*)3!A8*8&3?

.&8$/0"#2!C#4*#2!+,,D

.&'34E!F3%2#*3

)**$GHH;'<3#9(##(0396#BH;'<3#$0/%I<#6'<JDKD>+LL+->>MDKK,DM,

Page 123: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

673%+5-'.!8'")'!+2,%&'/7+*

"#<3!4$&'2*

N/%!+,,-

.157!O/0P/%Q!7&30/2<

)**$GHH<&8$/09#&(H2#<3HKKRD+K

Page 124: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

673%+5-'.!8'")'!+2,%&'/7+*

)**$GHH*P'**3&96#BH<&'34H4*/*84HK-->RSSKRK

Page 125: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

90%+%/$*+"-$"/-'7:'.!8'")'!+2,%&';

! .&8$/0!>!6#&3

" 1T$#43!.&8$/0E4!</*/!'2!5.=/

" :8*#B/*'6/00%

" U#!5.=!3T$3&*'43!&3V8'&3<

! .&8$/0!>!6#2*&'W8*3<!B#<8034

" N#&3!5.=!A#&B/*4!X5.=HYNZQ!2*&'$034Q!*8&*03[

" =03T'W03!V83&%'2(!X\]:5^Z[

" 1T$#&*!/2<!7B$#&*

Page 126: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

<+/0"$*/$2+*

! \*&86*8&3<!</*/G!'24*/2634!#A!

*%$34!P'*)!$&#$3&*'34!/2<!

&30/*'#24)'$4

! "#2*32*!*%$3!J!5.=!60/44

! ='30<!J!5.=!$&#$3&*%

! U#<3!J!5.=!&34#8&63

)**$GHHPPP9A0'6F&96#BH$)#*#4H<#6B/2H++SMLMD+S,

Page 127: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

97)$*)$'$=,*-'%)5'8"*&5-

Page 128: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

97)$*)$'$=,*-'%)5'8"*&5-

Page 129: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

>75*

Page 130: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

.!8'%)5'.!8%

!!"#$%&'$()*+,*-,(

! ..#/$0&%$12-3$456&(/$7&8)&-(

! 922:;&/$1*<22=/$>*?&'223

Page 131: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

.!8'%)5'.!8%

! 922,7&;*)52+(

! "@$A$B&-?&+)$5+?-&*(&$5+$)-*C?

! 1*<22$2'(&-D&($*$EFA$5+?-&*(&$5+$)<&$#;5?3G)<-28:<G7*)&

Page 132: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

!+2,%&';'5*:%2&$'.!8'?/0*@%

Page 133: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

!+2,%&';'%)5'.!8

Page 134: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

! =_:=Q!\7_"Q!\`_\Q!."!a#8*!#A!*)3!W#Tb

! :00!843&4!)/;3!/2!#20'23!'<32*'*%G!

c3W7.G!d57!A#&!/2!'2<';'<8/0

e843&HRfB3!!!!!Jg!!A#/AG]3&4#2

e=_:=h\\Z!/8*)32*'6/*'#2

A*)*:"$-'7:'.!8'")'!+2,%&';

Page 135: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

! dW'V8'*%!5.=/

! \'2<'63!i!j)3!\3B/2*'6!c3W!'2<3T

)**$GHH8W'V8'*%i&<A/9(##(036#<396#BH4;2H*&82FH8W'V8'*%i0#/<3&9k4)**$GHH4'2<'6396#BH

B73'@%/0")*-'-**'!+2,%&',%#*-

Page 136: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*H2%$6*?<5+&($(&&$I-8B*;$B*:&(

! dW'V8'*%!5.=/

! \'2<'63!i!j)3!\3B/2*'6!c3W!'2<3T

Page 137: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*H2%$6*?<5+&($(&&$I-8B*;$B*:&(

! dW'V8'*%!5.=/

! \'2<'63!i!j)3!\3B/2*'6!c3W!'2<3T

.;2:$B2()$*($*$:-*B<

Page 138: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

! .&8$/0!J!$'#233&!"N\

! ]0/*A#&B!#A!6)#'63!A#&!B/2%!843!6/434

! 72A083263!*)3!*&32<4

! L,,9,,,!.&8$/0!4'*34!XSl[

!N#&3!5.=!</*/!#2!*)3!c3W

!+2,%&'%)5'60*'C*D'%$'&%+#*

Page 139: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

</E)73&*5#*@*)$-

97&&*%#2*-'%$'!(.1'%)5'F1>!'1):7+@%$"/-

60"-'37+E'0%-'D**)':2)5*5'D='$0*':7&&73")#'#+%)$-!\6'3263!=#82</*'#2!7&30/2<!82<3&!O&/2*!U#9!\=7H,DH"1H7SRD,!=]>H7"ji+,,>9K9K!\j51]

Page 140: How to Build Linked Data Sites with Drupal 7 and RDFa

!"#"$%&'()$*+,+"-*'.*-*%+/0'1)-$"$2$* 33345*+"4"*

60%)E-G

H2*-$"7)-I

0$$,JKK-*@%)$"/L5+2,%&4/7@K