applied databases - the university of edinburgh › teaching › courses › ad › lectures16 ›...
TRANSCRIPT
![Page 1: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/1.jpg)
Sebastian Maneth
Lecture 19Querying RDF with SPARQL
University of Edinburgh - March 21st, 2016
Applied Databases
![Page 2: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/2.jpg)
2
Outline
1. RDF
2. Turtle RDF Syntax
3. SPARQL
4. RDF Schema
![Page 3: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/3.jpg)
3
The Semantic Web
→ term was coined by Tim Berners-Lee (W3C’s director) in a 2001 article in Scientific American (with Hendler and Lassila)
→ extension of the Web through standards by the W3C
→ Semantic Web provides a common framework that allows data to be shared and reused across application, enterprise, and community boundaries”
![Page 4: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/4.jpg)
4
The Semantic Web
→ term was coined by Tim Berners-Lee (W3C’s director) in a 2001 article in Scientific American (with Hendler and Lassila)
→ extension of the Web through standards by the W3C
→ Semantic Web provides a common framework that allows data to be shared and reused across application, enterprise, and community boundaries”
An evolutionary state of the Web in which automated software can → store→ exchange and→ usemachine-readable information on the Web, in turn enabling users to deal with the information with greater efficiency and certainty.
![Page 5: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/5.jpg)
5
The Semantic Web
→ term was coined by Tim Berners-Lee (W3C’s director) in a 2001 article in Scientific American (with Hendler and Lassila)
→ extension of the Web through standards by the W3C
→ Semantic Web provides a common framework that allows data to be shared and reused across application, enterprise, and community boundaries”
Linked Data (Berners-Lee 2006)
1. Use URIs to name (identify) things.2. Use HTTP URIs so that these things can be looked up ("dereferenced").3. Provide useful information about what a name identifies when it's looked up, using open standards such as RDF, SPARQL, etc.4. Refer to other things using their HTTP URI-based names when publishing data on the Web.
![Page 6: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/6.jpg)
6
Uniform Resource Identifier (URI)
→ a string of characters used to identify a resource
→ most common form of a URI is the Uniform Resource Locator (URL) aka “web address”
→ another form is the Uniform Resource Name (URN) a URN identifies a resource by name in a particular namespace e.g. ISBN 0-486-27557-4 cites unambiguously a specific edition of Shakespeare's play Romeo and Juliet.
URN for that edition would be urn:isbn:0-486-27557-4
![Page 7: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/7.jpg)
7
Uniform Resource Identifier (URI)
→ a string of characters used to identify a resource
→ most common form of a URI is the Uniform Resource Locator (URL) aka “web address”
→ another form is the Uniform Resource Name (URN) a URN identifies a resource by name in a particular namespace e.g. ISBN 0-486-27557-4 cites unambiguously a specific edition of Shakespeare's play Romeo and Juliet.
URN for that edition would be urn:isbn:0-486-27557-4
IRI = Internationalized Resource Identifier → extension of URI’s to use Unicode
![Page 8: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/8.jpg)
8
1. Resource Description Framework (RDF)
→ W3C Recommendation February 1998
→ Revised Recommendations Feb 2004 (version 1.0)
→ Revised again in 2014 (version 1.1)
→ designed as a metadata data model
→ build “a vendor-neutral and operating system-independent system of metadata”
![Page 9: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/9.jpg)
9
1. Resource Description Framework (RDF)
→ W3C Recommendation February 1998
→ Revised Recommendations Feb 2004 (version 1.0)
→ Revised again in 2014 (version 1.1)
→ designed as a metadata data model
→ general method for conceptual description or modeling of information
→ allows to make statements about resources
( “the sky”, “has”, “the color blue” )
subject predicate object
an RDF Triple
![Page 10: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/10.jpg)
10
1. Resource Description Framework (RDF)
RDF Triple: ( subject, predicate, object )
→ subject denotes a resource
→ predicate denotes a trait or aspect of the resource; it expresses a relationship between the subject and object
A collection of RDF Triples represents a labeled directed multi-graph
RDF is a data model.Many ways to serialize e.g.
→ RDF/XML→ Turtle→ Jason-LD→ N-Triples→ N-Quads
![Page 11: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/11.jpg)
![Page 12: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/12.jpg)
RDF Description of “Eric Miller” – in Turtle Syntaxliterals
![Page 13: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/13.jpg)
RDF Description of “Eric Miller” – in Turtle Syntax
![Page 14: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/14.jpg)
3. SPARQL
SPARQL Protocol and RDF Query Language
→ RDF Query Language
→ SPARQL 1.0, W3C Recommendation (2008)
→ SPARQL 1.1, W3C Recommendation (2013)
SPARQL query consists of
→ triple patterns→ disjunctions→ conjunctions→ optional patterns
![Page 15: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/15.jpg)
![Page 16: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/16.jpg)
![Page 17: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/17.jpg)
![Page 18: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/18.jpg)
![Page 19: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/19.jpg)
![Page 20: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/20.jpg)
![Page 21: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/21.jpg)
![Page 22: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/22.jpg)
![Page 23: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/23.jpg)
![Page 24: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/24.jpg)
![Page 25: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/25.jpg)
![Page 26: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/26.jpg)
![Page 27: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/27.jpg)
![Page 28: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/28.jpg)
![Page 29: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/29.jpg)
![Page 30: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/30.jpg)
![Page 31: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/31.jpg)
![Page 32: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/32.jpg)
![Page 33: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/33.jpg)
![Page 34: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/34.jpg)
![Page 35: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/35.jpg)
![Page 36: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/36.jpg)
![Page 37: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/37.jpg)
![Page 38: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/38.jpg)
![Page 39: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/39.jpg)
P5
![Page 40: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/40.jpg)
P5
![Page 41: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/41.jpg)
![Page 42: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/42.jpg)
![Page 43: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/43.jpg)
![Page 44: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/44.jpg)
![Page 45: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/45.jpg)
foaf:knows/foaf:name names of friendsfoaf:knows/foaf:knows/foaf:name names of friends of friends
foaf:knows*
foaf:knows{5,7}
Property Paths
→ similar to XPath and regular expressions
![Page 46: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/46.jpg)
![Page 47: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/47.jpg)
![Page 48: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/48.jpg)
![Page 49: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/49.jpg)
![Page 50: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/50.jpg)
![Page 51: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/51.jpg)
![Page 52: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/52.jpg)
![Page 53: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/53.jpg)
![Page 54: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/54.jpg)
![Page 55: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/55.jpg)
![Page 56: Applied Databases - The University of Edinburgh › teaching › courses › ad › lectures16 › ad19.pdf · and community boundaries” Linked Data (Berners-Lee 2006) 1. Use URIs](https://reader033.vdocuments.us/reader033/viewer/2022042400/5f0f2e227e708231d442e268/html5/thumbnails/56.jpg)
ENDLecture 19