graphic with four colored squares
Cover page images (keys)

Mission Possible: Deploying Government Linked Data (Pt1)

Sandro Hawke, (sandro@w3.org), W3C/MIT, @sandhawke
John L. Sheridan, @johnlsheridan
gov 2.0 expo, May 25-26, 2010, Washington DC
http://www.w3.org/2010/Talks/0525-linked-data (wiki)

Mission Possible

Part 1:

Part 2:

Part 3:

please send comments and questions to sandro@w3.org subject 'tutorial'

Part 1: Fundamentals

About Us

About You (Just Curious)

Context

Download and Programmatic Access

About the "Semantic Web"

sw-horz-w3c.png

See Kate Ray's Web 3.0 Video (esp. until 3:37 or 6:50)

Linked Data has a narrower goal; uses some of the same technologies.

What Is Linked Data?

Extending spreadsheets and databases to work over the Web.

  1. Give web identifiers (URIs) to things
  2. Publish information about them as Web Resources (good website architecture)
  3. Use Triples (subject, property, value)

triple.png

Data at http://dbpedia.org/page/Massachusetts
SubjectPropertyValue
http://dbpedia.org/resource/Massachusettshttp://dbpedia.org/resource/nickname"Bay State"

Benefits of Linked Data


Why does Linked Data make sense for government?

RDF Triples

drawing.png

Quick Demo

Data at http://dbpedia.org/page/Massachusetts
SubjectPropertyValue
http://dbpedia.org/resource/Massachusettsnickname"Bay State"

So How Do You Add Your Data?

  1. Think in Subject-Property-Value Triples
  2. Use URIs
  3. Publish on the Web

URIs (A Little Web Architecture)

URIs are like URLs, with a few extra tricks.

Long history, "Web Architecture", lots of debate.

Here it is, put simply.

Information Resource

Resource

FA___Toothless_HTTYD_by_Madelonetjj.jpg

art credit

URLs identify Information Resources

URIs identify Resources

Any resource. Using filenames for things that aren't files.

Hash and Slash

Two kinds of indirection:

Hash vs Slash

Hash URIs:

Slash URIs:

You'll see both.

When publishing, your software may choose for you.

Review

  1. Use URIs to identify things
  2. Think in Triples
  3. Publish on the web

Publishing Data

Publication Method Advantages Disadvantages
RDF/XML Document Oldest, best supported Confusingly like normal XML
Turtle (N3) Document Simplest Not technically a standard yet
HTML Document with RDFa Fits inside HTML attributes Can get very complicated
JSON Normal JSON, but also RDF Promising, but still being developed
GRDDL Use the XML you have/want Needs to download+run XSLT
SPARQL Query Protocol Query Protocol

RDF/XML Example

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:db="http://dbpedia.org/resource/">
  <rdf:Description rdf:about="http://dbpedia.org/resource/Massachusetts">
    <db:Governor>
      <rdf:Description rdf:about="http://dbpedia.org/resource/Deval_Patrick" />
    </db:Governor>
    <db:Nickname>Bay State</db:Nickname>
    <db:Capital>
      <rdf:Description rdf:about="http://dbpedia.org/resource/Boston"> 
         <db:Nickname>Beantown</db:Nickname>
      </rdf:Description>
    </db:Capital>
  </rdf:Description>
</rdf:RDF>

validator

Turtle Prefixes

First triple:

<http://dbpedia.org/resource/Massachusetts> 
   <http://dbpedia.org/resource/Governor> 
       <http://dbpedia.org/resource/Deval_Patrick> .

Abbreviate it:

@prefix db: <http://dbpedia.org/resource/>

db:Massachusetts db:Governor db:Deval_Patrick.

Turtle Example

@prefix db: <http://dbpedia.org/resource/> 

db:Massachusetts db:Governor db:Deval_Patrick;
                 db:Nickname "Bay State";
                 db:Capital db:Boston.
db:Boston        db:Nickname "Beantown".

RDFa Example

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
    "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:db="http://dbpedia.org/resource/"
      version="XHTML+RDFa 1.0">
  <head>
    <title>About Massachusetts</title>
  </head>
  <body>
    <div about="http://dbpedia.org/resource/Massachusetts">The
    Massachusetts governor is
      <span rel="db:Governor">
	<span about="http://dbpedia.org/resource/Deval_Patrick">Deval
	Patrick
	</span>,
      </span>
      the nickname is "<span property="db:Nickname">Bay State</span>",
      and the capital
      <span rel="db:Capital">
	<span about="http://dbpedia.org/resource/Boston">
	  has the nickname "<span property="db:Nickname">Beantown</span>".
	</span>
      </span>
    </div>
  </body>
</html>

distiller community site

One Possible RDF-JSON Example

{ "__iri": "db:Massachusetts",
  "db:Nickname": "Bay State",
  "db:Governor": { "__iri": "db:Deval_Patrick"  },
  "db:Capital": {  "__iri": "db:Boston",
                   "db:Nickname": "Beantown"
                 },
  "__prefixes": { "db:": "http://dbpedia.org/resource/" }
}

One Possible GRDDL Example

<MyDataSet xmlns="http://example.org/my-data-xml-namespace">
  <State>
    <name>Massachusetts</name>
    <governor>Deval_Patrick</governor>
    <nickname>Bay State</nickname>
    <capital>
      <name>Boston</name>
      <nickname>Beantown</nickname>
    </capital>
  </State>
</MyDataSet>

All the hard work is done by an XSLT program downloaded via the XML namespace URL. (Not implemented for this demo, sorry.)

spec demo service

SPARQL

prefix db: <http://dbpedia.org/resource/>
prefix dbo: <http://dbpedia.org/ontology/>
SELECT ?dnym WHERE { db:Massachusetts dbo:demonym ?dnym }
prefix db: <http://dbpedia.org/resource/>
prefix dbo: <http://dbpedia.org/ontology/>
SELECT ?cap WHERE { db:Massachusetts dbo:capital ?cap }

dbpedia sparql service and sparql tutorial

Content Negotiation

How do you manage all these options?

Try:

curl -L --header "Accept: application/rdf+xml" http://vocab.deri.ie/dcat
curl -L --header "Accept: text/turtle" http://vocab.deri.ie/dcat
curl -L --header "Accept: text/html" http://vocab.deri.ie/dcat

Challenges