1. Semantic Web in Action:
Web 3.0, Social Web
Linked Data, Be Aware!
S. Garlatti
10/09/09
2. Outline
¢ Semantic Web
¢ Linked Data
¢ SPARQL
page 2 Semantic Web in Action
3. Technological Issues
an Informal learning case
• I plan to ride in Europe for vacation, on a
motorcycle.
– I need to learn more about travelling on motorcycle
across Europe
• Rider’s apparel: boots, jackets, pants, gloves, armor, etc.
• Motorcycle accessories: luggages, side cases, topcases, tank
bags, GPS, etc.
• Riding issues, skills, etc.
– According to my social networks, I know there is a
teacher at Telecom Bretagne who used to ride
across Europe
page 3 Semantic Web in Action
4. Who is teaching at Telecom Bretagne and
riding a motorcycle across Europe?
page 4 Semantic Web in Action
5. Technological Issues
• Google Information retrieval
– Query : « teacher » « riding » « Europe »
« Motorbike »
• 613 000 results
• How to find out relevant resources?
• Polysemy
• Huge number of results!
page 5 Semantic Web in Action
8. Search in Picture Web Sites with
Geolocalization
page 8 Semantic Web in Action
9. Technological Issues
• Relevance of resources?
– Human interpretation
• Reuse, exchange and sharing of resources
– Computer would have the ability to get
content meaning!
– impossible?
page 9 Semantic Web in Action
10. Semantic Web
¢ The Semantic Web is a web of data.
• There is lots of data we all use every day, and it is not part of the
web.
• I can see my bank statements on the web, and my photographs, and
I can see my appointments in a calendar.
• But can I see my photos in a calendar to see what I was doing when I
took them?
• Can I see bank statement lines in a calendar?
¢ Why not?
• Because we don't have a web of data.
• Because data is controlled by applications, and each application
keeps it to itself.
Semantic Web in Action
11. Semantic Web
¢ The Semantic Web is about two things.
- It is about common formats for integration and combination of
data drawn from diverse sources
- On the contrary, the original Web is mainly concentrated on
the interchange of documents.
- It is also about language for recording how the data relates to
real world objects (meaning).
page 11 Semantic Web in Action
12. Semantic Web
¢ The Semantic Web
• That allows a person, or a machine, to start off in
one database, and then move through an unending
set of databases which are connected not by wires
but by being about the same thing.
• Provides a common framework that allows data to
be shared and reused across application, enterprise,
and community boundaries
page 12 Semantic Web in Action
13. The Semantic Web
¢ The Semantic Web is about two things.
- It is about common formats for integration and combination of
data drawn from diverse sources
- On the contrary, the original Web is mainly concentrated on
the interchange of documents.
- It is also about language for recording how the data relates to
real world objects (meaning).
page 13 Semantic Web in Action
14. The Semantic Web
¢ That allows a person, or a machine, to start off in
one database, and then move through an unending
set of databases which are connected not by wires
but by being about the same thing.
¢ Provides a common framework that allows data to
be shared and reused across application,
enterprise, and community boundaries
¢ The Semantic Web will enable machines to
COMPREHEND semantic documents and data, not
human speech and writings.
page 14 Semantic Web in Action
15. Linked Data
¢ Classic Web
• Data exposed to the web via HTML
• Web Pages Found via search engines
¢ What do we actually want?
• Use the web like a Single Global Database
• Ask Complex Queries over multiples pages / web
sites / data sources
page 15 Semantic Web in Action
16. The Semantic Web
• Resource Description
– Similar to simple sentence
• Subject Verb Complement
– Examples
• Telecom Bretagne has a president called XXX
• Telecom Bretagne is a French grande ecole
• Telecom Bretagne has a web site http://www.tele...
page 16 Semantic Web in Action
17. The Semantic Web
• Sentence meaning
– Different contexts à Different terms
• « director », « president », « Dean », …
– Meaning linked to communities of practices
• Use of common vocabularies!
• Named: Ontologies
• An ontology determine a unique meaning to verbs and
categories of subject and complement
page 17 Semantic Web in Action
18. The Semantic Web
• A little bit more formal
– Telecom Bretagne dbpprop:president XXX (en)
– Telecom Bretagne dbpprop:type French Grande Ecole (en)
– Telecom Bretagne dbpprop:website http://www.tele...
• Queries
– French Grande Ecole in which XXX is president?
• ?Grande_Ecole dbpprop:president XXX (en)
• ?Grande_Ecole dbpprop:type French Grande Ecole (en)
page 18 Semantic Web in Action
19. Linked Data
Who is teaching at Telecom Bretagne
and riding a motorcycle
across Europe?
page 19 Semantic Web in Action
20. Linked Data
¢ Trouver Tous les films
- Du genre « Thriller »
- ET classés au moins quatre par
- ET appréciés au moins par quatre de mes amis
– OU ceux qui me suivent sur
- ET dont Leonardo Di Caprio n’est pas un des acteurs ?
page 20
22. Linked Data
Web 1.0 Web 2.0 Web 3.0
Many
Web
sites
Few
large
Web
sites
Many
Web
sites
ontaining
unstructured,
are
specialized
on
containing
&
seman<cally
extual
content
specific
content
types
syndica<ng
arbitrarily
structured
content
Video
Pictures
Encyclopedic
+
ar3cles
+
Source
:
Dr. Sören Auer
AKSW, Institut für Informatik
page 22 Computer Science Department Semantic Web in Action
23. Linked Data
¢ Linked Data
• Is a term used to describe a method of exposing, sharing, and
connecting data on the Web via dereferenceable URIs.
¢ Principles (Tim Berners-Lee)
• The Semantic Web isn't just about putting data on the web. It is about making
links, so that a person or machine can explore the web of data. With linked
data, when you have some of it, you can find other, related, data.
• Like the web of hypertext, the web of data is constructed with documents on
the web. However, unlike the web of hypertext, where links are
relationships anchors in hypertext documents written in HTML, for data they
links between arbitrary things described by RDF. The URIs identify any kind of
object or concept.
Source : Wikipedia, Tim Berners Lee
page 23 Semantic Web in Action
24. Linked Data
¢ Tim Berners-Lee outlined four principles of Linked Data in
his Design Issues: Linked Data note, paraphrased along the
following lines:
• Use URIs to identify things that you expose to the Web as resources.
• Use HTTP URIs so that people can locate and look up (dereference)
these things.
• Provide useful information about the resource when its URI is
dereferenced.
• Include links to other, related URIs in the exposed data as a means of
improving information discovery on the Web.
page 24 Semantic Web in Action
25. Linked Data
¢ Linking Open Data Community Project
• The goal of the W3C Semantic Web Education and Outreach
group's Linking Open Data community project is to extend the
Web with a data commons by publishing various open datasets
as RDF on the Web and by setting RDF links between data
items from different data sources. As of October 2007, datasets
consist of over two billion RDF triples, which are interlinked by
over two million RDF links. (Wikipedia)
page 25 Semantic Web in Action
28. Linked Data
¢ DBpedia
• Is a community effort to extract structured information from
Wikipedia and to make this information available on the Web.
DBpedia allows you to ask sophisticated queries against
Wikipedia, and to link other data sets on the Web to Wikipedia
data.
¢ Resources
• http://wiki.dbpedia.org/About
• http://blog.dbpedia.org/
• http://www4.wiwiss.fu-berlin.de/dbpedia/dev/ontology.htm
page 28 Semantic Web in Action
29. Linked Data
¢ Examples
• THING à http://dbpedia.org/page/Brest%2C_France
• HTML à http://dbpedia.org/resource/Brest%2C_France
• RDF à http://dbpedia.org/data/Brest%2C_France
• http://dbpedia.org/page/%C3%89cole_nationale_sup
%C3%A9rieure_des_t%C3%A9l
%C3%A9communications_de_Bretagne
• http://dbpedia.org/page/Amy_Winehouse
• http://dbpedia.org/page/Berlin
page 29 Semantic Web in Action
30. Linked Data
¢ Dbpedia Sparql Endpoint
• Langage de requêtes SPARQL
• http://dbpedia.org/snorql/ *
• http://dbpedia.org/sparql
• Twinkle : a sparql query tool
- http://www.ldodds.com/projects/twinkle/
page 30 Semantic Web in Action
31. Linked Data
¢ FREEBASE
Website http://www.freebase.com/
http://www.freebase.com/docs/data
• View data about New York
- http://www.freebase.com/view/en/new_york
• RDF metadata about New York
- http://rdf.freebase.com/rdf/en.new_york
• Edit New York Topic
- http://www.freebase.com/edit/topic/en/new_york
• Explore New York Metadata
- http://www.freebase.com/tools/explore/en/new_york
Semantic Web in Action
page 31
32. Linked Data
¢ Semantic CrunchBase
• The free directory of technology companies,
people, and investors.
• http://cb.semsol.org/
• http://cb.semsol.org/sparql
• http://cb.semsol.org/company/techcrunch
• http://cb.semsol.org/product/facebook-platform
• http://cb.semsol.org/explore
Semantic Web in Action
33. Linked Data
¢ Les Smob : les Twitter version Web sémantique
• http://www.lespetitescases.net/smob-twitter-version-web-
semantique/
• http://smob.websemantique.org/sparql.php
• http://microplanet.sioc-project.org/sparql.php
Semantic Web in Action
34. Linked Data
¢ IMDB, Linked Movie Database http://www.linkedmdb.org/
• LinkedMDB publishes linked open data using the D2R Server.
The project aims at publishing the first open semantic web
database for movies, including a large number of interlinks to
several datasets on the open data cloud and references to
related webpages
¢ Data can be accessed using
• Web browsers: http://www.linkedmdb.org/
• Semantic Web browsers - entry point:
http://data.linkedmdb.org/all
• SPARQL clients - SPARQL endpoint:
http://data.linkedmdb.org/sparql
page 34 Semantic Web in Action
35. Linked Data
¢ Musicbrainz
• This is a database published with D2R Server. It can
be accessed using
- Your web browser http://dbtune.org/musicbrainz/
- Semantic Web browsers at URL http://dbtune.org/musicbrainz/all
- SPARQL clients at URL http://dbtune.org/musicbrainz/sparql or
In a web browser http://dbtune.org/musicbrainz/snorql/
page 35 Semantic Web in Action
36. Linked Data
¢ GovTrack.us
• A civic project to track congress
• The 2000 U.S. Census: 1 Billion RDF Triples
• http://www.rdfabout.com/demo/census/
• http://www.govtrack.us/developers/rdf.xpd
• The SPARQL endpoint is a combined endpoint for various RDF
data I play with. It answers queries about 1 billion triples,
mostly about U.S. Census data (see rdfabout.com), but also
the GovTrack data.
page 36 Semantic Web in Action
37. Linked Data
¢ GovTrack.us
• The SPARQL engine's base URL is
http://www.rdfabout.com/sparql , following (or trying to follow)
the SPARQL Protocol spec.
• The SPARQL engine is Ryan Levering's engine for SESAME,
plus my SemWeb library for C#.
• The data store is persisted in MySQL. Responses are limited to
1000 rows in the hopes that having this public won't break
anything.
page 37 Semantic Web in Action
38. Linked Data
¢ Revyu.com
• Revyu.com is a web site where you can review and rate things.
Unlike many other reviewing sites on the web, Revyu.com lets
you review and rate absolutely anything you can name
• Web access: http://revyu.com/
• SPARQL Endpoint http://revyu.com/sparql/
page 38 Semantic Web in Action
39. SPARQL: SPARQL Protocol and RDF Query
Language
¢ SPARQL
• pronounced "sparkle" [1]) is an RDF query language; its name
is a recursive acronym that stands for SPARQL Protocol and
RDF Query Language. It is standardized by the RDF Data
Access Working Group (DAWG) of the
World Wide Web Consortium, and is considered a component
of the semantic web.
• Initially released as a Candidate Recommendation in April
2006, but returned to Working Draft status in October 2006,
due to two open issues. [2] In June 2007, SPARQL advanced
to Candidate Recommendation once again. [3] On 12th
November 2007 the status of SPARQL changed into Proposed
Recommendation. [4] On 15th January 2008, SPARQL became
an official W3C Recommendation. [5]
page 39 Semantic Web in Action
40. SPARQL: SPARQL Protocol and RDF Query
Language
¢ SPARQL =
• A Query Language
• A Result Form
• An Access Protocol
page 40 Semantic Web in Action
41. SPARQL: SPARQL Protocol and RDF Query
Language
¢ The Query Language: query forms
• « Select » clause returns all or subset of the
variables bound in a query pattern match
• « Construct » returns an RDF graph constructed by
substituting variables in a set of triple templates
• « Ask » returns a boolean indicating whether a query
pattern matches
• « Describe » returns an RDF graph that describe the
resources found
page 41 Semantic Web in Action
42. SPARQL: SPARQL Protocol and RDF Query
Language
¢ «Select » equivalent to « SQL Select » returns a
regular table
Select …
From … Identify data sources to query
Where { … } The triple/graph pattern
to be matched against the
triple/graphs of RDF
A conjunction of triples
¢ PREFIX to declare the schema used in the query
page 42 Semantic Web in Action
43. SPARQL: SPARQL Protocol and RDF Query
Language
¢ PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name
FROM <http://example.org/foaf/aliceFoaf>
WHERE
{
?x foaf:name ?name
}
Result:
name
« Alice »
page 43 Semantic Web in Action
44. SPARQL: SPARQL Protocol and RDF Query
Language
¢
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
SELECT distinct ?name ?birth ?person
FROM http://dbpedia.org/
WHERE
¢ {
?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin>.
?person dbpedia2:birth ?birth .
?person foaf:name ?name .
}
page 44 Semantic Web in Action
45. SPARQL: SPARQL Protocol and RDF Query
Language
¢ SPARQL results:
¢ namebirthperson« ":Dru_Berrymore/birth/birth_date_and_age :Dru_Berrymore
"Dru Berrymore"@de:Dru_Berrymore/birth/birth_date_and_age :Dru_Berrymore
"Walter Benjamin"@de:Berlin :Walter_Benjamin "Walter
Benjamin"@de:Germany :Walter_Benjamin
Name Birth Person
« Dru Berrymore »
page 45 Semantic Web in Action
46. SPARQL: SPARQL Protocol and RDF Query
Language
¢ SELECT distinct ?name ?person
FROM <http://dbpedia.org/>
WHERE
{
?person dbpedia2:birthPlace <http://dbpedia.org/
resource/Berlin> .
?person foaf:name ?name .
}
¢ SELECT distinct ?name ?birth ?death ?person
FROM <http://dbpedia.org/>
WHERE
{
?person dbpedia2:birthPlace <http://dbpedia.org/
resource/Berlin> .
?person dbpedia2:birth ?birth .
?person foaf:name ?name .
?person dbpedia2:death ?death.
}
page 46 Semantic Web in Action
47. SPARQL: SPARQL Protocol and RDF Query
Language
¢ A
constraint, expressed by the keyword “FILTER”,
is a restriction on solutions over the whole group
in which the filter appears
¢ PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ns: <http://example.org/ns#>
SELECT ?title ?price
WHERE
{
?x ns:price ?price .
FILTER (?price < 30.5)
?x dc:title ?title .
}
page 47 Semantic Web in Action
48. SPARQL: SPARQL Protocol and RDF Query
Language
¢ “regex” matches only plain literals with no
language tag
¢ { ?x foaf:name ?name .
?x foaf:mbox ?mbox .
FILTER regex(?name, "Smith") }
¢ PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?title
WHERE
{ ?x dc:title ?title
FILTER regex(?title, "web", "i" ) }
page 48 Semantic Web in Action
49. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Optional parts of the graph pattern may be
specified syntactically with the “OPTIONAL”
keyword applied to a graph pattern
¢ SELECT distinct ?name ?birth ?death ?person
FROM <http://dbpedia.org/>
WHERE
{ ?person dbpedia2:birthPlace <http://
dbpedia.org/resource/Berlin> .
?person dbpedia2:birth ?birth .
?person foaf:name ?name .
OPTIONAL {?person dbpedia2:death ?death}
}
page 49 Semantic Web in Action
50. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Matching alternative
• Pattern alternatives are syntactically specified
with the UNION keyword
¢ SELECT distinct ?name ?birth ?death ?person
WHERE {
{?person dbpedia2:birthPlace
<http://dbpedia.org/resource/Berlin> }
UNION
{?person dbpedia2:death ?death}
?person foaf:name ?name .
?person dbpedia2:birth ?birth .
}
page 50 Semantic Web in Action
51. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Sequence & Modify
• « Order By » to sort,
• « LIMIT » result number,
• « OFFSET » rank of first result
¢ SELECT distinct ?name ?person
WHERE
{
?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin>.
?person foaf:name ?name.
}
ORDER BY ?name LIMIT 20 OFFSET 20
page 51 Semantic Web in Action
52. SPARQL: SPARQL Protocol and RDF Query
Language
¢ « Construct »
• The CONSTRUCT query form returns a single RDF
graph specified by a graph template.
- The result is an RDF graph formed by taking each query
solution in the solution sequence, substituting for the
variables in the graph template, and combining the triples into
a single RDF graph by set union.
• Useful for aggregating data from multiple sources
and merging it into a local store (from Ingenta)
page 52 Semantic Web in Action
53. SPARQL: SPARQL Protocol and RDF Query
Language
¢ PREFIX foaf: <http://xmlns.com/foaf/0.1/>
FROM <http://molene.enstb.org/mlearning09/wp-
content/plugins/wp-rdfa/foaf.php
CONSTRUCT
{
?friend a foaf:Person;
foaf:name ?name;
foaf:homepage ?home.}
WHERE
{
?person foaf:mbox <mailto:ac@enstb.com>;
foaf:knows ?friend.
?friend foaf:name ?name;
foaf:homepage ?home.}
page 53 Semantic Web in Action
54. SPARQL: SPARQL Protocol and RDF Query
Language
¢ ASK
• Returns a true/false value: test whether or not a query pattern
has a solution.
• No information is returned about the possible query solutions,
just whether or not a solution exists
• Is there data that looks like this? Do you have any information
about that? (from Ingenta)
¢ PREFIX foaf: <http://xmlns.com/foaf/0.1/>
ASK
WHERE {
?person a foaf:Person;
foaf:mbox <mailto:ab@telecom-bretagne>.
}
page 54 Semantic Web in Action
55. SPARQL: SPARQL Protocol and RDF Query
Language
¢ DESCRIBE
• The DESCRIBE form returns a single result RDF
graph containing RDF data about resources.
• CONSTRUCT but with less control
- Tell me about this or things that look like this … but you
decide what’s relevant (from Ingenta)
¢ PREFIX foaf: <http://xmlns.com/foaf/0.1/>
DESCRIBE ?friend
WHERE {
?person foaf:mbox “mailto:ab@telecom-bretagne”;
foaf:knows ?friend.}
page 55 Semantic Web in Action
56. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Applied uses (from Ingenta)
• DESCRIBE for Prototyping
- DESCRIBE <http://example.org/someResource>
- Quickly assembling Uis, Web APIs
• SELECT for Indexing
- Building an ordering over some data ORDER BY, LIMIT
page 56 Semantic Web in Action
57. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Applied uses (from Ingenta)
• CONSTRUCT for transformation and also simple
inferencing
- CONSTRUCT could be the XSLT of RDF
- Currently limited by lack of expressions in CONSTRUCT
triple templates
• ASK for validation
• ASK – DESCRIBE – CONSTRUCT Pattern:
- Probe endpoint, Grab default view of data, Refine data extraction and/or
apply transformation
page 57 Semantic Web in Action
58. SPARQL: SPARQL Protocol and RDF Query
Language
¢ SPARQL Protocol (from F. Gandon, INRIA)
• Sending queries and their results accross the web
¢ Example with HTTP binding
• GET /sparql/?query=<encoded query>
HTTP/1.1
Host: www.inria.fr
User-agent: my-sparql-client/0.1
page 58 Semantic Web in Action
59. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Example with SOAP binding (from F. Gandon)
¢ <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<query-request xmlns="http://www.w3.org/2005/09/sparql-
protocol-types/#">
<query> SELECT ?x ?p ?y WHERE {?x ?p ?y} </query>
</query-request>
</soapenv:Body>
</soapenv:Envelope>
page 59 Semantic Web in Action
60. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Access to Data on the web
• http://dbpedia.org/snorql/
• http://dbpedia.org/sparql
• http://demo.openlinksw.com/rdfbrowser2/
• http://dataviewer.zitgist.com/
• Etc.
¢ Twinkle : a sparql query tool
• http://www.ldodds.com/projects/twinkle
page 60 Semantic Web in Action
61. SPARQL: SPARQL Protocol and RDF Query
Language
¢ Resources
• http://en.wikipedia.org/wiki/SPARQL
• http://www.w3.org/TR/rdf-sparql-query/
• http://jena.sourceforge.net/ARQ/Tutorial/
• http://esw.w3.org/topic/SparqlImplementations
• http://arc.semsol.org/home
• http://virtuoso.openlinksw.com/wiki/main/Main/
page 61 Semantic Web in Action