Internet Technologies - PowerPoint PPT Presentation

Loading...

PPT – Internet Technologies PowerPoint presentation | free to download - id: 4ba68f-NzI0Y



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Internet Technologies

Description:

Internet Technologies Making Queries on RDF * Master of Information System Management Two Approaches SPARQL - Simple Protocol And RDF Query Language - Looks ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 23
Provided by: Office2004854
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Internet Technologies


1
Internet Technologies
  • Making Queries on RDF

2
Two Approaches
  • SPARQL
  • - Simple Protocol And RDF Query
  • Language
  • - Looks like SQL
  • - Used by Dbpedia
  • MQL
  • - Metaweb Query Language
  • - Based on JSON
  • - Used by Freebase

Both freebase and Dbpedia make their statements
available in RDF.
3
Todays Lecture
  • A brief look at SPARQL
  • A brief look at MQL

4
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

5
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

6
Input
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltrdfRDF xmlnsrdf"http//www.w3.org/1999/02/22-r
    df-syntax-ns"
  • xmlnsfoaf"http//xmlns.com/foaf/0.1/"
  • xmlnsrdfs"http//www.w3.org/2000/01/rdf
    -schema"
  • xmlnsrss"http//purl.org/rss/1.0/"
  • xmlnsdc"http//purl.org/dc/elements/1.1
    /"
  • xmlnshtml"http//www.w3.org/1999/xhtml"
    gt
  • ltfoafAgent rdfnodeID"id2246040"gt
  • ltfoafnamegtJohn Barstowlt/foafnamegt
  • ltrdftype rdfresource"http//xmlns.com/foaf/0
    .1/Person"/gt
  • ltfoafwebloggt
  • ltfoafDocument rdfabout"http//www.nzlinux
    .org.nz/blogs/"gt
  • ltdctitlegtVisions of Aestia by John
    Barstowlt/dctitlegt
  • ltrdfsseeAlsogt
  • ltrsschannel rdfabout"http//www.nzl
    inux.org.nz/blogs/wp-rdf.php?cat9"gt
  • ltfoafmaker rdfnodeID"id2246040"/
    gt
  • ltfoaftopic rdfresource"http//ww
    w.w3.org/2001/sw/"/gt
  • ltfoaftopic rdfresource"http//ww
    w.w3.org/RDF/"/gt
  • lt/rsschannelgt

This is shortblogger.xml The file bloggers.xml
has many bloggers.
7
Processing
  • PREFIX foaf lthttp//xmlns.com/foaf/0.1/gt
  • SELECT ?url
  • FROM ltshortblogger.xmlgt
  • WHERE
  • ?contributor foafname "John Barstow" .
  • ?contributor foafweblog ?url .

Stored in a file called ex1.rq
8
Output
  • sparql --query ex1.rq
  • ------------------------
  • url
  • lthttp//www.nzlinux.org.nz/blogs/gt
  • --------------------------------------------

9
Processing
  • PREFIX foaf lthttp//xmlns.com/foaf/0.1/gt
  • PREFIX rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt
  • SELECT ?url
  • FROM ltshortblogger.xmlgt
  • WHERE
  • ?contributor rdftype foafPerson .
  • ?contributor foafweblog ?url .

Output sparql --query ex2.rq ---------------------
---- url
lthttp//www.nzlinux.org.nz/blo
gs/gt -------------------------
10
Processing
  • PREFIX foaf lthttp//xmlns.com/foaf/0.1/gt
  • PREFIX rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt
  • SELECT ?x ?n
  • FROM ltbloggers.xmlgt
  • WHERE
  • ?contributor rdftype foafPerson .
  • ?contributor foafweblog ?x .
  • ?contributor foafname ?n

All three conditions must be satisfied to match
the query.
11
Output
  • sparql --query ex4.rq
  • --------------------------------------------------
    ------------------------------------
  • x
    n
  • lthttp//www.picklematrix.net/semergence/gt
    "Seth Ladd"
  • lthttp//www.wasab.dk/morten/blog/gt
    "Morten Frederiksen"
  • lthttp//www.lassila.org/blog/gt
    "Ora Lassila"
  • lthttp//people.w3.org/dom/gt
    "Hazaël-Massieux"
  • lthttp//xmlarmyknife.org/blog/gt
    "Leigh Dodds"
  • lthttp//blogs.sun.com/bblfish/gt
    "Henry Story"
  • lthttp//jeenbroekstra.blogspot.com/gt
    "Jeen Broekstra"
  • lthttp//people.w3.org/djweitzner/blog/?cat8gt
    "Danny Weitzner"
  • lthttp//danbri.org/words/gt
    "Dan Brickley"

12
Processing
  • PREFIX foaf lthttp//xmlns.com/foaf/0.1/gt
  • PREFIX rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt
  • SELECT DISTINCT ?n
  • FROM ltbloggers.xmlgt
  • WHERE
  • ?contributor foafname ?n

Output -----------------------------------------
n
Mike McCarthy"
"Pasquale Popolizio" "Dean
Allemang"
13
Processing
  • PREFIX foaf lthttp//xmlns.com/foaf/0.1/gt
  • PREFIX rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt
  • SELECT DISTINCT ?n
  • FROM ltbloggers.xmlgt
  • WHERE
  • ?contributor foafname ?n
  • ORDER BY ?n

---------------------- n
"Alexandre Passant"
"Alistair Miles" "Andrew
Matthews" "Benjamin Nowack"
14
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.

15
Processing
  • PREFIX foaf lthttp//xmlns.com/foaf/0.1/gt
  • PREFIX rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt
  • SELECT DISTINCT ?n ?interest
  • FROM ltbloggers.xmlgt
  • WHERE
  • ?contributor foafname ?n .
  • OPTIONAL
  • ?contributor foafinterest ?interest
  • ORDER BY ?n

"Tetherless World Constellation group RPI"
lthttp//www.w3.org/2001/sw/gt "Tetherless World
Constellation group RPI" lthttp//www.w3.org/RDF/gt
"Tim Berners-Lee"
"Uldis Bojars" lthttp//www.w3.org/2001/sw/
gt "Uldis Bojars" lthttp//www.w3.org/RDF/gt

16
Generating XML
  • PREFIX foaf lthttp//xmlns.com/foaf/0.1/gt
  • PREFIX rdf lthttp//www.w3.org/1999/02/22-rdf-syn
    tax-nsgt
  • SELECT ?n
  • FROM ltshortblogger.xmlgt
  • WHERE
  • ?contributor foafname ?n .

17
From The Command Line
  • sparql --query ex8.rq --results rs/xml
  • lt?xml version"1.0"?gt
  • ltsparql
  • xmlnsrdf"http//www.w3.org/1999/02/22-rdf-sy
    ntax-ns"
  • xmlnsxs"http//www.w3.org/2001/XMLSchema"
  • xmlns"http//www.w3.org/2005/sparql-results"
    gt
  • ltheadgt
  • ltvariable name"n"/gt
  • lt/headgt
  • ltresultsgt
  • ltresultgt
  • ltbinding name"n"gt
  • ltliteralgtJohn Barstowlt/literalgt
  • lt/bindinggt
  • lt/resultgt
  • lt/resultsgt
  • lt/sparqlgt

18
MQL
  • Metaweb Query Language
  • Make queries against the freebase data store.
  • The input and outputs are JSON strings.

19
Using MQL In A URL
Example from the MQL documentation. Enter the
following in your browser https//api.freebase.c
om/api/service/mqlread?query querytype/m
usic/artist,nameThe Police,album
This is a query to freebase represented in JSON.
20
Output
  • "code" "/api/status/ok",
  • "result"
  • "album"
  • "Outlandos
    d'Amour",
  • "Reggatta de
    Blanc",
  • "Zenyatt\u00e0
    Mondatta
  • "The Police Live!"
    ,
  • "name" "The Police",
  • "type" "/music/artist"
  • ,
  • "status" "200 OK",
  • "transaction_id"cachecache03.p01.sjc1
    81012011-10-13T15

Many more albums in the real query result.
21
Another look at the query.
  • "query"
  • "type""/music/artist",
  • "name""The Police",
  • "album"

22
Use The Query Editor
  • http//www.freebase.comqueryeditor
About PowerShow.com