Presentation is loading. Please wait.

Presentation is loading. Please wait.

95-733 Internet Technologies 1 Master of Information System Management Internet Technologies Lecture 7: SPARQL.

Similar presentations


Presentation on theme: "95-733 Internet Technologies 1 Master of Information System Management Internet Technologies Lecture 7: SPARQL."— Presentation transcript:

1 95-733 Internet Technologies 1 Master of Information System Management Internet Technologies Lecture 7: SPARQL

2 95-733 Internet Technologies 2 Master of Information System Management SPARQL SPARQL Simple Protocol and RDF Query Language W3C Recommendation January 2008 Queries written using Turtle - Terse RDF Triple Language Download Jena and ARQ Query Engine For Ruby, see ActiveRDF

3 95-733 Internet Technologies 3 Master of Information System Management SPARQL Three specifications: (1) A query language (2) A query results XML format (3) A WSDL 2.0 Data Access Protocol using HTTP and SOAP SPARQL is read only and cannot modify the RDF data

4 95-733 Internet Technologies 4 Master of Information System Management Input <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rss="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/xhtml"> John Barstow Visions of Aestia by John Barstow This is shortblogger.xml The file bloggers.xml has many bloggers.

5 95-733 Internet Technologies 5 Master of Information System Management Processing PREFIX foaf: SELECT ?url FROM WHERE { ?contributor foaf:name "John Barstow". ?contributor foaf:weblog ?url. } Stored in a file called ex1.rq

6 95-733 Internet Technologies 6 Master of Information System Management Output sparql --query ex1.rq ------------------------ | url | ========================= | --------------------------------------------

7 95-733 Internet Technologies 7 Master of Information System Management Processing PREFIX foaf: PREFIX rdf: SELECT ?url FROM WHERE { ?contributor rdf:type foaf:Person. ?contributor foaf:weblog ?url. } Output sparql --query ex2.rq ------------------------- | url | =============== | -------------------------

8 95-733 Internet Technologies 8 Master of Information System Management Processing PREFIX foaf: PREFIX rdf: SELECT ?x ?n FROM WHERE { ?contributor rdf:type foaf:Person. ?contributor foaf:weblog ?x. ?contributor foaf:name ?n } All three conditions must be satisfied to match the query.

9 95-733 Internet Technologies 9 Master of Information System Management Output sparql --query ex4.rq -------------------------------------------------------------------------------------- | x | n | ================================================ | | "Seth Ladd" | | | "Morten Frederiksen" | | | "Ora Lassila" | | | "Hazaël-Massieux" | | | "Leigh Dodds" | | | "Henry Story" | | | "Jeen Broekstra" | | | "Danny Weitzner" | | | "Dan Brickley" |

10 95-733 Internet Technologies 10 Master of Information System Management Processing PREFIX foaf: PREFIX rdf: SELECT DISTINCT ?n FROM WHERE { ?contributor foaf:name ?n } Output ----------------------------------------- | n | ================= | ”Mike McCarthy" | | "Pasquale Popolizio" | | "Dean Allemang" | :

11 95-733 Internet Technologies 11 Master of Information System Management Processing PREFIX foaf: PREFIX rdf: SELECT DISTINCT ?n FROM WHERE { ?contributor foaf:name ?n } ORDER BY ?n ---------------------- | n | ============= | "Alexandre Passant" | | "Alistair Miles" | | "Andrew Matthews" | | "Benjamin Nowack" :

12 95-733 Internet Technologies 12 Master of Information System Management Semi-Structured Data Definition: If two nodes of the same type are allowed to hold different sets of properties the data is called semi- structured. SPARQL uses the OPTIONAL keyword to process semi- structured data.

13 95-733 Internet Technologies 13 Master of Information System Management Processing PREFIX foaf: PREFIX rdf: SELECT DISTINCT ?n ?interest FROM WHERE { ?contributor foaf:name ?n. OPTIONAL { ?contributor foaf:interest ?interest } } ORDER BY ?n "Tetherless World Constellation group RPI" "Tim Berners-Lee" "Uldis Bojars"

14 95-733 Internet Technologies 14 Master of Information System Management Generating XML PREFIX foaf: PREFIX rdf: SELECT ?n FROM WHERE { ?contributor foaf:name ?n. }

15 95-733 Internet Technologies 15 Master of Information System Management From The Command Line sparql --query ex8.rq --results rs/xml <sparql xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xs="http://www.w3.org/2001/XMLSchema#" xmlns="http://www.w3.org/2005/sparql-results#" > John Barstow


Download ppt "95-733 Internet Technologies 1 Master of Information System Management Internet Technologies Lecture 7: SPARQL."

Similar presentations


Ads by Google