Publishing data on the Web (with SPARQL)

Download Report

Transcript Publishing data on the Web (with SPARQL)

Publishing data on the
Web (with SPARQL)
Andy Seaborne,
Semantic and Adaptive Systems Dept
© 2006 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice
Publishing on the Web
•
Making information available
− without knowing the eventual use
− reuse, collaboration
− reproduction of results
•
This talk
− About SPARQL and RDF
− Not covered (but important)
• Economic issues
• DRM, copyright and licensing issues
• ...
Publishing on the Semantic Web
•
Data Access
 SPARQL
•
Information organisation
 OWL, RDFS, SKOS
•
Information format
 RDF
•
Identification
 URIs
•
Serialization
 XML
Publishing via a query service on the web
3
RDF/OWL
•
Why using RDF/OWL?
− natural representation for graphs of relationships
− extensibility, facilities an open eco-system
− ease of model integration
•
•
•
•
composing data from multiple sources
ontology not schema
ease of transformation
variable levels of abstraction
− support for partial models
− inference
SPARQL
SPARQL =
Query Language + Protocol + XML Results
Format
•
Access and query RDF graphs
•
Product of the RDF Data Access Working Group
•
Status: W3C Candidate Recommendation
5
SPARQL Query
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?title2
WHERE
{
?doc
dc:title
?doc
dc:creator
?docOther dc:creator
?docOther dc:title
"SPARQL at speed" .
?c .
?c .
?title2
}
•
On an abstracts/papers database:
“Find other papers by the authors of a given paper.”
6
SPARQL Query
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX shop: <http://example/shop#>
SELECT ?title2
WHERE
{
?doc
dc:title
?title .
FILTER regex(?title, "SPARQL") .
?doc
dc:creator ?c .
?c
foaf:name
?name .
OPTIONAL
{ ?doc shop:price ?price }
}
•
“Find books with ‘SPARQL’ in the title. Get the authors’
name and the price (if available).”
•
Multiple vocabularies
7
Inference
•
An RDF graph may be backed by inference
− OWL, RDFS, application, rules
:x rdf:type :C .
:C rdfs:subClassOf :D .
PREFIX rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?type
WHERE
{
?x rdf:type ?type .
}
-------| type |
========
| :C
|
| :D
|
-------8
SPARQL : Data Virtualization
•
SPARQL as integrator
− Data remains where it is
− Existing applications untouched
− data appears as RDF, remap query to native form
•
SPARQL to SQL
• Direct mapping of tables
− Semi-automatic generation of mapping
− SquirrelRDF (also does LDAP)
• Modelled: D2RQ
− High-quality mapping, manually developed
Federated Query
Single Point of Access
SPARQL
Query
• Inputs:
RDF
Corp
LDAP
SPARQL
Query
– Unified results
SPARQL
Query
• Outputs:
Query Broker
SPARQL => SPARQL
SPARQL
Query
– Service
Description
– Information
Directory
– Request
Doc
DB
10
Access Multiple Sources
PREFIX dc:
PREFIX ldap:
PREFIX foaf:
<http://purl.org/dc/elements/1.1/>
<http://ldap.hp.com/people#>
SELECT ?name ?name2
{
?doc
dc:title
?title .
FILTER regex(?title, “SPARQL”) .
?doc
dc:creator
?reseacher .
?researcher
ldap:email
?email .
?researcher
ldap:name
?name
}
•
“Find the name and email addresses of authors of a
paper”
•
Query tech reports first, then go to LDAP for more
information.
•
SQL database; LDAP server
11
Access Multiple Sources
PREFIX dc:
PREFIX ldap:
PREFIX foaf:
<http://purl.org/dc/elements/1.1/>
<http://ldap.hp.com/people#>
SELECT ?name ?name2
{
?doc
dc:title
?doc
dc:creator
?researcher
ldap:email
}
?title .
?reseacher .
<mailto:[email protected]> .
•
“Find the reports written by the person with
email address [email protected]
•
Go to LDAP first, then the reports database
12
SPARQL : Protocol
SPARQL =
Query Language + Protocol + XML Results
Format
•
One request type expressed in WSDL
•
HTTP and SOAP
•
Results: fixed XML form for further transformation
13
Links
•
Jena: Java and .Net Semantic Web Framework
− http://jena.sourceforge.net/
− RDF, SPARQL, OWL, Rules
− Open source: BSD-license
• Commercial and non-commercial use
•
SPARQL Query
− http://jena.sourceforge.net/ARQ
•
SPARQL Protocol
− http://www.joseki.org
•
SquirrelRDF: Access legacy SQL:
− http://jena.sourceforge.net/SquirrelRDF
14
15
SPARQL Update
INSERT
{ book:newBook dc:title
“More about SPARQL” .
book:newBook dc:creator
[ foaf:mbox <mailto:alex@example> ;
foaf:name “Alex Author” ]
}
DELETE
{ ?book dc:title
?title ;
dc:creator ?c }
WHERE
{ ?book dc:title ?title ;
dc:creator ?c
FILTER regex(?title, “first edition”)
}
•
Future HP proposal to W3C
16