LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
1st	
  Summer	
  School	
  on	
  	
  
Smart	
  Ci2es	
  and	
  Linked	
  Open	
  Data	
  (LD4SC-­‐15)	
  
RDF(S)	
  and	
  SPARQL	
  
Pieter	
  Pauwels,	
  Ghent	
  University	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  cool	
  and	
  awesome	
  intro	
  movies	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
hIps://vimeo.com/36752317	
  
hIps://www.youtube.com/watch?v=4x_xzT5eF5Q	
  
	
  
2	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
3	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
RDF	
  graphs,	
  what	
  are	
  they	
  
RDF	
  graphs	
  are	
  DIRECTED,	
  LABELLED	
  GRAPHS	
  
4	
  
P. Pauwels, D. Van Deursen, R. Verstraeten, J. De Roo, R. De Meyer, R. Van de Walle, J. Van Campenhout. A semantic
rule checking environment for building performance checking. Automation in Construction 20(5) 2011, 506-518.
LABELLED	
  
DIRECTED	
  
Triple	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
RDF	
  graphs,	
  what	
  are	
  they	
  NOT	
  
Hierarchies	
  (cfr.	
  XML)	
  
	
  
	
  
	
  
	
  
	
  
RelaYonal	
  databases	
  	
  
(cfr.	
  MySQL,	
  SQLServer)	
  
	
  
	
  
	
  
	
  
	
  5	
  
RDF	
  graphs	
  are	
  
DIRECTED,	
  LABELLED	
  
GRAPHS	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
A	
  triple	
  
6	
  
Triple	
  
SUBJECT	
   OBJECT	
  
PREDICATE	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
ConnecYng	
  Triples	
  
7	
  
SUBJECT	
   OBJECT	
  
PREDICATE	
  
OBJECT	
  
PREDICATE	
  
OBJECT	
  
PREDICATE	
  
OBJECT	
  PREDICATE	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  result:	
  an	
  RDF	
  graph	
  
8	
  
LABELLED	
  
DIRECTED	
  
Triple	
  
That	
  is	
  it:	
  simple	
  directed	
  labelled	
  graphs,	
  always	
  remember	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
9	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Talking	
  the	
  RDF	
  language	
  
•  RDF	
  stands	
  for	
  Resource	
  DescripYon	
  Framework	
  
•  RDF	
  is	
  a	
  standard	
  data	
  model	
  for	
  describing	
  web	
  resources	
  
–  Note:	
  ‘web	
  resources’	
  can	
  make	
  statements	
  about	
  anything	
  in	
  the	
  real	
  
world:	
  DBPedia,	
  geography,	
  building	
  informaYon,	
  sensors,	
  …	
  anything	
  
goes	
  
•  RDF	
  is	
  designed	
  to	
  be	
  read	
  and	
  understood	
  by	
  computers	
  
•  RDF	
  is	
  not	
  designed	
  for	
  being	
  displayed	
  to	
  people	
  
•  RDF	
  is	
  wriIen	
  in	
  XML	
  
•  RDF	
  is	
  a	
  W3C	
  RecommendaYon	
  
10	
  
hIp://www.w3schools.com/webservices/ws_rdf_intro.asp	
  
easily	
  used	
  
usually	
  
-­‐>	
  standardisaYon	
  
not	
  a	
  file	
  format,	
  
not	
  a	
  syntax,	
  not	
  a	
  
schema,	
  …	
  =>	
  a	
  
data	
  model	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  SemanYc	
  Web	
  stack	
  
11	
  
Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Syntaxes	
  for	
  serialisaYon	
  
12	
  
Triple	
  
RDF/XML	
  
Turtle	
  (TTL)	
  
NotaYon-­‐3	
  (N3)	
  
…	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Expressiveness	
  of	
  syntaxes	
  
13	
  
http://www.w3.org/DesignIssues/diagrams/n3/venn
We	
  s2ck	
  to	
  Turtle	
  today	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  TTL	
  file	
  
	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  b:hasRoom	
  <hIp://www.R4SC.net/today#room_1>	
  ;	
  	
  
	
  b:hasName	
  “Our	
  summer	
  school	
  building";	
  	
  
	
  c:partOfCity	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  c:closeToCity	
  <hIp://ciYes.com/#madrid>	
  ;	
  
	
  c:hasName	
  “Cercedilla”	
  .	
  
	
  
14	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  TTL	
  graph	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  same	
  thing	
  in	
  RDF/XML	
  
<?xml	
  version="1.0"	
  encoding="UTF-­‐8"?>	
  
<rdf:RDF	
  xmlns:b="hIp://www.R4SC.net/building#"	
  xmlns:c="hIp://www.R4SC.net/
city#"	
  xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#">	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:about="hIp://www.R4SC.net/today#building_1">	
  
	
  	
  	
  	
   	
   	
  <c:partOfCity	
  rdf:resource="hIp://ciYes.com/#cercedilla"/>	
  
	
  	
  	
  	
   	
   	
  <b:hasName>Our	
  summer	
  school	
  building</b:hasName>	
  
	
  	
  	
  	
   	
   	
  <b:hasRoom	
  rdf:resource="hIp://www.R4SC.net/today#room_1"/>	
  
	
   	
  	
  </rdf:DescripYon>	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:about="hIp://ciYes.com/#cercedilla">	
  
	
  	
  	
  	
   	
   	
  <c:hasName>Cercedilla</c:hasName>	
  
	
  	
  	
  	
   	
   	
  <c:closeToCity	
  rdf:resource="hIp://ciYes.com/#madrid"/>	
  
	
  	
   	
  </rdf:DescripYon>	
  
</rdf:RDF>	
  
16	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Convert	
  to	
  different	
  syntaxes	
  
Convert	
  to/from	
  syntaxes:	
  
	
  
	
  
	
   	
  hIp://rdf-­‐translator.appspot.com/	
  
	
  
	
  
Or	
  simply	
  build	
  and	
  use	
  your	
  own	
  sosware	
  tool	
  
	
  
17	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
18	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Uniform	
  Resource	
  IdenYfiers	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
What	
  is	
  a	
  URI?	
  
•  URI	
  stands	
  for	
  Uniform	
  Resource	
  IdenYfier	
  
•  Purpose:	
  Obtain	
  globally	
  unique	
  idenYfiers,	
  so	
  that	
  informaYon	
  
can	
  be	
  exchanged	
  globally.	
  
•  Structure:	
  
	
  <hIp://www.R4SC.net/today#building_1>	
  
•  Namespace	
  needed	
  to	
  avoid	
  name	
  conflicts	
  with	
  tags	
  of	
  the	
  
same	
  name:	
  other	
  tags	
  with	
  the	
  name	
  “building_1”	
  can	
  be	
  
defined	
  with	
  other	
  namespace	
  URIs,	
  and	
  an	
  RDF	
  reader	
  would	
  
sYll	
  be	
  able	
  to	
  tell	
  that	
  they	
  were	
  different	
  properYes	
  even	
  
though	
  they	
  had	
  the	
  same	
  tag	
  name.	
  
20	
  
Namespace	
   Name	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Full	
  version	
  of	
  the	
  URIs	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  
<hIp://www.R4SC.net/today#room_1>	
  
	
  
<hIp://www.R4SC.net/building#hasRoom	
  >	
  
<hIp://www.R4SC.net/building#hasName	
  >	
  
	
  
<hIp://www.R4SC.net/city#partOfCity>	
  
<hIp://www.R4SC.net/city#closeToCity>	
  
<hIp://www.R4SC.net/city#hasName>	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  
<hIp://ciYes.com/#madrid>	
  
	
  
	
  
	
  
21	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  TTL	
  file	
  
	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  b:hasRoom	
  <hIp://www.R4SC.net/today#room_1>	
  ;	
  	
  
	
  b:hasName	
  “Our	
  summer	
  school	
  building";	
  	
  
	
  c:partOfCity	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  c:closeToCity	
  <hIp://ciYes.com/#madrid>	
  ;	
  
	
  c:hasName	
  “Cercedilla”	
  .	
  
	
  
22	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Prefixed	
  URIs	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
@prefix	
  bi:	
  <hIp://www.R4SC.net/today#>	
  .	
  	
  
@prefix	
  ci:	
  <	
  hIp://ciYes.com/#	
  >	
  .	
  	
  
	
  
bi:building_1	
  
bi:room_1	
  
	
  
b:hasRoom	
  
b:hasName	
  
	
  
c:partOfCity	
  
c:closeToCity	
  
c:hasName	
  
	
  
ci:madrid	
  
ci:cercedilla	
  
	
  
23	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
TTL	
  file	
  with	
  fully	
  qualified	
  names	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  <hIp://www.R4SC.net/building#hasRoom	
  >	
  
	
   	
   	
   	
   	
   	
  <hIp://www.R4SC.net/
today#room_1>	
  ;	
  	
  
	
  <hIp://www.R4SC.net/building#hasName	
  >	
  	
  “Our	
  summer	
  school	
  building";	
  	
  
	
  <hIp://www.R4SC.net/city#partOfCity	
  >	
  	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  <hIp://www.R4SC.net/city#closeToCity	
  >	
  	
  <hIp://ciYes.com/#madrid>	
  ;	
  
	
  <hIp://www.R4SC.net/city#hasName	
  >	
  	
  “Cercedilla”	
  .	
  
	
  
24	
  
-­‐>	
  prefixes	
  increase	
  readibility	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
25	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Statements	
  
Statement	
  
Statement	
  
Statement	
  
Statement	
  
Statement	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Statement	
  follows	
  triple	
  structure	
  
	
  
	
  
	
  
	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  
	
  <hIp://www.R4SC.net/city#partOfCity	
  >	
  	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
27	
  
Triple	
  
<hIp://
www.R4SC.net/
today#building_1>	
  
<hIp://ciYes.com/
#cercedilla>	
  
<hIp://www.R4SC.net/
city#partOfCity>	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Combining	
  statements	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  <hIp://www.R4SC.net/building#hasRoom	
  >	
  
	
   	
   	
   	
   	
   	
  <hIp://www.R4SC.net/
today#room_1>	
  ;	
  	
  
	
  <hIp://www.R4SC.net/building#hasName	
  >	
  	
  “Our	
  summer	
  school	
  building";	
  	
  
	
  <hIp://www.R4SC.net/city#partOfCity	
  >	
  	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  <hIp://www.R4SC.net/city#closeToCity	
  >	
  	
  <hIp://ciYes.com/#madrid>	
  ;	
  
	
  <hIp://www.R4SC.net/city#hasName	
  >	
  	
  “Cercedilla”	
  .	
  
	
  
28	
  
Same	
  subject	
  
AND	
  [next	
  statement]	
  
Same	
  subject	
  
Same	
  subject	
  
AND	
  [next	
  statement]	
  
,	
  !	
  Same	
  subject,	
  same	
  predicate	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
List	
  of	
  all	
  statements	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
   	
  <hIp://www.R4SC.net/
building#hasRoom	
  >	
  	
  
	
   	
  <hIp://www.R4SC.net/today#room_1>	
  .	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
   	
  <hIp://www.R4SC.net/
building#hasName	
  >	
  	
  “Our	
  summer	
  school	
  building”	
  .	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  <hIp://www.R4SC.net/city#partOfCity	
  >	
  	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  <hIp://www.R4SC.net/city#closeToCity	
  >	
  	
  <hIp://ciYes.com/#madrid>	
  .	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  <hIp://www.R4SC.net/city#hasName	
  >	
  	
  “Cercedilla”	
  .	
  
	
  
29	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Statements	
  
Statement	
  
Statement	
  
Statement	
  
Statement	
  
Statement	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
31	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Recap	
  on	
  the	
  URIs	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
URI	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Literals	
  in	
  the	
  statements	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
   	
  <hIp://www.R4SC.net/
building#hasRoom	
  >	
  	
  
	
   	
  <hIp://www.R4SC.net/today#room_1>	
  .	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
   	
  <hIp://www.R4SC.net/
building#hasName	
  >	
  	
  “Our	
  summer	
  school	
  building”	
  .	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  <hIp://www.R4SC.net/city#partOfCity	
  >	
  	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  <hIp://www.R4SC.net/city#closeToCity	
  >	
  	
  <hIp://ciYes.com/#madrid>	
  .	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  <hIp://www.R4SC.net/city#hasName	
  >	
  	
  “Cercedilla”	
  .	
  
	
  
33	
  
Literal	
  
Literal	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
ConvenYonal	
  representaYon	
  /	
  
disYncYon	
  from	
  regular	
  resources	
  
Resource	
  
Resource	
  
Resource	
  
Resource	
  
Literal	
  
Literal	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Similar	
  yet	
  disYnct	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
@prefix	
  xsd:	
  <hIp://www.w3.org/2001/XMLSchema>.	
  	
  
	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  	
  b:hasName 	
  “Our	
  summer	
  school	
  building”	
  ,	
  
	
   	
   	
   	
   	
   	
  “Our	
  summer	
  school	
  building”@en	
  ,	
  
	
   	
   	
   	
   	
   	
  “Our	
  summer	
  school	
  
building”^^xsd:string	
  
	
  
	
  
35	
  
Untyped	
  
Typed	
  
Literal	
  with	
  
language	
  seWng	
   Referring	
  to	
  type	
  
within	
  specific	
  
namespace	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
What	
  is	
  available	
  in	
  xsd	
  
36	
  
http://www.w3.org/TR/xmlschema-2/
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
What	
  is	
  available	
  in	
  xsd	
  
37	
  
http://www.xml.dvint.com/docs/SchemaDataTypesQR-2.pdf
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
If	
  you	
  do	
  not	
  like	
  xsd...	
  
Simply	
  define	
  your	
  own	
  datatypes…	
  
	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
@prefix	
  dt:	
  <	
  hIp://www.R4SC.net/todaysdts#>	
  .	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  	
  b:hasName 	
  “Our	
  summer	
  school	
  building”^^dt:myTypeOfString	
  
	
  
	
  
	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  Collec2ons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
39	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
RepeaYng	
  properYes	
  
•  I	
  have	
  a	
  property	
  that	
  can	
  have	
  mulYple	
  values,	
  
now	
  what?	
  
– SoluYon	
  1:	
  Simply	
  repeat	
  the	
  property	
  of	
  the	
  
resource	
  mulYple	
  Ymes.	
  	
  
– SoluYon	
  2:	
  Use	
  a	
  structured	
  value	
  for	
  a	
  literal	
  
– SoluYon	
  3:	
  Use	
  an	
  RDF	
  Container	
  (Sequence,	
  Bag,	
  
or	
  Alt)	
  or	
  CollecYon	
  (RDF	
  List)	
  
http://patterns.dataincubator.org/book/repeated-property.html
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  for	
  soluYon	
  1:	
  simply	
  
repeaYng	
  property	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  
	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPersonInside	
  <hIp://www.R4SC.net/today#PieterPauwels>	
  ,
	
   	
   	
  <hIp://www.R4SC.net/today#RaulGarciaCastro>	
  ,
	
   	
   	
   	
  <hIp://www.R4SC.net/
today#AsuncionGomezPerez>	
  , 	
   	
   	
  <hIp://www.R4SC.net/
today#MariaPovedaVillalon>	
   	
  , 	
   	
   	
  <hIp://
www.R4SC.net/today#FilipRadulovic>	
  .	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  for	
  soluYon	
  2:	
  Use	
  a	
  
structured	
  value	
  for	
  a	
  literal	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  
	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPeopleInside	
  “IRECOGNIZETHIS:PieterPauwels;	
  IRECOGNIZETHIS:	
  
RaulGarciaCastro;	
  IRECOGNIZETHIS:AsuncionGomezPerez;	
  IRECOGNIZETHIS:	
  
MariaPovedaVillalon;	
  IRECOGNIZETHIS:	
  FilipRadulovic”	
  
=>	
  NOT	
  recommended!!	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  for	
  soluYon	
  3	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  
	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPeopleInside	
  (	
  <hIp://www.R4SC.net/today#PieterPauwels>	
  
	
   	
   	
  <hIp://www.R4SC.net/today#RaulGarciaCastro>	
  
	
   	
   	
   	
  <hIp://www.R4SC.net/
today#AsuncionGomezPerez>	
   	
   	
   	
  <hIp://www.R4SC.net/
today#MariaPovedaVillalon>	
   	
   	
   	
   	
  <hIp://
www.R4SC.net/today#FilipRadulovic>	
  )	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
So,	
  what	
  are	
  our	
  opYons	
  for	
  soluYon	
  3?	
  
•  Apart	
  from	
  resources	
  and	
  literals,	
  it	
  is	
  also	
  
possible	
  to	
  describe	
  ‘containers’	
  and	
  
‘collecYons’	
  
•  Containers	
  
– Bags	
  
– Sequences	
  
– Alt	
  
•  CollecYons	
  
– Lists	
  
used	
  to	
  describe	
  groups	
  that	
  can	
  
ONLY	
  contain	
  the	
  specified	
  
members	
  
used	
  to	
  describe	
  an	
  open	
  groups	
  
of	
  things	
  (unknown	
  length)	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Bags	
  –	
  Seqs	
  –	
  Alts	
  ??	
  
•  Bag	
  
–  Unordered	
  
–  Resources	
  or	
  literals	
  
–  Duplicate	
  values	
  are	
  permiIed	
  
•  Sequence	
  (Seq)	
  
–  Ordered	
  
–  Resources	
  or	
  literals	
  
–  Duplicate	
  values	
  are	
  permiIed	
  
•  AlternaYve	
  (Alt)	
  
–  Unordered	
  
–  Resources	
  or	
  literals	
  
–  Alterna2ves	
  for	
  a	
  single	
  property	
  value	
  (cfr.	
  language	
  
alternaYves)	
  
These	
  are	
  the	
  convenYons	
  /	
  they	
  are	
  ‘just’	
  convenYons	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
List	
  
•  List	
  
– Ordered	
  
– Resources	
  or	
  literals	
  
– Duplicate	
  values	
  are	
  permiIed	
  
– Closed	
  collecYon	
  –	
  length	
  of	
  list	
  is	
  known	
  
•  So,	
  idenYcal	
  to	
  a	
  sequence,	
  except	
  that	
  the	
  
collecYon	
  is	
  closed:	
  only	
  the	
  listed	
  items	
  are	
  in	
  
the	
  List,	
  nothing	
  else	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Back	
  to	
  our	
  example	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  
	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPeopleInside	
  (	
  <hIp://www.R4SC.net/today#PieterPauwels>	
  
	
   	
   	
  <hIp://www.R4SC.net/today#RaulGarciaCastro>	
  
	
   	
   	
   	
  <hIp://www.R4SC.net/
today#AsuncionGomezPerez>	
   	
   	
   	
  <hIp://www.R4SC.net/
today#MariaPovedaVillalon>	
   	
   	
   	
   	
  <hIp://
www.R4SC.net/today#FilipRadulovic>	
  )	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  downside	
  of	
  soluYon	
  3	
  
<?xml	
  version="1.0"	
  encoding="UTF-­‐8"?>	
  
<rdf:RDF	
  xmlns:b="hIp://www.R4SC.net/building#"	
  xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#">	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:about="hIp://www.R4SC.net/today#room_1">	
  
	
  	
  	
  	
   	
   	
  <b:hasPeopleInside	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b1"/>	
  
	
   	
  	
  </rdf:DescripYon>	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b4">	
  
	
  	
  	
  	
   	
   	
  <rdf:first	
  rdf:resource="hIp://www.R4SC.net/today#MariaPovedaVillalon"/>	
  
	
  	
  	
  	
   	
   	
  <rdf:rest	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b5"/>	
  
	
  	
   	
  </rdf:DescripYon>	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b5">	
  
	
  	
  	
  	
   	
   	
  <rdf:first	
  rdf:resource="hIp://www.R4SC.net/today#FilipRadulovic"/>	
  
	
  	
  	
  	
   	
   	
  <rdf:rest	
  rdf:resource="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#nil"/>	
  
	
  	
   	
  </rdf:DescripYon>	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b2">	
  
	
  	
  	
  	
   	
   	
  <rdf:first	
  rdf:resource="hIp://www.R4SC.net/today#RaulGarciaCastro"/>	
  
	
  	
  	
  	
   	
   	
  <rdf:rest	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b3"/>	
  
	
  	
   	
  </rdf:DescripYon>	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b1">	
  
	
  	
  	
  	
   	
   	
  <rdf:first	
  rdf:resource="hIp://www.R4SC.net/today#PieterPauwels"/>	
  
	
  	
  	
   	
   	
  <rdf:rest	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b2"/>	
  
	
   	
  </rdf:DescripYon>	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b3">	
  
	
  	
  	
  	
   	
   	
  <rdf:rest	
  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b4"/>	
  
	
  	
  	
  	
   	
   	
  <rdf:first	
  rdf:resource="hIp://www.R4SC.net/today#AsuncionGomezPerez"/>	
  
	
   	
  	
  </rdf:DescripYon>	
  
</rdf:RDF>	
  
Blank	
  nodes	
  
Elaborate	
  and	
  
complex	
  
descrip2on	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
RepeaYng	
  properYes	
  
•  I	
  have	
  a	
  property	
  that	
  can	
  have	
  mulYple	
  values,	
  
now	
  what?	
  
– SoluYon	
  1:	
  Simply	
  repeat	
  the	
  property	
  of	
  the	
  
resource	
  mulYple	
  Ymes.	
  RepeaYng	
  properYes	
  is	
  the	
  
simplest	
  approach	
  to	
  handling	
  mulY-­‐valued	
  
relaYons.	
  The	
  alternaYves	
  all	
  have	
  their	
  downsides.	
  
– SoluYon	
  2:	
  Use	
  a	
  structured	
  value	
  for	
  a	
  literal	
  
– SoluYon	
  3:	
  Use	
  an	
  RDF	
  Container	
  (Sequence,	
  Bag,	
  
or	
  Alt)	
  or	
  CollecYon	
  (RDF	
  List)	
  
http://patterns.dataincubator.org/book/repeated-property.html
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Wait	
  a	
  second…	
  
	
  
	
  
	
  
Did	
  you	
  say	
  ‘blank	
  nodes’?	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
What	
  are	
  blank	
  nodes?	
  
•  Blank	
  nodes	
  are	
  nodes	
  that	
  do	
  not	
  have	
  URIs	
  
–  No	
  URI	
  -­‐>	
  no	
  semanYcs	
  really	
  -­‐>	
  unstable	
  and	
  unreliable	
  
•  They	
  are	
  usually	
  represented	
  as:	
  _:1,	
  _:city,	
  
_:thiscanbeanythingyouwishfor,	
  _:8936fazGUID,	
  …	
  
•  This	
  representaYon	
  is	
  typically	
  generated	
  on-­‐the-­‐fly	
  so	
  
that	
  it	
  is	
  unique	
  within	
  the	
  scope	
  in	
  which	
  an	
  RDF	
  
graph	
  is	
  opened	
  
–  When	
  opening	
  this	
  RDF	
  graph	
  the	
  following	
  day,	
  even	
  in	
  the	
  
same	
  scope,	
  enYrely	
  different	
  names	
  might	
  be	
  generated	
  
–  Unstable	
  and	
  unreliable	
  
51	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
So,	
  why	
  do	
  we	
  use	
  these	
  blank	
  nodes?	
  
•  Simply	
  because	
  it	
  is	
  hard	
  to	
  give	
  everything	
  an	
  explicit	
  name,	
  this	
  is	
  not	
  always	
  
wanted	
  /	
  desirable	
  
•  For	
  example:	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
@prefix	
  region:	
  <hIp://www.R4SC.net/region#>	
  .	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  b:hasRoom	
  <hIp://www.R4SC.net/today#room_1>	
  ;	
  	
  
	
  b:hasName	
  “Our	
  summer	
  school	
  building";	
  	
  
	
  c:partOfCity	
  <hIp://ciYes.com/#cercedilla>	
  ;	
  
	
  c:partOfRegion	
  [	
  region:locaYon	
  “NorthOfMadrid”;	
  region:regiontype	
  “Forest”]	
  
•  Likewise,	
  people	
  do	
  not	
  intend	
  to	
  define	
  names	
  for	
  all	
  kinds	
  of	
  groups	
  of	
  things	
  -­‐>	
  
hence	
  a	
  lot	
  of	
  blank	
  nodes	
  in	
  descripYons	
  of	
  collecYons	
  and	
  containers	
  
52	
  
Blank	
  node	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
53	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Data	
  integraYon	
  now	
  possible	
  
MyBuilding	
   CiYes	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
We	
  already	
  integrated	
  datasets!	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Linked	
  Open	
  Data	
  Cloud	
  
•  hIp://lod-­‐cloud.net/	
  
•  datasets	
  that	
  have	
  been	
  published	
  in	
  Linked	
  Data	
  format,	
  by	
  
contributors	
  to	
  the	
  Linking	
  Open	
  Data	
  community	
  project	
  and	
  
other	
  individuals	
  and	
  organisaYons	
  
•  based	
  on	
  metadata	
  collected	
  and	
  curated	
  by	
  contributors	
  to	
  
the	
  Data	
  Hub	
  as	
  well	
  as	
  on	
  metadata	
  extracted	
  from	
  a	
  crawl	
  of	
  
the	
  Linked	
  Data	
  web	
  conducted	
  in	
  April	
  2014	
  
•  AIribuYon:	
  Linking	
  Open	
  Data	
  cloud	
  diagram	
  2014,	
  by	
  Max	
  
Schmachtenberg,	
  ChrisYan	
  Bizer,	
  Anja	
  Jentzsch	
  and	
  Richard	
  
Cyganiak.	
  hIp://lod-­‐cloud.net/	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
lod-­‐cloud.net	
  
http://lod-cloud.net (Last version: 2014-08-30)
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
History	
  of	
  the	
  LOD	
  
http://lod-cloud.net
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
LOD	
  as	
  of	
  May	
  2007	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
LOD	
  as	
  of	
  March	
  2009	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
!!!!AdverYsement	
  break!!!!	
  
	
  
RDF(S)	
  and	
  SPARQL	
  
Pieter	
  Pauwels	
  
	
  
More	
  to	
  come	
  aser	
  the	
  break	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
!!!!AdverYsement	
  break!!!!	
  
hIp://ldac-­‐2015.bwk.tue.nl/	
  	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Before	
  the	
  break	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
LOD	
  as	
  of	
  August	
  2014	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Circle	
  sizes	
  and	
  arrow	
  fonts	
  
•  Depending	
  on	
  the	
  size	
  of	
  the	
  dataset	
  and	
  the	
  
number	
  of	
  triples	
  between	
  datasets,	
  the	
  layout	
  
in	
  the	
  LOD	
  cloud	
  schema	
  is	
  different.	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Data	
  integraYon	
  now	
  possible	
  
MyBuilding	
   CiYes	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Status	
  and	
  staYsYcs	
  
•  CumulaYve	
  stats:	
  
hIp://stats.lod2.eu/	
  	
  
•  State	
  of	
  the	
  LOD	
  cloud	
  2014:	
  	
  
hIp://linkeddatacatalog.dws.informaYk.uni-­‐
mannheim.de/state/	
  
•  State	
  of	
  the	
  LOD	
  cloud	
  2011:	
  	
  
hIp://lod-­‐cloud.net/state/	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Triple	
  counts	
  
hIp://stats.lod2.eu/	
  	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Stats	
  -­‐	
  Datasets	
  by	
  topical	
  domain	
  
hIp://linkeddatacatalog.dws.informaYk.uni-­‐mannheim.de/state/	
  
Topic	
   Datasets	
   %	
  
Government	
   183	
   18.05%	
  
PublicaYons	
   96	
   9.47%	
  
Life	
  sciences	
   83	
   8.19%	
  
User-­‐generated	
  content	
   48	
   4.73%	
  
Cross-­‐domain	
   41	
   4.04%	
  
Media	
   22	
   2.17%	
  
Geographic	
   21	
   2.07%	
  
Social	
  web	
   520	
   51.28%	
  
Total	
   1014	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Stats	
  -­‐	
  CategorizaYon	
  by	
  number	
  of	
  
linked	
  datasets	
  
Number	
  of	
  linked	
  datasets	
   Number	
  of	
  datasets	
  
more	
  than	
  10	
   79	
  (7.79%)	
  
6	
  to	
  10	
   81	
  (7.99%)	
  
5	
   31	
  (3.06%)	
  
4	
   42	
  (4.14%)	
  
3	
   54	
  (5.33%)	
  
2	
   106	
  (10.45%)	
  
1	
   176	
  (17.36%)	
  
0	
   445	
  (43.89%)	
  
hIp://linkeddatacatalog.dws.informaYk.uni-­‐mannheim.de/state/	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Can	
  my	
  dataset	
  be	
  included?	
  
First,	
  make	
  sure	
  that	
  you	
  publish	
  data	
  according	
  to	
  the	
  
Linked	
  Data	
  principles.	
  We	
  interpret	
  this	
  as:	
  
•  There	
  must	
  be	
  resolvable	
  h+p://	
  (or	
  h+ps://)	
  URIs.	
  
•  They	
  must	
  resolve,	
  with	
  or	
  without	
  content	
  negoYaYon,	
  
to	
  RDF	
  data	
  in	
  one	
  of	
  the	
  popular	
  RDF	
  formats	
  (RDFa,	
  RDF/
XML,	
  Turtle,	
  N-­‐Triples).	
  
•  The	
  dataset	
  must	
  contain	
  at	
  least	
  1000	
  triples.	
  
•  The	
  dataset	
  must	
  be	
  connected	
  via	
  RDF	
  links	
  to	
  a	
  dataset	
  
that	
  is	
  already	
  in	
  the	
  diagram.	
  This	
  means,	
  either	
  your	
  
dataset	
  must	
  use	
  URIs	
  from	
  the	
  other	
  dataset,	
  or	
  vice	
  
versam.	
  We	
  arbitrarily	
  require	
  at	
  least	
  50	
  links.	
  
•  Access	
  of	
  the	
  en=re	
  dataset	
  must	
  be	
  possible	
  via	
  RDF	
  
crawling,	
  via	
  an	
  RDF	
  dump,	
  or	
  via	
  a	
  SPARQL	
  endpoint.	
  
Then,	
  add	
  it	
  to	
  the	
  Data	
  Hub	
  and	
  request	
  to	
  be	
  included	
  
	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  resolvable	
  URIs	
  
	
  
	
  
	
  
Hold	
  on,	
  what	
  do	
  you	
  mean,	
  ‘resolvable’?	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Reminder:	
  What	
  is	
  a	
  URI?	
  
•  URI	
  stands	
  for	
  Unique	
  Resource	
  IdenYfier	
  
•  Purpose:	
  Obtain	
  globally	
  unique	
  idenYfiers,	
  so	
  that	
  informaYon	
  
can	
  be	
  exchanged	
  globally.	
  
•  Structure:	
  
	
  <hIp://www.R4SC.net/today#building_1>	
  
•  Namespace	
  needed	
  to	
  avoid	
  name	
  conflicts	
  with	
  tags	
  of	
  the	
  
same	
  name:	
  other	
  tags	
  with	
  the	
  name	
  “building_1"	
  can	
  be	
  
defined	
  with	
  other	
  namespace	
  URIs,	
  and	
  an	
  RDF	
  reader	
  would	
  
sYll	
  be	
  able	
  to	
  tell	
  that	
  they	
  were	
  different	
  properYes	
  even	
  
though	
  they	
  had	
  the	
  same	
  tag	
  name.	
  
73	
  
Namespace	
   Name	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
What	
  do	
  you	
  mean…	
  resolvable?	
  
•  A	
  resolvable	
  URI	
  is:	
  	
  
“A	
  URI	
  whose	
  resource	
  has	
  one	
  or	
  more	
  representa=ons	
  available	
  via	
  invoking	
  HTTP	
  GET	
  
on	
  the	
  URI”	
  
(source:	
  hIp://www.w3.org/TR/2010/WD-­‐sparql11-­‐hIp-­‐rdf-­‐update-­‐20100126/)	
  	
  
74	
  
hIp://www.w3.org/TR/cooluris/#oldweb	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Dereferencing	
  URIs	
  
hIp://wifo5-­‐03.informaYk.uni-­‐mannheim.de/bizer/pub/LinkedDataTutorial/	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
So,	
  you	
  are	
  now	
  ready	
  to	
  publish	
  here	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Note:	
  the	
  O	
  in	
  LOD	
  	
  
•  This	
  does	
  NOT	
  mean	
  that	
  RDF	
  is	
  “OPEN”	
  by	
  
default	
  
•  Most	
  datasets	
  in	
  the	
  LOD	
  cloud	
  have	
  licence	
  
informaYon	
  aIached	
  
•  This	
  does	
  NOT	
  mean	
  that	
  RDF	
  is	
  “OPEN”	
  by	
  
default	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
78	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
What	
  did	
  we	
  do	
  so	
  far?	
  
	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  b:hasRoom	
  <hIp://www.R4SC.net/today#room_1>	
  ;	
  	
  
	
  b:hasName	
  “Our	
  summer	
  school	
  building";	
  	
  
	
  c:partOfCity	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  c:closeToCity	
  <hIp://ciYes.com/#madrid>	
  ;	
  
	
  c:hasName	
  “Cercedilla”	
  .	
  
	
  
79	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  SemanYc	
  Web	
  stack	
  
80	
  
Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  RDF	
  namespace	
  
	
  
	
  
	
  
@prefix	
  rdf:	
  h]p://www.w3.org/1999/02/22-­‐
rdf-­‐syntax-­‐ns#	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  first	
  few	
  lines	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
We	
  have	
  actually	
  already	
  used	
  it	
  
<?xml	
  version="1.0"	
  encoding="UTF-­‐8"?>	
  
<rdf:RDF	
  xmlns:b="hIp://www.R4SC.net/building#"	
  xmlns:c="hIp://www.R4SC.net/
city#"	
  xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#">	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:about="hIp://www.R4SC.net/today#building_1">	
  
	
  	
  	
  	
   	
   	
  <c:partOfCity	
  rdf:resource="hIp://ciYes.com/#cercedilla"/>	
  
	
  	
  	
  	
   	
   	
  <b:hasName>Our	
  summer	
  school	
  building</b:hasName>	
  
	
  	
  	
  	
   	
   	
  <b:hasRoom	
  rdf:resource="hIp://www.R4SC.net/today#room_1"/>	
  
	
   	
  	
  </rdf:DescripYon>	
  
	
  	
   	
  <rdf:DescripYon	
  rdf:about="hIp://ciYes.com/#cercedilla">	
  
	
  	
  	
  	
   	
   	
  <c:hasName>Cercedilla</c:hasName>	
  
	
  	
  	
  	
   	
   	
  <c:closeToCity	
  rdf:resource="hIp://ciYes.com/#madrid"/>	
  
	
  	
   	
  </rdf:DescripYon>	
  
</rdf:RDF>	
  
83	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Need	
  for	
  structured	
  vocabularies	
  
•  RDF	
  graphs	
  -­‐>	
  could	
  be	
  anything	
  
•  Need	
  for	
  semanYcs	
  /	
  structured	
  vocabularies	
  
⇒ 	
  RDFSchema	
  (RDFS)	
  	
  
⇒ 	
  Web	
  Ontology	
  Language	
  (OWL)	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  SemanYc	
  Web	
  stack	
  
85	
  
Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  RDFS	
  namespace	
  
	
  
	
  
	
  
@prefix	
  rdfs:	
  h]p://www.w3.org/2000/01/rdf-­‐
schema#	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  TTL	
  graph	
  
-­‐>	
  ambiguous	
  /	
  close	
  to	
  meaningless	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  vocabulary	
  in	
  TTL	
  
@prefix	
  rdfs:	
  <hIp://www.w3.org/2000/01/rdf-­‐schema#>	
  .	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
	
  
b:InfrastructuralElement	
  
	
  rdf:type	
  rdfs:Class	
  .	
  
	
  
b:Building	
  
	
  rdf:type	
  rdfs:Class	
  ;	
  
	
  rdfs:subClassOf	
  b:InfrastructuralElement	
  .	
  
	
  
b:hasRoom	
  
	
  rdf:type	
  rdf:Property	
  ;	
  
	
  rdfs:range	
  b:Room	
  ;	
  
	
  rdfs:domain	
  b:Building	
  .	
  
89	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  same	
  thing	
  in	
  RDF/XML	
  
<?xml	
  version="1.0"	
  encoding="u•-­‐8"?>	
  
<rdf:RDF	
  
	
  	
  xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#"	
  
	
  	
  xmlns:rdfs="hIp://www.w3.org/2000/01/rdf-­‐schema#">	
  
	
  	
  <rdf:Property	
  rdf:about="hIp://www.R4SC.net/building#hasRoom">	
  
	
  	
  	
  	
   	
  <rdfs:domain	
  rdf:resource="hIp://www.R4SC.net/building#Building"/>	
  
	
  	
  	
  	
   	
  <rdfs:range	
  rdf:resource="hIp://www.R4SC.net/building#Room"/>	
  
	
  	
  </rdf:Property>	
  
	
  	
  <rdfs:Class	
  rdf:about="hIp://www.R4SC.net/building#InfrastructuralElement"/>	
  
	
  	
  <rdfs:Class	
  rdf:about="hIp://www.R4SC.net/building#Building">	
  
	
  	
  	
  	
   	
  <rdfs:subClassOf	
   	
  rdf:resource="hIp://www.R4SC.net/
building#InfrastructuralElement"/>	
  
	
  	
  </rdfs:Class>	
  
</rdf:RDF>	
  
90	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Combining	
  instances	
  and	
  vocabulary	
  
@prefix	
  rdfs:	
  <hIp://www.w3.org/2000/01/rdf-­‐schema#>	
  .	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  	
  
	
  
b:InfrastructuralElement	
  
	
  rdf:type	
  rdfs:Class	
  .	
  
	
  
b:Building	
  
	
  rdf:type	
  rdfs:Class	
  ;	
  
	
  rdfs:subClassOf	
  b:InfrastructuralElement	
  .	
  
	
  
b:hasRoom	
  
	
  rdf:type	
  rdf:Property	
  ;	
  
	
  rdfs:range	
  b:Room	
  ;	
  
	
  rdfs:domain	
  b:Building	
  .	
  
91	
  
	
  
	
  
	
  
	
  
<hIp://www.R4SC.net/today#building_1>	
  	
  
	
  b:hasRoom	
  <hIp://www.R4SC.net/today#room_1>;
	
  b:hasName	
  “Our	
  summer	
  school	
  building";	
  	
  
	
  c:partOfCity	
  <hIp://ciYes.com/#cercedilla>	
  .	
  	
  
	
  
<hIp://ciYes.com/#cercedilla>	
  	
  
	
  c:closeToCity	
  <hIp://ciYes.com/#madrid>	
  ;	
  
	
  c:hasName	
  “Cercedilla”	
  .	
  
	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  TTL	
  graph	
  
-­‐>	
  unambiguous	
  /	
  meaningful	
  semanYcs	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
93	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  SemanYc	
  Web	
  stack	
  
94	
  
Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
So,	
  it’s	
  also	
  just	
  an	
  RDF	
  graph…	
  
95	
  
http://www.w3.org/DesignIssues/diagrams/n3/venn
We	
  s2ck	
  to	
  Turtle	
  today	
  
Let’s	
  just	
  quietly	
  extend	
  towards	
  SPARQL	
  
as	
  well	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
96	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
What	
  is	
  SPARQL	
  
•  SPARQL	
  stands	
  for	
  SPARQL	
  Protocol	
  and	
  RDF	
  Query	
  Language	
  
•  SPARQL	
  is	
  a	
  Query	
  Language	
  
•  Find	
  the	
  W3C	
  RecommendaYon	
  page:	
  
hIp://www.w3.org/TR/rdf-­‐sparql-­‐query/	
  
–  Used	
  to	
  express	
  queries	
  across	
  diverse	
  data	
  sources,	
  whether	
  the	
  data	
  is	
  
stored	
  naYvely	
  as	
  RDF	
  or	
  viewed	
  as	
  RDF	
  via	
  middleware.	
  	
  
–  SPARQL	
  contains	
  capabiliYes	
  for	
  querying	
  required	
  and	
  opYonal	
  graph	
  
paIerns	
  along	
  with	
  their	
  conjuncYons	
  and	
  disjuncYons.	
  	
  
–  SPARQL	
  supports	
  extensible	
  value	
  tesYng	
  and	
  constraining	
  queries	
  by	
  
source	
  RDF	
  graph.	
  	
  
–  The	
  results	
  of	
  SPARQL	
  queries	
  can	
  be	
  results	
  sets	
  or	
  RDF	
  graphs.	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  inspiraYon:	
  SQL	
  
	
  
	
  
	
   	
  select	
  A1,	
  A2,	
  ...,	
  An	
  
	
   	
  from	
  r1,	
  r2,	
  ...,	
  rm	
  
	
   	
  where	
  P	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
SPARQL	
  template	
  
	
  
	
  
	
   	
  prefix	
  a:…	
  
	
   	
  select	
  concepts	
  
	
   	
  from	
  datasources	
  
	
   	
  where	
  {	
  statements	
  }	
  
	
   	
  order	
  by	
  …	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Structure	
  of	
  a	
  SPARQL	
  query	
  
•  Prefix	
  declaraYons	
  
	
  Used	
  to	
  abbreviate	
  URIs	
  
•  Dataset	
  definiYon	
  
	
  Used	
  to	
  state	
  what	
  RDF	
  graph(s)	
  are	
  being	
  queried	
  
•  A	
  result	
  clause	
  
	
  Used	
  to	
  idenYfy	
  what	
  informaYon	
  to	
  return	
  from	
  the	
  
	
  query	
  
•  The	
  query	
  paIern	
  
	
  Used	
  to	
  specify	
  what	
  to	
  query	
  for	
  in	
  the	
  underlying	
  
	
  dataset	
  
•  Query	
  modifiers,	
  slicing,	
  ordering,	
  and	
  otherwise	
  	
  
	
  Used	
  to	
  rearrange	
  query	
  results	
  (post-­‐processing)	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Let’s	
  query	
  our	
  example	
  graph	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  SPARQL	
  Query	
  
	
  
PREFIX	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  
PREFIX	
  c:	
  <hIp://www.R4SC.net/city#>	
  .	
  
	
  
SELECT	
  ?city2	
  	
  
WHERE	
  {	
  	
  
	
  ?b	
  b:hasRoom	
  <hIp://www.R4SC.net/today#room_1>	
  .	
  	
  
	
  ?b	
  c:partOfCity	
  ?city	
  .	
  
	
  ?city	
  c:closeToCity	
  ?city2	
  
}	
  
variable	
  
Regular	
  RDF	
  
statements	
  
Regular	
  RDF	
  
prefix	
  
declara2ons	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Processing	
  the	
  WHERE	
  statement	
  
secYon	
  
•  A	
  pa+ern	
  is	
  matched	
  against	
  the	
  RDF	
  data	
  
•  “find	
  a	
  set	
  of	
  bindings	
  such	
  that	
  the	
  subs=tu=on	
  
of	
  variables	
  for	
  values	
  creates	
  a	
  triple	
  that	
  is	
  in	
  
the	
  set	
  of	
  triples	
  making	
  up	
  the	
  graph”	
  
•  Source:	
  	
  
hIp://www.w3.org/2004/Talks/17Dec-­‐sparql/
QueryLang1/all.html	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Graph	
  matching	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  Query	
  Result	
  
	
  
	
  
	
  
city2	
  
<hIp://ciYes.com/#madrid>	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
106	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Example	
  SPARQL	
  endpoint	
  on	
  DBPedia	
  
The	
  HTTP	
  Address	
  of	
  the	
  
endpoint	
  
The	
  soiware	
  used	
  in	
  the	
  
server	
  to	
  store	
  the	
  triples	
  
(cfr.	
  DBMS)	
  
Diverse	
  op2ons	
  to	
  set	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Try	
  it	
  
Try	
  it	
  out	
  on	
  the	
  DBPedia	
  dataset:	
  
	
  
	
  
	
   	
  hIp://dbpedia.org/sparql	
  	
  
	
  
Or	
  even	
  beIer:	
  host	
  one	
  yourself	
  and	
  make	
  it	
  available	
  
	
  
108	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  More	
  details	
  
•  Concluding	
  Overview	
  
109	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Matching	
  literals	
  (1)	
  
RDF	
  data:	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  people:	
  <hIp://www.R4SC.net/people#>	
  .	
  	
  
@prefix	
  xsd:	
  <hIp://www.w3.org/2001/XMLSchema#>	
  .	
  
	
  	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPersonInside	
  "Pieter"@en	
  	
  .	
  	
  
<hIp://www.R4SC.net/today#restaurant>	
  	
  
	
  b:hasPersonInside	
  "Raul"^^xsd:string	
  .	
  	
  
<hIp://www.R4SC.net/today#airport>	
  	
  
	
  b:hasPersonInside	
  "Leandro"^^people:keynotespeaker	
  .	
  
	
  
Query	
  
SELECT	
  ?v	
  WHERE	
  {	
  ?v	
  ?p	
  "Pieter"	
  }	
  
	
  
Result	
  
{	
  }	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Matching	
  literals	
  (2)	
  
RDF	
  data:	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  people:	
  <hIp://www.R4SC.net/people#>	
  .	
  	
  
@prefix	
  xsd:	
  <hIp://www.w3.org/2001/XMLSchema#>	
  .	
  
	
  	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPersonInside	
  "Pieter"@en	
  	
  .	
  	
  
<hIp://www.R4SC.net/today#restaurant>	
  	
  
	
  b:hasPersonInside	
  "Raul"^^xsd:string	
  .	
  	
  
<hIp://www.R4SC.net/today#airport>	
  	
  
	
  b:hasPersonInside	
  "Leandro"^^people:keynotespeaker	
  .	
  
	
  
Query	
  
SELECT	
  ?v	
  WHERE	
  {	
  ?v	
  ?p	
  "Pieter"@en}	
  
	
  
Result	
  
{	
  <hIp://www.R4SC.net/today#room_1>	
  }	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Matching	
  literals	
  (3)	
  
RDF	
  data:	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  people:	
  <hIp://www.R4SC.net/people#>	
  .	
  	
  
@prefix	
  xsd:	
  <hIp://www.w3.org/2001/XMLSchema#>	
  .	
  
	
  	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPersonInside	
  "Pieter"@en	
  	
  .	
  	
  
<hIp://www.R4SC.net/today#restaurant>	
  	
  
	
  b:hasPersonInside	
  "Raul"^^xsd:string	
  .	
  	
  
<hIp://www.R4SC.net/today#airport>	
  	
  
	
  b:hasPersonInside	
  "Leandro"^^people:keynotespeaker	
  .	
  
	
  
Query	
  
SELECT	
  ?v	
  WHERE	
  {	
  ?v	
  ?p	
  "Leandro"^^<	
  hIp://www.R4SC.net/people#keynotespeaker	
  >	
  }	
  
	
  
Result	
  
{	
  <hIp://www.R4SC.net/today#airport	
  >	
  }	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Querying	
  blank	
  nodes	
  
RDF	
  data:	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
	
  
_:room1	
  b:hasPersonInside	
  “Pieter"	
  .	
  	
  
_:room2	
  b:hasPersonInside	
  “Raul"	
  .	
  
	
  
Query	
  
PREFIX	
  b:	
  <hIp://www.R4SC.net/building#>	
  	
  
SELECT	
  ?x	
  ?name	
  
WHERE	
  	
  {	
  ?x	
  b:hasPersonInside	
  ?name	
  }	
  
	
  
Result	
  
x name
_:c "Pieter"
_:d "Leandro"
x name
_:r "Pieter"
_:s "Leandro"
…	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
CONSTRUCT	
  queries	
  
RDF	
  data:	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
@prefix	
  :	
  	
  	
  	
  	
  <hIp://www.R4SC.net/today#>	
  .	
  
_:a	
  	
  b:presenterName	
  	
  	
  “Pieter"	
  .	
  
_:b	
  	
  b:presenterName	
  	
  	
  “Raul"	
  .	
  
:room1	
  b:hasPersonInside	
  _:a	
  .	
  	
  
:room1	
  b:hasPersonInside	
  “Raul"	
  .	
  
:room1	
  rdf:type	
  b:R4SCPresentaYonRoom	
  
	
  
Query	
  
PREFIX	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  	
  
WHERE	
  	
  {	
  ?x	
  rdf:type	
  b:R4SCPresentaYonRoom	
  .	
  	
  
?x:	
  b:hasPersonInside	
  ?z	
  .	
  	
  
?z	
  b:presenterName	
  ?name	
  }	
  
CONSTRUCT	
  {	
  ?x	
  b:hasR4SCPresenter	
  ?name	
  }	
  
	
  
Result	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
@prefix	
  :	
  	
  	
  	
  	
  <hIp://www.R4SC.net/today#>	
  .	
  
:room1	
  b:hasR4SCPresenter	
  “Pieter”	
  .	
  
:room1	
  b:hasR4SCPresenter	
  “Raul”	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
SPARQL	
  Filters	
  
RDF	
  data:	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
@prefix	
  :	
  	
  	
  	
  	
  <hIp://www.R4SC.net/today#>	
  .	
  
:room_1	
  b:hasPresentaYonTitle	
  “RDF(S)	
  and	
  SPARQL"	
  .	
  
:room_1	
  	
  b:hasPeopleInside	
  	
  28	
  .	
  
:room_2	
  b:hasPresentaYonTitle	
  “Handson	
  session	
  RDF(S)	
  and	
  SPARQL"	
  .	
  
:room_2	
  	
  b:hasPeopleInside	
  	
  23	
  .	
  
	
  
Query	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
SELECT	
  	
  ?Ytle	
  
WHERE	
  	
  	
  {	
  ?x	
  b:hasPresentaYonTitle	
  ?Ytle	
  	
  
	
  	
  FILTER	
  regex(?Ytle,	
  "^Hands")	
  	
  	
  	
  
}	
  
	
  
Result	
  
title
"Handson session
RDF(S) and SPARQL"
Many	
  possibili2es:	
  string	
  
matching,	
  value	
  restric2ons	
  
(greaterThan,	
  etc.),	
  DateTime	
  
restric2ons,	
  …	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
OPTIONAL	
  keyword	
  
RDF	
  data:	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
@prefix	
  :	
  	
  	
  	
  	
  <hIp://www.R4SC.net/today#>	
  .	
  
:room_1	
  b:hasPresentaYonTitle	
  “RDF(S)	
  and	
  SPARQL"	
  .	
  
:room_1	
  	
  b:hasPeopleInside	
  	
  28	
  .	
  
:room_2	
  b:hasPresentaYonTitle	
  “Handson	
  session	
  RDF(S)	
  and	
  SPARQL"	
  .	
  
:room_2	
  	
  b:hasPeopleInside	
  	
  23	
  .	
  
	
  
Query	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
SELECT	
  	
  ?Ytle	
  ?aIendees	
  
WHERE	
  	
  	
  {	
  ?x	
  b:hasPresentaYonTitle	
  ?Ytle	
  .	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  OPTIONAL	
  {	
  ?x	
  b:hasPeopleInside	
  ?aIendees.	
  FILTER	
  (?aIendees	
  	
  >	
  25)	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  
Result	
  
	
   title attendees
"RDF(S) and SPARQL" 28
"Handson session RDF(S) and
SPARQL"
If	
  there	
  is	
  a	
  match,	
  give	
  the	
  op2onal	
  
data,	
  otherwise	
  give	
  the	
  required	
  data	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
LIMIT	
  Keyword	
  
RDF	
  data:	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPersonInside	
  “PieterPauwels"	
  ,	
  “RaulGarciaCastro"	
  ,	
  “AsuncionGomezPerez"	
  ,	
  
	
   	
   	
  “MariaPovedaVillalon",	
  “FilipRadulovic"	
  .	
  
	
  
Query	
  
PREFIX	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  
SELECT	
  ?name	
  
WHERE	
  {	
  ?x	
  b:hasPersonInside	
  ?name	
  }	
  
LIMIT	
  2	
  
	
  
Result	
  
	
   name
“PieterPauwels"
“RaulGarciaCastro"
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
ORDER	
  BY	
  
RDF	
  data:	
  
@prefix	
  b:	
  <hIp://www.R4SC.net/building#>	
  .	
  	
  
@prefix	
  rdf:	
  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>	
  .	
  
<hIp://www.R4SC.net/today#room_1>	
  	
  
	
  b:hasPersonInside	
  “PieterPauwels"	
  ,	
  “RaulGarciaCastro"	
  ,	
  “AsuncionGomezPerez"	
  ,	
  
	
   	
   	
  “MariaPovedaVillalon",	
  “FilipRadulovic"	
  .	
  
	
  
Query	
  
PREFIX	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  
SELECT	
  ?name	
  
WHERE	
  {	
  ?x	
  b:hasPersonInside	
  ?name	
  }	
  
LIMIT	
  2	
  ORDER	
  BY	
  DESC(?name)	
  
	
  
Result	
  
	
   name
“RaulGarciaCastro"
“PieterPauwels"
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
DISTINCT	
  Keyword	
  
RDF	
  data:	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
@prefix	
  :	
  	
  	
  	
  	
  <hIp://www.R4SC.net/today#>	
  .	
  
:room_1	
  b:hasPresentaYon	
  [	
  b:hasPresentaYonTitle	
  “RDF(S)	
  and	
  SPARQL"	
  ]	
  .	
  
:room_1	
  b:hasPresentaYon	
  [	
  b:hasPresentaYonTitle	
  “Handson	
  session	
  Generate	
  your	
  RDF”;	
  b:startsAt	
  
“14:30:00”^^xsd:Yme	
  ]	
  .	
  
:room_1	
  b:hasPresentaYon	
  [	
  b:hasPresentaYonTitle	
  “Handson	
  session	
  Generate	
  your	
  RDF”;	
  b:startsAt	
  
“17:00:00”^^xsd:Yme	
  ]	
  .	
  
	
  
Query	
  
PREFIX	
  b:	
  	
  	
  	
  <	
  hIp://www.R4SC.net/building#	
  >	
  
SELECT	
  DISTINCT	
  ?Ytle	
  
WHERE	
  {	
  ?x	
  b:hasPresentaYonTitle	
  ?Ytle}	
  
	
  
Result	
  
	
   title
“RDF(S) and
SPARQL"
“Handson session
Generate your RDF"
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
UNION	
  Keyword	
  
RDF	
  data:	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
@prefix	
  :	
  	
  	
  	
  	
  <hIp://www.R4SC.net/today#>	
  .	
  
:room_1	
  b:hasPresentaYon	
  [	
  b:hasPresentaYonTitle	
  “RDF(S)	
  and	
  SPARQL"	
  ]	
  .	
  
:room_1	
  b:hasPresentaYon	
  [	
  b:hasPresentaYonTitle	
  “Handson	
  session	
  Generate	
  your	
  RDF”;	
  b:startsAt	
  
“14:30:00”^^xsd:Yme	
  ]	
  .	
  
:room_1	
  b:hasPresentaYon	
  [	
  b:hasPresentaYonTitle	
  “Handson	
  session	
  Generate	
  your	
  RDF”;	
  b:startsAt	
  
“17:00:00”^^xsd:Yme	
  ]	
  .	
  
_:x1	
  b:presentaYon	
  “Linking	
  Data”	
  .	
  
	
  
Query 	
   	
   	
   	
   	
   	
  	
  
@prefix	
  b:	
  	
  	
  	
  <hIp://www.R4SC.net/building#>	
  .	
  
@prefix	
  :	
  	
  	
  	
  	
  <hIp://www.R4SC.net/today#>	
  .	
  
	
  
SELECT	
  DISTINCT	
  ?Ytle_1	
  ?Ytle_2	
  
WHERE	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  {	
  ?p	
  b:hasPresentaYonTitle	
  ?Ytle_1	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  UNION	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  {	
  ?p1	
  b:presentaYon	
  ?Ytle_2	
  }	
  
	
  	
  	
  	
  	
  	
  }	
  
title
“RDF(S) and
SPARQL"
“Handson session
Generate your RDF"
“Linking Data”
Result	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
But	
  well,	
  the	
  only	
  way	
  to	
  learn	
  it…	
  
Try	
  it	
  out,	
  for	
  example,	
  on	
  the	
  DBPedia	
  dataset:	
  
	
  
	
  
	
   	
  hIp://dbpedia.org/sparql	
  	
  
	
  
Or	
  even	
  beIer:	
  host	
  one	
  yourself	
  and	
  make	
  it	
  available	
  
	
  
121	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
Index	
  
•  RDF	
  graphs:	
  the	
  simple	
  basis	
  
•  Syntax:	
  talking	
  the	
  talk	
  
–  URIs	
  
–  RDF	
  Statements	
  
–  Literals	
  
–  CollecYons	
  and	
  containers	
  
•  Linked	
  (Open)	
  Data	
  Cloud	
  
•  Adding	
  basic	
  structure	
  :	
  RDFS	
  
•  Querying:	
  SPARQL	
  
–  The	
  basis	
  
–  The	
  SPARQL	
  endpoint	
  
–  Some	
  more	
  complex	
  examples	
  
•  Concluding	
  Overview	
  
122	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
The	
  SemanYc	
  Web	
  stack	
  
123	
  
Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
LD4SC	
  Summer	
  School	
  
7th	
  -­‐	
  12th	
  June,	
  Cercedilla,	
  Spain	
  
1st	
  Summer	
  School	
  on	
  	
  
Smart	
  Ci2es	
  and	
  Linked	
  Open	
  Data	
  (LD4SC-­‐15)	
  
Thank	
  you	
  for	
  your	
  aIenYon!	
  
pipauwel.pauwels@ugent.be	
  

RDF(S) and SPARQL

  • 1.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   1st  Summer  School  on     Smart  Ci2es  and  Linked  Open  Data  (LD4SC-­‐15)   RDF(S)  and  SPARQL   Pieter  Pauwels,  Ghent  University  
  • 2.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  cool  and  awesome  intro  movies                     hIps://vimeo.com/36752317   hIps://www.youtube.com/watch?v=4x_xzT5eF5Q     2  
  • 3.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   3  
  • 4.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   RDF  graphs,  what  are  they   RDF  graphs  are  DIRECTED,  LABELLED  GRAPHS   4   P. Pauwels, D. Van Deursen, R. Verstraeten, J. De Roo, R. De Meyer, R. Van de Walle, J. Van Campenhout. A semantic rule checking environment for building performance checking. Automation in Construction 20(5) 2011, 506-518. LABELLED   DIRECTED   Triple  
  • 5.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   RDF  graphs,  what  are  they  NOT   Hierarchies  (cfr.  XML)             RelaYonal  databases     (cfr.  MySQL,  SQLServer)            5   RDF  graphs  are   DIRECTED,  LABELLED   GRAPHS  
  • 6.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   A  triple   6   Triple   SUBJECT   OBJECT   PREDICATE  
  • 7.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   ConnecYng  Triples   7   SUBJECT   OBJECT   PREDICATE   OBJECT   PREDICATE   OBJECT   PREDICATE   OBJECT  PREDICATE  
  • 8.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  result:  an  RDF  graph   8   LABELLED   DIRECTED   Triple   That  is  it:  simple  directed  labelled  graphs,  always  remember  
  • 9.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   9  
  • 10.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Talking  the  RDF  language   •  RDF  stands  for  Resource  DescripYon  Framework   •  RDF  is  a  standard  data  model  for  describing  web  resources   –  Note:  ‘web  resources’  can  make  statements  about  anything  in  the  real   world:  DBPedia,  geography,  building  informaYon,  sensors,  …  anything   goes   •  RDF  is  designed  to  be  read  and  understood  by  computers   •  RDF  is  not  designed  for  being  displayed  to  people   •  RDF  is  wriIen  in  XML   •  RDF  is  a  W3C  RecommendaYon   10   hIp://www.w3schools.com/webservices/ws_rdf_intro.asp   easily  used   usually   -­‐>  standardisaYon   not  a  file  format,   not  a  syntax,  not  a   schema,  …  =>  a   data  model  
  • 11.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  SemanYc  Web  stack   11   Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
  • 12.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Syntaxes  for  serialisaYon   12   Triple   RDF/XML   Turtle  (TTL)   NotaYon-­‐3  (N3)   …  
  • 13.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Expressiveness  of  syntaxes   13   http://www.w3.org/DesignIssues/diagrams/n3/venn We  s2ck  to  Turtle  today  
  • 14.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  TTL  file     @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .       <hIp://www.R4SC.net/today#building_1>      b:hasRoom  <hIp://www.R4SC.net/today#room_1>  ;      b:hasName  “Our  summer  school  building";      c:partOfCity  <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      c:closeToCity  <hIp://ciYes.com/#madrid>  ;    c:hasName  “Cercedilla”  .     14  
  • 15.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  TTL  graph  
  • 16.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  same  thing  in  RDF/XML   <?xml  version="1.0"  encoding="UTF-­‐8"?>   <rdf:RDF  xmlns:b="hIp://www.R4SC.net/building#"  xmlns:c="hIp://www.R4SC.net/ city#"  xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#">        <rdf:DescripYon  rdf:about="hIp://www.R4SC.net/today#building_1">              <c:partOfCity  rdf:resource="hIp://ciYes.com/#cercedilla"/>              <b:hasName>Our  summer  school  building</b:hasName>              <b:hasRoom  rdf:resource="hIp://www.R4SC.net/today#room_1"/>        </rdf:DescripYon>        <rdf:DescripYon  rdf:about="hIp://ciYes.com/#cercedilla">              <c:hasName>Cercedilla</c:hasName>              <c:closeToCity  rdf:resource="hIp://ciYes.com/#madrid"/>        </rdf:DescripYon>   </rdf:RDF>   16  
  • 17.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Convert  to  different  syntaxes   Convert  to/from  syntaxes:          hIp://rdf-­‐translator.appspot.com/       Or  simply  build  and  use  your  own  sosware  tool     17  
  • 18.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   18  
  • 19.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Uniform  Resource  IdenYfiers   URI   URI   URI   URI   URI   URI   URI   URI   URI   URI   URI  
  • 20.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   What  is  a  URI?   •  URI  stands  for  Uniform  Resource  IdenYfier   •  Purpose:  Obtain  globally  unique  idenYfiers,  so  that  informaYon   can  be  exchanged  globally.   •  Structure:    <hIp://www.R4SC.net/today#building_1>   •  Namespace  needed  to  avoid  name  conflicts  with  tags  of  the   same  name:  other  tags  with  the  name  “building_1”  can  be   defined  with  other  namespace  URIs,  and  an  RDF  reader  would   sYll  be  able  to  tell  that  they  were  different  properYes  even   though  they  had  the  same  tag  name.   20   Namespace   Name  
  • 21.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Full  version  of  the  URIs     <hIp://www.R4SC.net/today#building_1>   <hIp://www.R4SC.net/today#room_1>     <hIp://www.R4SC.net/building#hasRoom  >   <hIp://www.R4SC.net/building#hasName  >     <hIp://www.R4SC.net/city#partOfCity>   <hIp://www.R4SC.net/city#closeToCity>   <hIp://www.R4SC.net/city#hasName>     <hIp://ciYes.com/#cercedilla>   <hIp://ciYes.com/#madrid>         21  
  • 22.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  TTL  file     @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .       <hIp://www.R4SC.net/today#building_1>      b:hasRoom  <hIp://www.R4SC.net/today#room_1>  ;      b:hasName  “Our  summer  school  building";      c:partOfCity  <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      c:closeToCity  <hIp://ciYes.com/#madrid>  ;    c:hasName  “Cercedilla”  .     22  
  • 23.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Prefixed  URIs   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .     @prefix  bi:  <hIp://www.R4SC.net/today#>  .     @prefix  ci:  <  hIp://ciYes.com/#  >  .       bi:building_1   bi:room_1     b:hasRoom   b:hasName     c:partOfCity   c:closeToCity   c:hasName     ci:madrid   ci:cercedilla     23  
  • 24.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   TTL  file  with  fully  qualified  names     <hIp://www.R4SC.net/today#building_1>      <hIp://www.R4SC.net/building#hasRoom  >              <hIp://www.R4SC.net/ today#room_1>  ;      <hIp://www.R4SC.net/building#hasName  >    “Our  summer  school  building";      <hIp://www.R4SC.net/city#partOfCity  >    <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      <hIp://www.R4SC.net/city#closeToCity  >    <hIp://ciYes.com/#madrid>  ;    <hIp://www.R4SC.net/city#hasName  >    “Cercedilla”  .     24   -­‐>  prefixes  increase  readibility  
  • 25.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   25  
  • 26.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Statements   Statement   Statement   Statement   Statement   Statement  
  • 27.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Statement  follows  triple  structure             <hIp://www.R4SC.net/today#building_1>    <hIp://www.R4SC.net/city#partOfCity  >    <hIp://ciYes.com/#cercedilla>  .     27   Triple   <hIp:// www.R4SC.net/ today#building_1>   <hIp://ciYes.com/ #cercedilla>   <hIp://www.R4SC.net/ city#partOfCity>  
  • 28.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Combining  statements     <hIp://www.R4SC.net/today#building_1>      <hIp://www.R4SC.net/building#hasRoom  >              <hIp://www.R4SC.net/ today#room_1>  ;      <hIp://www.R4SC.net/building#hasName  >    “Our  summer  school  building";      <hIp://www.R4SC.net/city#partOfCity  >    <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      <hIp://www.R4SC.net/city#closeToCity  >    <hIp://ciYes.com/#madrid>  ;    <hIp://www.R4SC.net/city#hasName  >    “Cercedilla”  .     28   Same  subject   AND  [next  statement]   Same  subject   Same  subject   AND  [next  statement]   ,  !  Same  subject,  same  predicate  
  • 29.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   List  of  all  statements     <hIp://www.R4SC.net/today#building_1>    <hIp://www.R4SC.net/ building#hasRoom  >        <hIp://www.R4SC.net/today#room_1>  .     <hIp://www.R4SC.net/today#building_1>    <hIp://www.R4SC.net/ building#hasName  >    “Our  summer  school  building”  .     <hIp://www.R4SC.net/today#building_1>      <hIp://www.R4SC.net/city#partOfCity  >    <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      <hIp://www.R4SC.net/city#closeToCity  >    <hIp://ciYes.com/#madrid>  .     <hIp://ciYes.com/#cercedilla>      <hIp://www.R4SC.net/city#hasName  >    “Cercedilla”  .     29  
  • 30.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Statements   Statement   Statement   Statement   Statement   Statement  
  • 31.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   31  
  • 32.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Recap  on  the  URIs   URI   URI   URI   URI   URI   URI   URI   URI   URI   URI   URI  
  • 33.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Literals  in  the  statements     <hIp://www.R4SC.net/today#building_1>    <hIp://www.R4SC.net/ building#hasRoom  >        <hIp://www.R4SC.net/today#room_1>  .     <hIp://www.R4SC.net/today#building_1>    <hIp://www.R4SC.net/ building#hasName  >    “Our  summer  school  building”  .     <hIp://www.R4SC.net/today#building_1>      <hIp://www.R4SC.net/city#partOfCity  >    <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      <hIp://www.R4SC.net/city#closeToCity  >    <hIp://ciYes.com/#madrid>  .     <hIp://ciYes.com/#cercedilla>      <hIp://www.R4SC.net/city#hasName  >    “Cercedilla”  .     33   Literal   Literal  
  • 34.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   ConvenYonal  representaYon  /   disYncYon  from  regular  resources   Resource   Resource   Resource   Resource   Literal   Literal  
  • 35.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Similar  yet  disYnct   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .     @prefix  xsd:  <hIp://www.w3.org/2001/XMLSchema>.         <hIp://www.R4SC.net/today#building_1>        b:hasName  “Our  summer  school  building”  ,              “Our  summer  school  building”@en  ,              “Our  summer  school   building”^^xsd:string       35   Untyped   Typed   Literal  with   language  seWng   Referring  to  type   within  specific   namespace  
  • 36.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   What  is  available  in  xsd   36   http://www.w3.org/TR/xmlschema-2/
  • 37.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   What  is  available  in  xsd   37   http://www.xml.dvint.com/docs/SchemaDataTypesQR-2.pdf
  • 38.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   If  you  do  not  like  xsd...   Simply  define  your  own  datatypes…     @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .     @prefix  dt:  <  hIp://www.R4SC.net/todaysdts#>  .     <hIp://www.R4SC.net/today#building_1>        b:hasName  “Our  summer  school  building”^^dt:myTypeOfString        
  • 39.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  Collec2ons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   39  
  • 40.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   RepeaYng  properYes   •  I  have  a  property  that  can  have  mulYple  values,   now  what?   – SoluYon  1:  Simply  repeat  the  property  of  the   resource  mulYple  Ymes.     – SoluYon  2:  Use  a  structured  value  for  a  literal   – SoluYon  3:  Use  an  RDF  Container  (Sequence,  Bag,   or  Alt)  or  CollecYon  (RDF  List)   http://patterns.dataincubator.org/book/repeated-property.html
  • 41.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  for  soluYon  1:  simply   repeaYng  property   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .     <hIp://www.R4SC.net/today#room_1>      b:hasPersonInside  <hIp://www.R4SC.net/today#PieterPauwels>  ,      <hIp://www.R4SC.net/today#RaulGarciaCastro>  ,        <hIp://www.R4SC.net/ today#AsuncionGomezPerez>  ,      <hIp://www.R4SC.net/ today#MariaPovedaVillalon>    ,      <hIp:// www.R4SC.net/today#FilipRadulovic>  .  
  • 42.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  for  soluYon  2:  Use  a   structured  value  for  a  literal   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .     <hIp://www.R4SC.net/today#room_1>      b:hasPeopleInside  “IRECOGNIZETHIS:PieterPauwels;  IRECOGNIZETHIS:   RaulGarciaCastro;  IRECOGNIZETHIS:AsuncionGomezPerez;  IRECOGNIZETHIS:   MariaPovedaVillalon;  IRECOGNIZETHIS:  FilipRadulovic”   =>  NOT  recommended!!  
  • 43.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  for  soluYon  3   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .     <hIp://www.R4SC.net/today#room_1>      b:hasPeopleInside  (  <hIp://www.R4SC.net/today#PieterPauwels>        <hIp://www.R4SC.net/today#RaulGarciaCastro>          <hIp://www.R4SC.net/ today#AsuncionGomezPerez>        <hIp://www.R4SC.net/ today#MariaPovedaVillalon>          <hIp:// www.R4SC.net/today#FilipRadulovic>  )  
  • 44.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   So,  what  are  our  opYons  for  soluYon  3?   •  Apart  from  resources  and  literals,  it  is  also   possible  to  describe  ‘containers’  and   ‘collecYons’   •  Containers   – Bags   – Sequences   – Alt   •  CollecYons   – Lists   used  to  describe  groups  that  can   ONLY  contain  the  specified   members   used  to  describe  an  open  groups   of  things  (unknown  length)  
  • 45.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Bags  –  Seqs  –  Alts  ??   •  Bag   –  Unordered   –  Resources  or  literals   –  Duplicate  values  are  permiIed   •  Sequence  (Seq)   –  Ordered   –  Resources  or  literals   –  Duplicate  values  are  permiIed   •  AlternaYve  (Alt)   –  Unordered   –  Resources  or  literals   –  Alterna2ves  for  a  single  property  value  (cfr.  language   alternaYves)   These  are  the  convenYons  /  they  are  ‘just’  convenYons  
  • 46.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   List   •  List   – Ordered   – Resources  or  literals   – Duplicate  values  are  permiIed   – Closed  collecYon  –  length  of  list  is  known   •  So,  idenYcal  to  a  sequence,  except  that  the   collecYon  is  closed:  only  the  listed  items  are  in   the  List,  nothing  else  
  • 47.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Back  to  our  example   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .     <hIp://www.R4SC.net/today#room_1>      b:hasPeopleInside  (  <hIp://www.R4SC.net/today#PieterPauwels>        <hIp://www.R4SC.net/today#RaulGarciaCastro>          <hIp://www.R4SC.net/ today#AsuncionGomezPerez>        <hIp://www.R4SC.net/ today#MariaPovedaVillalon>          <hIp:// www.R4SC.net/today#FilipRadulovic>  )  
  • 48.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  downside  of  soluYon  3   <?xml  version="1.0"  encoding="UTF-­‐8"?>   <rdf:RDF  xmlns:b="hIp://www.R4SC.net/building#"  xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#">        <rdf:DescripYon  rdf:about="hIp://www.R4SC.net/today#room_1">              <b:hasPeopleInside  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b1"/>        </rdf:DescripYon>        <rdf:DescripYon  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b4">              <rdf:first  rdf:resource="hIp://www.R4SC.net/today#MariaPovedaVillalon"/>              <rdf:rest  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b5"/>        </rdf:DescripYon>        <rdf:DescripYon  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b5">              <rdf:first  rdf:resource="hIp://www.R4SC.net/today#FilipRadulovic"/>              <rdf:rest  rdf:resource="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#nil"/>        </rdf:DescripYon>        <rdf:DescripYon  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b2">              <rdf:first  rdf:resource="hIp://www.R4SC.net/today#RaulGarciaCastro"/>              <rdf:rest  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b3"/>        </rdf:DescripYon>        <rdf:DescripYon  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b1">              <rdf:first  rdf:resource="hIp://www.R4SC.net/today#PieterPauwels"/>            <rdf:rest  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b2"/>      </rdf:DescripYon>        <rdf:DescripYon  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b3">              <rdf:rest  rdf:nodeID="fabfea5436e794e259b04593dadf0c9f8b4"/>              <rdf:first  rdf:resource="hIp://www.R4SC.net/today#AsuncionGomezPerez"/>        </rdf:DescripYon>   </rdf:RDF>   Blank  nodes   Elaborate  and   complex   descrip2on  
  • 49.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   RepeaYng  properYes   •  I  have  a  property  that  can  have  mulYple  values,   now  what?   – SoluYon  1:  Simply  repeat  the  property  of  the   resource  mulYple  Ymes.  RepeaYng  properYes  is  the   simplest  approach  to  handling  mulY-­‐valued   relaYons.  The  alternaYves  all  have  their  downsides.   – SoluYon  2:  Use  a  structured  value  for  a  literal   – SoluYon  3:  Use  an  RDF  Container  (Sequence,  Bag,   or  Alt)  or  CollecYon  (RDF  List)   http://patterns.dataincubator.org/book/repeated-property.html
  • 50.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Wait  a  second…         Did  you  say  ‘blank  nodes’?  
  • 51.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   What  are  blank  nodes?   •  Blank  nodes  are  nodes  that  do  not  have  URIs   –  No  URI  -­‐>  no  semanYcs  really  -­‐>  unstable  and  unreliable   •  They  are  usually  represented  as:  _:1,  _:city,   _:thiscanbeanythingyouwishfor,  _:8936fazGUID,  …   •  This  representaYon  is  typically  generated  on-­‐the-­‐fly  so   that  it  is  unique  within  the  scope  in  which  an  RDF   graph  is  opened   –  When  opening  this  RDF  graph  the  following  day,  even  in  the   same  scope,  enYrely  different  names  might  be  generated   –  Unstable  and  unreliable   51  
  • 52.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   So,  why  do  we  use  these  blank  nodes?   •  Simply  because  it  is  hard  to  give  everything  an  explicit  name,  this  is  not  always   wanted  /  desirable   •  For  example:   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .     @prefix  region:  <hIp://www.R4SC.net/region#>  .     <hIp://www.R4SC.net/today#building_1>      b:hasRoom  <hIp://www.R4SC.net/today#room_1>  ;      b:hasName  “Our  summer  school  building";      c:partOfCity  <hIp://ciYes.com/#cercedilla>  ;    c:partOfRegion  [  region:locaYon  “NorthOfMadrid”;  region:regiontype  “Forest”]   •  Likewise,  people  do  not  intend  to  define  names  for  all  kinds  of  groups  of  things  -­‐>   hence  a  lot  of  blank  nodes  in  descripYons  of  collecYons  and  containers   52   Blank  node  
  • 53.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   53  
  • 54.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Data  integraYon  now  possible   MyBuilding   CiYes  
  • 55.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   We  already  integrated  datasets!  
  • 56.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Linked  Open  Data  Cloud   •  hIp://lod-­‐cloud.net/   •  datasets  that  have  been  published  in  Linked  Data  format,  by   contributors  to  the  Linking  Open  Data  community  project  and   other  individuals  and  organisaYons   •  based  on  metadata  collected  and  curated  by  contributors  to   the  Data  Hub  as  well  as  on  metadata  extracted  from  a  crawl  of   the  Linked  Data  web  conducted  in  April  2014   •  AIribuYon:  Linking  Open  Data  cloud  diagram  2014,  by  Max   Schmachtenberg,  ChrisYan  Bizer,  Anja  Jentzsch  and  Richard   Cyganiak.  hIp://lod-­‐cloud.net/  
  • 57.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   lod-­‐cloud.net   http://lod-cloud.net (Last version: 2014-08-30)
  • 58.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   History  of  the  LOD   http://lod-cloud.net
  • 59.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   LOD  as  of  May  2007  
  • 60.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   LOD  as  of  March  2009  
  • 61.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   !!!!AdverYsement  break!!!!     RDF(S)  and  SPARQL   Pieter  Pauwels     More  to  come  aser  the  break  
  • 62.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   !!!!AdverYsement  break!!!!   hIp://ldac-­‐2015.bwk.tue.nl/    
  • 63.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Before  the  break  
  • 64.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   LOD  as  of  August  2014  
  • 65.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Circle  sizes  and  arrow  fonts   •  Depending  on  the  size  of  the  dataset  and  the   number  of  triples  between  datasets,  the  layout   in  the  LOD  cloud  schema  is  different.  
  • 66.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Data  integraYon  now  possible   MyBuilding   CiYes  
  • 67.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Status  and  staYsYcs   •  CumulaYve  stats:   hIp://stats.lod2.eu/     •  State  of  the  LOD  cloud  2014:     hIp://linkeddatacatalog.dws.informaYk.uni-­‐ mannheim.de/state/   •  State  of  the  LOD  cloud  2011:     hIp://lod-­‐cloud.net/state/  
  • 68.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Triple  counts   hIp://stats.lod2.eu/    
  • 69.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Stats  -­‐  Datasets  by  topical  domain   hIp://linkeddatacatalog.dws.informaYk.uni-­‐mannheim.de/state/   Topic   Datasets   %   Government   183   18.05%   PublicaYons   96   9.47%   Life  sciences   83   8.19%   User-­‐generated  content   48   4.73%   Cross-­‐domain   41   4.04%   Media   22   2.17%   Geographic   21   2.07%   Social  web   520   51.28%   Total   1014  
  • 70.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Stats  -­‐  CategorizaYon  by  number  of   linked  datasets   Number  of  linked  datasets   Number  of  datasets   more  than  10   79  (7.79%)   6  to  10   81  (7.99%)   5   31  (3.06%)   4   42  (4.14%)   3   54  (5.33%)   2   106  (10.45%)   1   176  (17.36%)   0   445  (43.89%)   hIp://linkeddatacatalog.dws.informaYk.uni-­‐mannheim.de/state/  
  • 71.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Can  my  dataset  be  included?   First,  make  sure  that  you  publish  data  according  to  the   Linked  Data  principles.  We  interpret  this  as:   •  There  must  be  resolvable  h+p://  (or  h+ps://)  URIs.   •  They  must  resolve,  with  or  without  content  negoYaYon,   to  RDF  data  in  one  of  the  popular  RDF  formats  (RDFa,  RDF/ XML,  Turtle,  N-­‐Triples).   •  The  dataset  must  contain  at  least  1000  triples.   •  The  dataset  must  be  connected  via  RDF  links  to  a  dataset   that  is  already  in  the  diagram.  This  means,  either  your   dataset  must  use  URIs  from  the  other  dataset,  or  vice   versam.  We  arbitrarily  require  at  least  50  links.   •  Access  of  the  en=re  dataset  must  be  possible  via  RDF   crawling,  via  an  RDF  dump,  or  via  a  SPARQL  endpoint.   Then,  add  it  to  the  Data  Hub  and  request  to  be  included    
  • 72.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  resolvable  URIs         Hold  on,  what  do  you  mean,  ‘resolvable’?  
  • 73.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Reminder:  What  is  a  URI?   •  URI  stands  for  Unique  Resource  IdenYfier   •  Purpose:  Obtain  globally  unique  idenYfiers,  so  that  informaYon   can  be  exchanged  globally.   •  Structure:    <hIp://www.R4SC.net/today#building_1>   •  Namespace  needed  to  avoid  name  conflicts  with  tags  of  the   same  name:  other  tags  with  the  name  “building_1"  can  be   defined  with  other  namespace  URIs,  and  an  RDF  reader  would   sYll  be  able  to  tell  that  they  were  different  properYes  even   though  they  had  the  same  tag  name.   73   Namespace   Name  
  • 74.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   What  do  you  mean…  resolvable?   •  A  resolvable  URI  is:     “A  URI  whose  resource  has  one  or  more  representa=ons  available  via  invoking  HTTP  GET   on  the  URI”   (source:  hIp://www.w3.org/TR/2010/WD-­‐sparql11-­‐hIp-­‐rdf-­‐update-­‐20100126/)     74   hIp://www.w3.org/TR/cooluris/#oldweb  
  • 75.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Dereferencing  URIs   hIp://wifo5-­‐03.informaYk.uni-­‐mannheim.de/bizer/pub/LinkedDataTutorial/  
  • 76.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   So,  you  are  now  ready  to  publish  here  
  • 77.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Note:  the  O  in  LOD     •  This  does  NOT  mean  that  RDF  is  “OPEN”  by   default   •  Most  datasets  in  the  LOD  cloud  have  licence   informaYon  aIached   •  This  does  NOT  mean  that  RDF  is  “OPEN”  by   default  
  • 78.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   78  
  • 79.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   What  did  we  do  so  far?     @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .       <hIp://www.R4SC.net/today#building_1>      b:hasRoom  <hIp://www.R4SC.net/today#room_1>  ;      b:hasName  “Our  summer  school  building";      c:partOfCity  <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      c:closeToCity  <hIp://ciYes.com/#madrid>  ;    c:hasName  “Cercedilla”  .     79  
  • 80.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  SemanYc  Web  stack   80   Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
  • 81.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  RDF  namespace         @prefix  rdf:  h]p://www.w3.org/1999/02/22-­‐ rdf-­‐syntax-­‐ns#  
  • 82.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  first  few  lines  
  • 83.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   We  have  actually  already  used  it   <?xml  version="1.0"  encoding="UTF-­‐8"?>   <rdf:RDF  xmlns:b="hIp://www.R4SC.net/building#"  xmlns:c="hIp://www.R4SC.net/ city#"  xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#">        <rdf:DescripYon  rdf:about="hIp://www.R4SC.net/today#building_1">              <c:partOfCity  rdf:resource="hIp://ciYes.com/#cercedilla"/>              <b:hasName>Our  summer  school  building</b:hasName>              <b:hasRoom  rdf:resource="hIp://www.R4SC.net/today#room_1"/>        </rdf:DescripYon>        <rdf:DescripYon  rdf:about="hIp://ciYes.com/#cercedilla">              <c:hasName>Cercedilla</c:hasName>              <c:closeToCity  rdf:resource="hIp://ciYes.com/#madrid"/>        </rdf:DescripYon>   </rdf:RDF>   83  
  • 84.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Need  for  structured  vocabularies   •  RDF  graphs  -­‐>  could  be  anything   •  Need  for  semanYcs  /  structured  vocabularies   ⇒   RDFSchema  (RDFS)     ⇒   Web  Ontology  Language  (OWL)  
  • 85.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  SemanYc  Web  stack   85   Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
  • 86.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  RDFS  namespace         @prefix  rdfs:  h]p://www.w3.org/2000/01/rdf-­‐ schema#  
  • 87.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain  
  • 88.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  TTL  graph   -­‐>  ambiguous  /  close  to  meaningless  
  • 89.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  vocabulary  in  TTL   @prefix  rdfs:  <hIp://www.w3.org/2000/01/rdf-­‐schema#>  .   @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .     @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .       b:InfrastructuralElement    rdf:type  rdfs:Class  .     b:Building    rdf:type  rdfs:Class  ;    rdfs:subClassOf  b:InfrastructuralElement  .     b:hasRoom    rdf:type  rdf:Property  ;    rdfs:range  b:Room  ;    rdfs:domain  b:Building  .   89  
  • 90.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  same  thing  in  RDF/XML   <?xml  version="1.0"  encoding="u•-­‐8"?>   <rdf:RDF      xmlns:rdf="hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#"      xmlns:rdfs="hIp://www.w3.org/2000/01/rdf-­‐schema#">      <rdf:Property  rdf:about="hIp://www.R4SC.net/building#hasRoom">            <rdfs:domain  rdf:resource="hIp://www.R4SC.net/building#Building"/>            <rdfs:range  rdf:resource="hIp://www.R4SC.net/building#Room"/>      </rdf:Property>      <rdfs:Class  rdf:about="hIp://www.R4SC.net/building#InfrastructuralElement"/>      <rdfs:Class  rdf:about="hIp://www.R4SC.net/building#Building">            <rdfs:subClassOf    rdf:resource="hIp://www.R4SC.net/ building#InfrastructuralElement"/>      </rdfs:Class>   </rdf:RDF>   90  
  • 91.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Combining  instances  and  vocabulary   @prefix  rdfs:  <hIp://www.w3.org/2000/01/rdf-­‐schema#>  .   @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .     @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  c:  <hIp://www.R4SC.net/city#>  .       b:InfrastructuralElement    rdf:type  rdfs:Class  .     b:Building    rdf:type  rdfs:Class  ;    rdfs:subClassOf  b:InfrastructuralElement  .     b:hasRoom    rdf:type  rdf:Property  ;    rdfs:range  b:Room  ;    rdfs:domain  b:Building  .   91           <hIp://www.R4SC.net/today#building_1>      b:hasRoom  <hIp://www.R4SC.net/today#room_1>;  b:hasName  “Our  summer  school  building";      c:partOfCity  <hIp://ciYes.com/#cercedilla>  .       <hIp://ciYes.com/#cercedilla>      c:closeToCity  <hIp://ciYes.com/#madrid>  ;    c:hasName  “Cercedilla”  .    
  • 92.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  TTL  graph   -­‐>  unambiguous  /  meaningful  semanYcs  
  • 93.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   93  
  • 94.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  SemanYc  Web  stack   94   Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
  • 95.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   So,  it’s  also  just  an  RDF  graph…   95   http://www.w3.org/DesignIssues/diagrams/n3/venn We  s2ck  to  Turtle  today   Let’s  just  quietly  extend  towards  SPARQL   as  well  
  • 96.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   96  
  • 97.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   What  is  SPARQL   •  SPARQL  stands  for  SPARQL  Protocol  and  RDF  Query  Language   •  SPARQL  is  a  Query  Language   •  Find  the  W3C  RecommendaYon  page:   hIp://www.w3.org/TR/rdf-­‐sparql-­‐query/   –  Used  to  express  queries  across  diverse  data  sources,  whether  the  data  is   stored  naYvely  as  RDF  or  viewed  as  RDF  via  middleware.     –  SPARQL  contains  capabiliYes  for  querying  required  and  opYonal  graph   paIerns  along  with  their  conjuncYons  and  disjuncYons.     –  SPARQL  supports  extensible  value  tesYng  and  constraining  queries  by   source  RDF  graph.     –  The  results  of  SPARQL  queries  can  be  results  sets  or  RDF  graphs.  
  • 98.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  inspiraYon:  SQL          select  A1,  A2,  ...,  An      from  r1,  r2,  ...,  rm      where  P  
  • 99.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   SPARQL  template          prefix  a:…      select  concepts      from  datasources      where  {  statements  }      order  by  …  
  • 100.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Structure  of  a  SPARQL  query   •  Prefix  declaraYons    Used  to  abbreviate  URIs   •  Dataset  definiYon    Used  to  state  what  RDF  graph(s)  are  being  queried   •  A  result  clause    Used  to  idenYfy  what  informaYon  to  return  from  the    query   •  The  query  paIern    Used  to  specify  what  to  query  for  in  the  underlying    dataset   •  Query  modifiers,  slicing,  ordering,  and  otherwise      Used  to  rearrange  query  results  (post-­‐processing)  
  • 101.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Let’s  query  our  example  graph  
  • 102.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  SPARQL  Query     PREFIX  b:  <hIp://www.R4SC.net/building#>  .   PREFIX  c:  <hIp://www.R4SC.net/city#>  .     SELECT  ?city2     WHERE  {      ?b  b:hasRoom  <hIp://www.R4SC.net/today#room_1>  .      ?b  c:partOfCity  ?city  .    ?city  c:closeToCity  ?city2   }   variable   Regular  RDF   statements   Regular  RDF   prefix   declara2ons  
  • 103.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Processing  the  WHERE  statement   secYon   •  A  pa+ern  is  matched  against  the  RDF  data   •  “find  a  set  of  bindings  such  that  the  subs=tu=on   of  variables  for  values  creates  a  triple  that  is  in   the  set  of  triples  making  up  the  graph”   •  Source:     hIp://www.w3.org/2004/Talks/17Dec-­‐sparql/ QueryLang1/all.html  
  • 104.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Graph  matching  
  • 105.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  Query  Result         city2   <hIp://ciYes.com/#madrid>  
  • 106.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   106  
  • 107.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Example  SPARQL  endpoint  on  DBPedia   The  HTTP  Address  of  the   endpoint   The  soiware  used  in  the   server  to  store  the  triples   (cfr.  DBMS)   Diverse  op2ons  to  set  
  • 108.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Try  it   Try  it  out  on  the  DBPedia  dataset:          hIp://dbpedia.org/sparql       Or  even  beIer:  host  one  yourself  and  make  it  available     108  
  • 109.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  More  details   •  Concluding  Overview   109  
  • 110.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Matching  literals  (1)   RDF  data:   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  people:  <hIp://www.R4SC.net/people#>  .     @prefix  xsd:  <hIp://www.w3.org/2001/XMLSchema#>  .       <hIp://www.R4SC.net/today#room_1>      b:hasPersonInside  "Pieter"@en    .     <hIp://www.R4SC.net/today#restaurant>      b:hasPersonInside  "Raul"^^xsd:string  .     <hIp://www.R4SC.net/today#airport>      b:hasPersonInside  "Leandro"^^people:keynotespeaker  .     Query   SELECT  ?v  WHERE  {  ?v  ?p  "Pieter"  }     Result   {  }  
  • 111.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Matching  literals  (2)   RDF  data:   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  people:  <hIp://www.R4SC.net/people#>  .     @prefix  xsd:  <hIp://www.w3.org/2001/XMLSchema#>  .       <hIp://www.R4SC.net/today#room_1>      b:hasPersonInside  "Pieter"@en    .     <hIp://www.R4SC.net/today#restaurant>      b:hasPersonInside  "Raul"^^xsd:string  .     <hIp://www.R4SC.net/today#airport>      b:hasPersonInside  "Leandro"^^people:keynotespeaker  .     Query   SELECT  ?v  WHERE  {  ?v  ?p  "Pieter"@en}     Result   {  <hIp://www.R4SC.net/today#room_1>  }  
  • 112.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Matching  literals  (3)   RDF  data:   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  people:  <hIp://www.R4SC.net/people#>  .     @prefix  xsd:  <hIp://www.w3.org/2001/XMLSchema#>  .       <hIp://www.R4SC.net/today#room_1>      b:hasPersonInside  "Pieter"@en    .     <hIp://www.R4SC.net/today#restaurant>      b:hasPersonInside  "Raul"^^xsd:string  .     <hIp://www.R4SC.net/today#airport>      b:hasPersonInside  "Leandro"^^people:keynotespeaker  .     Query   SELECT  ?v  WHERE  {  ?v  ?p  "Leandro"^^<  hIp://www.R4SC.net/people#keynotespeaker  >  }     Result   {  <hIp://www.R4SC.net/today#airport  >  }  
  • 113.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Querying  blank  nodes   RDF  data:   @prefix  b:  <hIp://www.R4SC.net/building#>  .       _:room1  b:hasPersonInside  “Pieter"  .     _:room2  b:hasPersonInside  “Raul"  .     Query   PREFIX  b:  <hIp://www.R4SC.net/building#>     SELECT  ?x  ?name   WHERE    {  ?x  b:hasPersonInside  ?name  }     Result   x name _:c "Pieter" _:d "Leandro" x name _:r "Pieter" _:s "Leandro" …  
  • 114.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   CONSTRUCT  queries   RDF  data:   @prefix  b:        <hIp://www.R4SC.net/building#>  .   @prefix  :          <hIp://www.R4SC.net/today#>  .   _:a    b:presenterName      “Pieter"  .   _:b    b:presenterName      “Raul"  .   :room1  b:hasPersonInside  _:a  .     :room1  b:hasPersonInside  “Raul"  .   :room1  rdf:type  b:R4SCPresentaYonRoom     Query   PREFIX  b:        <hIp://www.R4SC.net/building#>     WHERE    {  ?x  rdf:type  b:R4SCPresentaYonRoom  .     ?x:  b:hasPersonInside  ?z  .     ?z  b:presenterName  ?name  }   CONSTRUCT  {  ?x  b:hasR4SCPresenter  ?name  }     Result   @prefix  b:        <hIp://www.R4SC.net/building#>  .   @prefix  :          <hIp://www.R4SC.net/today#>  .   :room1  b:hasR4SCPresenter  “Pieter”  .   :room1  b:hasR4SCPresenter  “Raul”  
  • 115.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   SPARQL  Filters   RDF  data:   @prefix  b:        <hIp://www.R4SC.net/building#>  .   @prefix  :          <hIp://www.R4SC.net/today#>  .   :room_1  b:hasPresentaYonTitle  “RDF(S)  and  SPARQL"  .   :room_1    b:hasPeopleInside    28  .   :room_2  b:hasPresentaYonTitle  “Handson  session  RDF(S)  and  SPARQL"  .   :room_2    b:hasPeopleInside    23  .     Query   @prefix  b:        <hIp://www.R4SC.net/building#>  .   SELECT    ?Ytle   WHERE      {  ?x  b:hasPresentaYonTitle  ?Ytle        FILTER  regex(?Ytle,  "^Hands")         }     Result   title "Handson session RDF(S) and SPARQL" Many  possibili2es:  string   matching,  value  restric2ons   (greaterThan,  etc.),  DateTime   restric2ons,  …  
  • 116.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   OPTIONAL  keyword   RDF  data:   @prefix  b:        <hIp://www.R4SC.net/building#>  .   @prefix  :          <hIp://www.R4SC.net/today#>  .   :room_1  b:hasPresentaYonTitle  “RDF(S)  and  SPARQL"  .   :room_1    b:hasPeopleInside    28  .   :room_2  b:hasPresentaYonTitle  “Handson  session  RDF(S)  and  SPARQL"  .   :room_2    b:hasPeopleInside    23  .     Query   @prefix  b:        <hIp://www.R4SC.net/building#>  .   SELECT    ?Ytle  ?aIendees   WHERE      {  ?x  b:hasPresentaYonTitle  ?Ytle  .                      OPTIONAL  {  ?x  b:hasPeopleInside  ?aIendees.  FILTER  (?aIendees    >  25)  }                  }     Result     title attendees "RDF(S) and SPARQL" 28 "Handson session RDF(S) and SPARQL" If  there  is  a  match,  give  the  op2onal   data,  otherwise  give  the  required  data  
  • 117.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   LIMIT  Keyword   RDF  data:   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .   <hIp://www.R4SC.net/today#room_1>      b:hasPersonInside  “PieterPauwels"  ,  “RaulGarciaCastro"  ,  “AsuncionGomezPerez"  ,        “MariaPovedaVillalon",  “FilipRadulovic"  .     Query   PREFIX  b:        <hIp://www.R4SC.net/building#>   SELECT  ?name   WHERE  {  ?x  b:hasPersonInside  ?name  }   LIMIT  2     Result     name “PieterPauwels" “RaulGarciaCastro"
  • 118.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   ORDER  BY   RDF  data:   @prefix  b:  <hIp://www.R4SC.net/building#>  .     @prefix  rdf:  <hIp://www.w3.org/1999/02/22-­‐rdf-­‐syntax-­‐ns#>  .   <hIp://www.R4SC.net/today#room_1>      b:hasPersonInside  “PieterPauwels"  ,  “RaulGarciaCastro"  ,  “AsuncionGomezPerez"  ,        “MariaPovedaVillalon",  “FilipRadulovic"  .     Query   PREFIX  b:        <hIp://www.R4SC.net/building#>   SELECT  ?name   WHERE  {  ?x  b:hasPersonInside  ?name  }   LIMIT  2  ORDER  BY  DESC(?name)     Result     name “RaulGarciaCastro" “PieterPauwels"
  • 119.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   DISTINCT  Keyword   RDF  data:   @prefix  b:        <hIp://www.R4SC.net/building#>  .   @prefix  :          <hIp://www.R4SC.net/today#>  .   :room_1  b:hasPresentaYon  [  b:hasPresentaYonTitle  “RDF(S)  and  SPARQL"  ]  .   :room_1  b:hasPresentaYon  [  b:hasPresentaYonTitle  “Handson  session  Generate  your  RDF”;  b:startsAt   “14:30:00”^^xsd:Yme  ]  .   :room_1  b:hasPresentaYon  [  b:hasPresentaYonTitle  “Handson  session  Generate  your  RDF”;  b:startsAt   “17:00:00”^^xsd:Yme  ]  .     Query   PREFIX  b:        <  hIp://www.R4SC.net/building#  >   SELECT  DISTINCT  ?Ytle   WHERE  {  ?x  b:hasPresentaYonTitle  ?Ytle}     Result     title “RDF(S) and SPARQL" “Handson session Generate your RDF"
  • 120.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   UNION  Keyword   RDF  data:   @prefix  b:        <hIp://www.R4SC.net/building#>  .   @prefix  :          <hIp://www.R4SC.net/today#>  .   :room_1  b:hasPresentaYon  [  b:hasPresentaYonTitle  “RDF(S)  and  SPARQL"  ]  .   :room_1  b:hasPresentaYon  [  b:hasPresentaYonTitle  “Handson  session  Generate  your  RDF”;  b:startsAt   “14:30:00”^^xsd:Yme  ]  .   :room_1  b:hasPresentaYon  [  b:hasPresentaYonTitle  “Handson  session  Generate  your  RDF”;  b:startsAt   “17:00:00”^^xsd:Yme  ]  .   _:x1  b:presentaYon  “Linking  Data”  .     Query               @prefix  b:        <hIp://www.R4SC.net/building#>  .   @prefix  :          <hIp://www.R4SC.net/today#>  .     SELECT  DISTINCT  ?Ytle_1  ?Ytle_2   WHERE  {                    {  ?p  b:hasPresentaYonTitle  ?Ytle_1  }                  UNION                    {  ?p1  b:presentaYon  ?Ytle_2  }              }   title “RDF(S) and SPARQL" “Handson session Generate your RDF" “Linking Data” Result  
  • 121.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   But  well,  the  only  way  to  learn  it…   Try  it  out,  for  example,  on  the  DBPedia  dataset:          hIp://dbpedia.org/sparql       Or  even  beIer:  host  one  yourself  and  make  it  available     121  
  • 122.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   Index   •  RDF  graphs:  the  simple  basis   •  Syntax:  talking  the  talk   –  URIs   –  RDF  Statements   –  Literals   –  CollecYons  and  containers   •  Linked  (Open)  Data  Cloud   •  Adding  basic  structure  :  RDFS   •  Querying:  SPARQL   –  The  basis   –  The  SPARQL  endpoint   –  Some  more  complex  examples   •  Concluding  Overview   122  
  • 123.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   The  SemanYc  Web  stack   123   Tim Berners-Lee. WWW past & future, 2003. http://www.w3.org/2003/Talks/0922-rsoc-tbl/.
  • 124.
    LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   LD4SC  Summer  School   7th  -­‐  12th  June,  Cercedilla,  Spain   1st  Summer  School  on     Smart  Ci2es  and  Linked  Open  Data  (LD4SC-­‐15)   Thank  you  for  your  aIenYon!   pipauwel.pauwels@ugent.be