SlideShare ist ein Scribd-Unternehmen logo
1 von 42
+

SW Software architecture
and SPARQL
Mariano Rodriguez-Muro,
Free University of Bozen-Bolzano
+

Disclaimer


License




This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 License
(http://creativecommons.org/licenses/by-sa/3.0/)

Material for these slides has been taken from


W3C pages for SPARQL



Jena and Sesame‟s documentation
+

Summary


Semantic web idea, and overview of SWT



RDF data model



Jena intro



SPARQL protocol
+

Reading material


Semantic Web Programming Part III, Chapter 8



FUSEKI tutorial
+
SW Software architectures
+

Architecture of SW applications


Local access




The RDF graph is stored
locally and is accessible
through an API

Mixed access


Manual (hard coded)



Federated Queries



Traversal



Remote access


The RDF graph is owned by
a third party and expossed
through an SPARQLendpoint or a web service
+
Local Access
Triple stores and APIs
+

Local access


Data is managed locally by
means of a triple store (e.g.,
Jena, Sesame)



Data may be:


RDF (e.g., local copies of
Linked Data



Legacy data transformed into
RDF (more in a few)
+

Local access(triple stores)


Possible triple stores:
 Jena TDB, SDB, Sesame,
4Store,…
 Virtuoso, OWLIM,
AllegroGraph,…



3rd party data:
 From DUMPs
 http://wiki.dbpedia.org/
 http://pro.europeana.eu/dat
asets
 Crawling (e.g, LDSpider)



Legacy transformation
+

Local access (legacy sources)


3rd party tools to transform
 CSV
 XLS, etc.



XSLT to transform XML



Mapping based (R2RML,
D2RQ)
 3rd party tools to transform
RDBMS into RDF dumps
 3rd party tools to expose
RDBMS as virtual RDF



All of these will be covered in
the course
+

Local access (local queries)


All triple stores offer SPARQL
execution


Accessible through console
tools (mysql and psql style)

bin/sparql --data=data-mydata.rdf
--query=my-sparql-query.rq



Through their own API
+

SPARQL with Jena in Java


Key API objects


Query



QueryFactory



QueryExecutionFactory



QueryExecution


execAsk() > boolean



execConstruct() > Model



execDescribe() > Model



execSelect() > ResultSet

String queryString = "PREFIX owl:
<http://www.w3.org/2002/07/owl#> SELECT *
WHERE { ?x owl:sameas ?y }";
Query query =
QueryFactory.create(queryString);
QueryExecution qe =
QueryExecutionFactory.create(query, tdb);
ResultSet results = qe.execSelect();
+

SPARQL with Jena in Java


ResultSet


Results from a query in a
table-like manner for
SELECT queries. Each row
corresponds to a set of
bindings which fulfil the
conditions of the query.
Access to the results is by
variable name.



getResultVars() >
List<String>



hasNext() > boolean



next() > QuerySolution

String queryString = "PREFIX owl:
<http://www.w3.org/2002/07/owl#> SELECT *
WHERE { ?x owl:sameas ?y }";
Query query =
QueryFactory.create(queryString);
QueryExecution qe =
QueryExecutionFactory.create(query, tdb);
ResultSet results = qe.execSelect();
+

SPARQL with Jena in Java


QuerySolution


A single answer from a
SELECT query



varNames() >
Iterator<String>



contains(varname) > boolean



get(varname) > RDFNode



getResource(varname) >
Resource



getLiteral(varname) > Literal

String queryString = "PREFIX owl:
<http://www.w3.org/2002/07/owl#> SELECT *
WHERE { ?x owl:sameas ?y }";
Query query =
QueryFactory.create(queryString);
QueryExecution qe =
QueryExecutionFactory.create(query, tdb);
ResultSet results = qe.execSelect();
+

SPARQL with Jena in Java


Tools for ResultSet


ResultSetFormatter




asRDF, asText,
asXMLString, asJSON…

Parameterized SPARQL
query

----------------------------------------------------| uri
|
=====================================================
| <http://www.opentox.org/api/1.1#NumericFeature> |
| <http://www.opentox.org/api/1.1#NominalFeature> |
| <http://www.opentox.org/api/1.1#StringFeature> |
| <http://www.opentox.org/api/1.1#Feature>
|
| <http://www.w3.org/2002/07/owl#Nothing>
|
| <http://www.opentox.org/api/1.1#Identifier>
|
| <http://www.opentox.org/api/1.1#ChemicalName> |
| <http://www.opentox.org/api/1.1#IUPACName>
|
| <http://www.opentox.org/api/1.1#InChI>
|
| <http://www.opentox.org/api/1.1#MolecularFormula> |
| <http://www.opentox.org/api/1.1#CASRN>
|
| <http://www.opentox.org/api/1.1#SMILES>
|
-----------------------------------------------------
+
Remote Access
SPARQL Protocol
+

Remote access (SPARQL Protocol)


Means to access query
processors



Compatible with RDF



Abstract specification



Bindings with the following
protocols:


HTTP



SOAP (WSDL)
+

SPARQL Protocol


Main elements:
 operation
 one operation „query‟
 In message
 one sparql query
 zero or more datasets
 Out Message
 SPARQL results document
(for SELECT or ASK)
 An RDF graph serialized in
RDF/XML (for DESCRIBE
and CONSTRUCT)
+

SPARQL Protocol


Means to access query
processors



Compatible with RDF



Abstract specification



Bindings with the following
protocols:


HTTP



SOAP (WSDL)
+

SPARQL Protocol (HTTP bindings)


Uses HTTP GET and POST messages



Encoded query message (HTTP Encode)



Returns document in requested format (or the default)

PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?book ?who
WHERE { ?book dc:creator ?who }
+

SPARQL Protocol (HTTP bindings)


Request
GET /sparql/?query=EncodedQuery HTTP/1.1
Host: www.example
User-agent: my-sparql-client/0.1



Response (next page)


(Uses the XML formatting for SPARQL results)
HTTP/1.1 200 OK
Date: Fri, 06 May 2005 20:55:12 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="book"/>
<variable name="who"/>
</head>
<results distinct="false" ordered="false">
<result>
<binding name="book"><uri>http://www.example/book/book5</uri></binding>
<binding name="who"><bnode>r29392923r2922</bnode></binding>
</result>
...
</sparql>
+

SPARQL Protocol (HTTP bindings)


Request (specifying the default graph)

GET /sparql/?query=EncodedQuery&default-graph-uri=http://www.other.example/books HTTP/1.1
Host: www.other.example
User-agent: my-sparql-client/0.1



Response (next page)


Runs against the dataset identified by the URI:
http://www.other.example/books
HTTP/1.1 200 OK
Date: Fri, 06 May 2005 20:55:12 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="book"/>
<variable name="who"/>
</head>
<results distinct="false" ordered="false">
<result>
<binding name="book"><uri>http://www.example/book/book5</uri></binding>
<binding name="who"><bnode>r29392923r2922</bnode></binding>
</result>
...
</sparql>
+

SPARQL Protocol (HTTP bindings)


Request with content negotiation

GET /sparql/?query=EncodedQuery&default-graph-uri=http://www.example/jose-foaf.rdf HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Accept: text/turtle, application/rdf+xml



Response (next page)


Using the format specified by the client
HTTP/1.1 200 OK
Date: Fri, 06 May 2005 20:55:11 GMT
Server: Apache/1.3.29 (Unix)
Connection: close
Content-Type: text/turtle
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix myfoaf: <http://www.example/jose/foaf.rdf#>.
myfoaf:jose foaf:name "Jose Jimeñez";
foaf:depiction <http://www.example/jose/jose.jpg>;
foaf:nick "Jo";
...
+

SPARQL Protocol (SOAP bindings)


A protocol for accessing web services



Based on HTTP and XML



Messages are passed through envelopes



SPARQL requests and responses are embedded in the
envelopes
+

SPARQL Protocol (SOAP bindings)


Request (note content type, encoding of the query)

POST /services/sparql-query HTTP/1.1
Content-Type: application/soap+xml
Accept: application/soap+xml, multipart/related, text/*
User-Agent: Axis/1.2.1
Host: www.example
SOAPAction: ""
Content-Length: 438
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance">
<soapenv:Body>
<query-request xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#">
<query>SELECT ?z {?x ?y ?z . FILTER regex(?z, 'Harry')}</query>
</query-request>
</soapenv:Body>
</soapenv:Envelope>
+

SPARQL Protocol (SOAP bindings)


Response is a SOAP message embedding SPARQL/XML
HTTP/1.1 200 OK
Content-Type: application/soap+xml
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<query-result xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#">
<ns1:sparql xmlns:ns1="http://www.w3.org/2005/sparql-results#">
<ns1:head>
<ns1:variable name="z"/>
</ns1:head>
<ns1:results distinct="false" ordered="false">
<ns1:result>
<ns1:binding name="z">
<ns1:literal>Harry Potter and the Chamber of Secrets</ns1:literal>
</ns1:binding>
</ns1:result>
...
</ns1:results>
</ns1:sparql>
</query-result>
</soapenv:Body>
</soapenv:Envelope>
+

SPARQL Protocol (SOAP bindings)


Response is a SOAP message embedding SPARQL/XML
HTTP/1.1 200 OK
Content-Type: application/soap+xml
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<query-result xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#">
<ns1:sparql xmlns:ns1="http://www.w3.org/2005/sparql-results#">
<ns1:head>
<ns1:variable name="z"/>
</ns1:head>
<ns1:results distinct="false" ordered="false">
<ns1:result>
<ns1:binding name="z">
<ns1:literal>Harry Potter and the Chamber of Secrets</ns1:literal>
</ns1:binding>
</ns1:result>
...
</ns1:results>
</ns1:sparql>
</query-result>
</soapenv:Body>
</soapenv:Envelope>
+

Remote access (SPARQLendpoints)


A SPARQL processor that is accessible
through the SPARQL protocol



Many open endpoints:
http://www.w3.org/wiki/SparqlEndpoints



Often accessible through query forms, e.g.:


Dbpedia:
http://dbpedia.org/sparql



BBC programme information:
http://lod.openlinksw.com/sparql/
+

Remote access (SPARQLendpoints)


Using implementing the SPARQL protocol
on your own, or



Using a library that supports the SPARQL
protocol:


Python: RDFLib



PHP: librdf, RAP



JavaScript



Java: Jena, Sesame, etc
+

Remote access (SPARQLendpoints with Jena)


In Jena:
String location = “http://dbpedia.org/sparql”;
String query = “PREFIX …. SELECT …. “;
QueryExecution x = QueryExecutionFactory.sparqlService(location, query);
ResultSet results = x.execSelect();
ResultSetFormatter.out(System.out, results);



The library hides all details about the protocol. You can use the
normal API calls and objects to work with the results.
+
Remote Access
Creating SPARQL endpoints
+

Creating a SPARQL end-point


Most triple stores include a HTTP implementation of the
SPARQL protocol



Set up depends on the system



Jena‟s way is by mean of JOSEKI now (FUSEKI)
+

Setting up Joseki


Package comes with





Server JARs
Scripts to manage the server and data

Once the system is running, the control panel can be found at:
http://localhost:3030/
+

Running a Fuseki Server


fuseki-server --mem /DatasetPathName
create an empty, in-memory dataset



fuseki-server --file=FILE /DatasetPathName
create an empty, in-memory dataset and load FILE into it



fuseki-server --loc=DB /DatasetPathName
Use an existing TDB database, or create one if it doesn‟t exist.



fuseki-server --config=ConfigFile
construct one ore more endpoints based on the config. desc.
+

Server URI scheme


http://*host*/dataset/query
the SPARQL query endpoint.



http://*host*/dataset/update
the SPARQL Update language endpoint.



http://*host*/dataset/data
the SPARQL Graph Store Protocol endpoint.



http://*host*/dataset/upload
the file upload endpoint.

Default port 3030
+

Script Control


Load data
s-put http://localhost:3030/ds/data default books.ttl



Get it back
s-get http://localhost:3030/ds/data default



Query it with SPARQL using the .../query endpoint.
s-query --service http://localhost:3030/ds/query 'SELECT * {?s ?p ?o}'



Update it with SPARQL using the .../update endpoint.
s-update --service http://localhost:3030/ds/update 'CLEAR DEFAULT'
+

Summary


Covered:



SPARQL endpoints



Creating and managing
endpoints




SPARQL through APIS

HTTP Protocol

Later


Transforming data into RDF



Virtual RDF (R2RML, D2RQ)
+

See also


http://www.w3.org/TR/rdf-sparql-protocol/



http://jena.apache.org/documentation/serving_data/



Not discussed here: Serving LOD with dereferencable URI‟s
and the SPARQL protocol
+
Sesame

Weitere ähnliche Inhalte

Was ist angesagt?

RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031kwangsub kim
 
SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)andyseaborne
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLMyungjin Lee
 
Graph Data -- RDF and Property Graphs
Graph Data -- RDF and Property GraphsGraph Data -- RDF and Property Graphs
Graph Data -- RDF and Property Graphsandyseaborne
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeAdriel Café
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphsandyseaborne
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQLOlaf Hartig
 
From SQL to SPARQL
From SQL to SPARQLFrom SQL to SPARQL
From SQL to SPARQLGeorge Roth
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIsJosef Petrák
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapesJose Emilio Labra Gayo
 
Twinkle: A SPARQL Query Tool
Twinkle: A SPARQL Query ToolTwinkle: A SPARQL Query Tool
Twinkle: A SPARQL Query ToolLeigh Dodds
 
The Semantics of SPARQL
The Semantics of SPARQLThe Semantics of SPARQL
The Semantics of SPARQLOlaf Hartig
 
SWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingSWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingMariano Rodriguez-Muro
 

Was ist angesagt? (19)

RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031
 
SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
 
Graph Data -- RDF and Property Graphs
Graph Data -- RDF and Property GraphsGraph Data -- RDF and Property Graphs
Graph Data -- RDF and Property Graphs
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
RDFa Tutorial
RDFa TutorialRDFa Tutorial
RDFa Tutorial
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
 
Jena Programming
Jena ProgrammingJena Programming
Jena Programming
 
5 rdfs
5 rdfs5 rdfs
5 rdfs
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
 
From SQL to SPARQL
From SQL to SPARQLFrom SQL to SPARQL
From SQL to SPARQL
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapes
 
SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1
 
Twinkle: A SPARQL Query Tool
Twinkle: A SPARQL Query ToolTwinkle: A SPARQL Query Tool
Twinkle: A SPARQL Query Tool
 
The Semantics of SPARQL
The Semantics of SPARQLThe Semantics of SPARQL
The Semantics of SPARQL
 
SWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingSWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mapping
 

Andere mochten auch

(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...
(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...
(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...icwe2015
 
morph-LDP: An R2RML-based Linked Data Platform implementation
morph-LDP: An R2RML-based Linked Data Platform implementationmorph-LDP: An R2RML-based Linked Data Platform implementation
morph-LDP: An R2RML-based Linked Data Platform implementationNandana Mihindukulasooriya
 
Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...
Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...
Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...Tom Plasterer
 
Natural Language Processing & Semantic Models in an Imperfect World
Natural Language Processing & Semantic Modelsin an Imperfect WorldNatural Language Processing & Semantic Modelsin an Imperfect World
Natural Language Processing & Semantic Models in an Imperfect WorldVital.AI
 
Semantic web rdf and inferencing
Semantic web   rdf and inferencingSemantic web   rdf and inferencing
Semantic web rdf and inferencingDon Willems
 
SWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfs
SWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfsSWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfs
SWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfsMariano Rodriguez-Muro
 
SWT Lecture Session 7 - Advanced uses of RDFS
SWT Lecture Session 7 - Advanced uses of RDFSSWT Lecture Session 7 - Advanced uses of RDFS
SWT Lecture Session 7 - Advanced uses of RDFSMariano Rodriguez-Muro
 
SWT Lecture Session 8 - Inference in jena
SWT Lecture Session 8 - Inference in jenaSWT Lecture Session 8 - Inference in jena
SWT Lecture Session 8 - Inference in jenaMariano Rodriguez-Muro
 
Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...
Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...
Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...Allison Jai O'Dell
 
Ontology 101 - Kendall & McGuiness
Ontology 101 - Kendall & McGuinessOntology 101 - Kendall & McGuiness
Ontology 101 - Kendall & McGuinessthematixpartners
 

Andere mochten auch (20)

SWT Lecture Session 4 - Sesame
SWT Lecture Session 4 - SesameSWT Lecture Session 4 - Sesame
SWT Lecture Session 4 - Sesame
 
SWT Lab 1
SWT Lab 1SWT Lab 1
SWT Lab 1
 
(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...
(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...
(Semantic Web Technologies and Applications track) "MIRROR: Automatic R2RML M...
 
morph-LDP: An R2RML-based Linked Data Platform implementation
morph-LDP: An R2RML-based Linked Data Platform implementationmorph-LDP: An R2RML-based Linked Data Platform implementation
morph-LDP: An R2RML-based Linked Data Platform implementation
 
Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...
Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...
Harnessing Edge Informatics to Accelerate Collaboration in BioPharma (Bio-IT ...
 
SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2
 
SWT Lab 5
SWT Lab 5SWT Lab 5
SWT Lab 5
 
Natural Language Processing & Semantic Models in an Imperfect World
Natural Language Processing & Semantic Modelsin an Imperfect WorldNatural Language Processing & Semantic Modelsin an Imperfect World
Natural Language Processing & Semantic Models in an Imperfect World
 
Semantic web rdf and inferencing
Semantic web   rdf and inferencingSemantic web   rdf and inferencing
Semantic web rdf and inferencing
 
SWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfs
SWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfsSWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfs
SWT Lecture Session 6 - RDFS semantics, inference techniques, sesame rdfs
 
SWT Lecture Session 8 - Rules
SWT Lecture Session 8 - RulesSWT Lecture Session 8 - Rules
SWT Lecture Session 8 - Rules
 
SWT Lecture Session 7 - Advanced uses of RDFS
SWT Lecture Session 7 - Advanced uses of RDFSSWT Lecture Session 7 - Advanced uses of RDFS
SWT Lecture Session 7 - Advanced uses of RDFS
 
SWT Lab 2
SWT Lab 2SWT Lab 2
SWT Lab 2
 
4 sesame
4 sesame4 sesame
4 sesame
 
SWT Lecture Session 8 - Inference in jena
SWT Lecture Session 8 - Inference in jenaSWT Lecture Session 8 - Inference in jena
SWT Lecture Session 8 - Inference in jena
 
SWT Lab 3
SWT Lab 3SWT Lab 3
SWT Lab 3
 
7 advanced uses of rdfs
7 advanced uses of rdfs7 advanced uses of rdfs
7 advanced uses of rdfs
 
SWT Lecture Session 5 - RDFS
SWT Lecture Session 5 - RDFSSWT Lecture Session 5 - RDFS
SWT Lecture Session 5 - RDFS
 
Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...
Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...
Ontologies and Ontology Languages: RDFS, OWL, and SKOS: University of Florida...
 
Ontology 101 - Kendall & McGuiness
Ontology 101 - Kendall & McGuinessOntology 101 - Kendall & McGuiness
Ontology 101 - Kendall & McGuiness
 

Ähnlich wie SWT Lecture Session 4 - SW architectures and SPARQL

Sparql a simple knowledge query
Sparql  a simple knowledge querySparql  a simple knowledge query
Sparql a simple knowledge queryStanley Wang
 
2008 11 13 Hcls Call
2008 11 13 Hcls Call2008 11 13 Hcls Call
2008 11 13 Hcls CallJun Zhao
 
2009 Dils Flyweb
2009 Dils Flyweb2009 Dils Flyweb
2009 Dils FlywebJun Zhao
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLEmanuele Della Valle
 
03 form-data
03 form-data03 form-data
03 form-datasnopteck
 
Introduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsIntroduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsFulvio Corno
 
Introducing JDBC for SPARQL
Introducing JDBC for SPARQLIntroducing JDBC for SPARQL
Introducing JDBC for SPARQLRob Vesse
 
Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Olaf Hartig
 
2010 03 Lodoxf Openflydata
2010 03 Lodoxf Openflydata2010 03 Lodoxf Openflydata
2010 03 Lodoxf OpenflydataJun Zhao
 
070517 Jena
070517 Jena070517 Jena
070517 Jenayuhana
 
DistributingSoftwareKnowledgeForDevOps
DistributingSoftwareKnowledgeForDevOpsDistributingSoftwareKnowledgeForDevOps
DistributingSoftwareKnowledgeForDevOpsPaul Worrall
 
Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark Databricks
 
Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011Juan Sequeda
 
2009 0807 Lod Gmod
2009 0807 Lod Gmod2009 0807 Lod Gmod
2009 0807 Lod GmodJun Zhao
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic webMarakana Inc.
 

Ähnlich wie SWT Lecture Session 4 - SW architectures and SPARQL (20)

Sparql a simple knowledge query
Sparql  a simple knowledge querySparql  a simple knowledge query
Sparql a simple knowledge query
 
2008 11 13 Hcls Call
2008 11 13 Hcls Call2008 11 13 Hcls Call
2008 11 13 Hcls Call
 
2009 Dils Flyweb
2009 Dils Flyweb2009 Dils Flyweb
2009 Dils Flyweb
 
SPARQLing cocktails
SPARQLing cocktailsSPARQLing cocktails
SPARQLing cocktails
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
03 form-data
03 form-data03 form-data
03 form-data
 
Introduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsIntroduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applications
 
Introducing JDBC for SPARQL
Introducing JDBC for SPARQLIntroducing JDBC for SPARQL
Introducing JDBC for SPARQL
 
Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)
 
Data shapes-test-suite
Data shapes-test-suiteData shapes-test-suite
Data shapes-test-suite
 
2010 03 Lodoxf Openflydata
2010 03 Lodoxf Openflydata2010 03 Lodoxf Openflydata
2010 03 Lodoxf Openflydata
 
Querying Linked Data
Querying Linked DataQuerying Linked Data
Querying Linked Data
 
Jdbc[1]
Jdbc[1]Jdbc[1]
Jdbc[1]
 
JDBC programming
JDBC programmingJDBC programming
JDBC programming
 
070517 Jena
070517 Jena070517 Jena
070517 Jena
 
DistributingSoftwareKnowledgeForDevOps
DistributingSoftwareKnowledgeForDevOpsDistributingSoftwareKnowledgeForDevOps
DistributingSoftwareKnowledgeForDevOps
 
Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark Parallelize R Code Using Apache Spark
Parallelize R Code Using Apache Spark
 
Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011
 
2009 0807 Lod Gmod
2009 0807 Lod Gmod2009 0807 Lod Gmod
2009 0807 Lod Gmod
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic web
 

Mehr von Mariano Rodriguez-Muro

Mehr von Mariano Rodriguez-Muro (11)

SWT Lecture Session 1 - Introduction
SWT Lecture Session 1 - IntroductionSWT Lecture Session 1 - Introduction
SWT Lecture Session 1 - Introduction
 
ontop: A tutorial
ontop: A tutorialontop: A tutorial
ontop: A tutorial
 
Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...
Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...
Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...
 
Introduction to query rewriting optimisation with dependencies
Introduction to query rewriting optimisation with dependenciesIntroduction to query rewriting optimisation with dependencies
Introduction to query rewriting optimisation with dependencies
 
OXFORD'13 Optimising OWL 2 QL query rewriring
OXFORD'13 Optimising OWL 2 QL query rewriringOXFORD'13 Optimising OWL 2 QL query rewriring
OXFORD'13 Optimising OWL 2 QL query rewriring
 
OWLED'12 Quest
OWLED'12 QuestOWLED'12 Quest
OWLED'12 Quest
 
ODBASE'08 dl-lite explanations
ODBASE'08 dl-lite explanationsODBASE'08 dl-lite explanations
ODBASE'08 dl-lite explanations
 
IMAS'08 obda plugin
IMAS'08 obda pluginIMAS'08 obda plugin
IMAS'08 obda plugin
 
DL'12 dl-lite explanations
DL'12 dl-lite explanationsDL'12 dl-lite explanations
DL'12 dl-lite explanations
 
DL'12 mastro at work
DL'12 mastro at workDL'12 mastro at work
DL'12 mastro at work
 
AMW'11 dependencies-sem index-t-mappings
AMW'11 dependencies-sem index-t-mappingsAMW'11 dependencies-sem index-t-mappings
AMW'11 dependencies-sem index-t-mappings
 

Kürzlich hochgeladen

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 

Kürzlich hochgeladen (20)

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 

SWT Lecture Session 4 - SW architectures and SPARQL

  • 1. + SW Software architecture and SPARQL Mariano Rodriguez-Muro, Free University of Bozen-Bolzano
  • 2. + Disclaimer  License   This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License (http://creativecommons.org/licenses/by-sa/3.0/) Material for these slides has been taken from  W3C pages for SPARQL  Jena and Sesame‟s documentation
  • 3. + Summary  Semantic web idea, and overview of SWT  RDF data model  Jena intro  SPARQL protocol
  • 4. + Reading material  Semantic Web Programming Part III, Chapter 8  FUSEKI tutorial
  • 6. + Architecture of SW applications  Local access   The RDF graph is stored locally and is accessible through an API Mixed access  Manual (hard coded)  Federated Queries  Traversal  Remote access  The RDF graph is owned by a third party and expossed through an SPARQLendpoint or a web service
  • 8. + Local access  Data is managed locally by means of a triple store (e.g., Jena, Sesame)  Data may be:  RDF (e.g., local copies of Linked Data  Legacy data transformed into RDF (more in a few)
  • 9. + Local access(triple stores)  Possible triple stores:  Jena TDB, SDB, Sesame, 4Store,…  Virtuoso, OWLIM, AllegroGraph,…  3rd party data:  From DUMPs  http://wiki.dbpedia.org/  http://pro.europeana.eu/dat asets  Crawling (e.g, LDSpider)  Legacy transformation
  • 10. + Local access (legacy sources)  3rd party tools to transform  CSV  XLS, etc.  XSLT to transform XML  Mapping based (R2RML, D2RQ)  3rd party tools to transform RDBMS into RDF dumps  3rd party tools to expose RDBMS as virtual RDF  All of these will be covered in the course
  • 11. + Local access (local queries)  All triple stores offer SPARQL execution  Accessible through console tools (mysql and psql style) bin/sparql --data=data-mydata.rdf --query=my-sparql-query.rq  Through their own API
  • 12. + SPARQL with Jena in Java  Key API objects  Query  QueryFactory  QueryExecutionFactory  QueryExecution  execAsk() > boolean  execConstruct() > Model  execDescribe() > Model  execSelect() > ResultSet String queryString = "PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT * WHERE { ?x owl:sameas ?y }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, tdb); ResultSet results = qe.execSelect();
  • 13. + SPARQL with Jena in Java  ResultSet  Results from a query in a table-like manner for SELECT queries. Each row corresponds to a set of bindings which fulfil the conditions of the query. Access to the results is by variable name.  getResultVars() > List<String>  hasNext() > boolean  next() > QuerySolution String queryString = "PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT * WHERE { ?x owl:sameas ?y }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, tdb); ResultSet results = qe.execSelect();
  • 14. + SPARQL with Jena in Java  QuerySolution  A single answer from a SELECT query  varNames() > Iterator<String>  contains(varname) > boolean  get(varname) > RDFNode  getResource(varname) > Resource  getLiteral(varname) > Literal String queryString = "PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT * WHERE { ?x owl:sameas ?y }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, tdb); ResultSet results = qe.execSelect();
  • 15. + SPARQL with Jena in Java  Tools for ResultSet  ResultSetFormatter   asRDF, asText, asXMLString, asJSON… Parameterized SPARQL query ----------------------------------------------------| uri | ===================================================== | <http://www.opentox.org/api/1.1#NumericFeature> | | <http://www.opentox.org/api/1.1#NominalFeature> | | <http://www.opentox.org/api/1.1#StringFeature> | | <http://www.opentox.org/api/1.1#Feature> | | <http://www.w3.org/2002/07/owl#Nothing> | | <http://www.opentox.org/api/1.1#Identifier> | | <http://www.opentox.org/api/1.1#ChemicalName> | | <http://www.opentox.org/api/1.1#IUPACName> | | <http://www.opentox.org/api/1.1#InChI> | | <http://www.opentox.org/api/1.1#MolecularFormula> | | <http://www.opentox.org/api/1.1#CASRN> | | <http://www.opentox.org/api/1.1#SMILES> | -----------------------------------------------------
  • 17. + Remote access (SPARQL Protocol)  Means to access query processors  Compatible with RDF  Abstract specification  Bindings with the following protocols:  HTTP  SOAP (WSDL)
  • 18. + SPARQL Protocol  Main elements:  operation  one operation „query‟  In message  one sparql query  zero or more datasets  Out Message  SPARQL results document (for SELECT or ASK)  An RDF graph serialized in RDF/XML (for DESCRIBE and CONSTRUCT)
  • 19. + SPARQL Protocol  Means to access query processors  Compatible with RDF  Abstract specification  Bindings with the following protocols:  HTTP  SOAP (WSDL)
  • 20. + SPARQL Protocol (HTTP bindings)  Uses HTTP GET and POST messages  Encoded query message (HTTP Encode)  Returns document in requested format (or the default) PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?book ?who WHERE { ?book dc:creator ?who }
  • 21. + SPARQL Protocol (HTTP bindings)  Request GET /sparql/?query=EncodedQuery HTTP/1.1 Host: www.example User-agent: my-sparql-client/0.1  Response (next page)  (Uses the XML formatting for SPARQL results)
  • 22. HTTP/1.1 200 OK Date: Fri, 06 May 2005 20:55:12 GMT Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3 Connection: close Content-Type: application/sparql-results+xml <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparql-results#"> <head> <variable name="book"/> <variable name="who"/> </head> <results distinct="false" ordered="false"> <result> <binding name="book"><uri>http://www.example/book/book5</uri></binding> <binding name="who"><bnode>r29392923r2922</bnode></binding> </result> ... </sparql>
  • 23. + SPARQL Protocol (HTTP bindings)  Request (specifying the default graph) GET /sparql/?query=EncodedQuery&default-graph-uri=http://www.other.example/books HTTP/1.1 Host: www.other.example User-agent: my-sparql-client/0.1  Response (next page)  Runs against the dataset identified by the URI: http://www.other.example/books
  • 24. HTTP/1.1 200 OK Date: Fri, 06 May 2005 20:55:12 GMT Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3 Connection: close Content-Type: application/sparql-results+xml <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparql-results#"> <head> <variable name="book"/> <variable name="who"/> </head> <results distinct="false" ordered="false"> <result> <binding name="book"><uri>http://www.example/book/book5</uri></binding> <binding name="who"><bnode>r29392923r2922</bnode></binding> </result> ... </sparql>
  • 25. + SPARQL Protocol (HTTP bindings)  Request with content negotiation GET /sparql/?query=EncodedQuery&default-graph-uri=http://www.example/jose-foaf.rdf HTTP/1.1 Host: www.example User-agent: sparql-client/0.1 Accept: text/turtle, application/rdf+xml  Response (next page)  Using the format specified by the client
  • 26. HTTP/1.1 200 OK Date: Fri, 06 May 2005 20:55:11 GMT Server: Apache/1.3.29 (Unix) Connection: close Content-Type: text/turtle @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix foaf: <http://xmlns.com/foaf/0.1/>. @prefix myfoaf: <http://www.example/jose/foaf.rdf#>. myfoaf:jose foaf:name "Jose Jimeñez"; foaf:depiction <http://www.example/jose/jose.jpg>; foaf:nick "Jo"; ...
  • 27. + SPARQL Protocol (SOAP bindings)  A protocol for accessing web services  Based on HTTP and XML  Messages are passed through envelopes  SPARQL requests and responses are embedded in the envelopes
  • 28. + SPARQL Protocol (SOAP bindings)  Request (note content type, encoding of the query) POST /services/sparql-query HTTP/1.1 Content-Type: application/soap+xml Accept: application/soap+xml, multipart/related, text/* User-Agent: Axis/1.2.1 Host: www.example SOAPAction: "" Content-Length: 438 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"> <soapenv:Body> <query-request xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#"> <query>SELECT ?z {?x ?y ?z . FILTER regex(?z, 'Harry')}</query> </query-request> </soapenv:Body> </soapenv:Envelope>
  • 29. + SPARQL Protocol (SOAP bindings)  Response is a SOAP message embedding SPARQL/XML HTTP/1.1 200 OK Content-Type: application/soap+xml <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <query-result xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#"> <ns1:sparql xmlns:ns1="http://www.w3.org/2005/sparql-results#"> <ns1:head> <ns1:variable name="z"/> </ns1:head> <ns1:results distinct="false" ordered="false"> <ns1:result> <ns1:binding name="z"> <ns1:literal>Harry Potter and the Chamber of Secrets</ns1:literal> </ns1:binding> </ns1:result> ... </ns1:results> </ns1:sparql> </query-result> </soapenv:Body> </soapenv:Envelope>
  • 30. + SPARQL Protocol (SOAP bindings)  Response is a SOAP message embedding SPARQL/XML HTTP/1.1 200 OK Content-Type: application/soap+xml <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <query-result xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#"> <ns1:sparql xmlns:ns1="http://www.w3.org/2005/sparql-results#"> <ns1:head> <ns1:variable name="z"/> </ns1:head> <ns1:results distinct="false" ordered="false"> <ns1:result> <ns1:binding name="z"> <ns1:literal>Harry Potter and the Chamber of Secrets</ns1:literal> </ns1:binding> </ns1:result> ... </ns1:results> </ns1:sparql> </query-result> </soapenv:Body> </soapenv:Envelope>
  • 31. + Remote access (SPARQLendpoints)  A SPARQL processor that is accessible through the SPARQL protocol  Many open endpoints: http://www.w3.org/wiki/SparqlEndpoints  Often accessible through query forms, e.g.:  Dbpedia: http://dbpedia.org/sparql  BBC programme information: http://lod.openlinksw.com/sparql/
  • 32. + Remote access (SPARQLendpoints)  Using implementing the SPARQL protocol on your own, or  Using a library that supports the SPARQL protocol:  Python: RDFLib  PHP: librdf, RAP  JavaScript  Java: Jena, Sesame, etc
  • 33. + Remote access (SPARQLendpoints with Jena)  In Jena: String location = “http://dbpedia.org/sparql”; String query = “PREFIX …. SELECT …. “; QueryExecution x = QueryExecutionFactory.sparqlService(location, query); ResultSet results = x.execSelect(); ResultSetFormatter.out(System.out, results);  The library hides all details about the protocol. You can use the normal API calls and objects to work with the results.
  • 35. + Creating a SPARQL end-point  Most triple stores include a HTTP implementation of the SPARQL protocol  Set up depends on the system  Jena‟s way is by mean of JOSEKI now (FUSEKI)
  • 36. + Setting up Joseki  Package comes with    Server JARs Scripts to manage the server and data Once the system is running, the control panel can be found at: http://localhost:3030/
  • 37. + Running a Fuseki Server  fuseki-server --mem /DatasetPathName create an empty, in-memory dataset  fuseki-server --file=FILE /DatasetPathName create an empty, in-memory dataset and load FILE into it  fuseki-server --loc=DB /DatasetPathName Use an existing TDB database, or create one if it doesn‟t exist.  fuseki-server --config=ConfigFile construct one ore more endpoints based on the config. desc.
  • 38. + Server URI scheme  http://*host*/dataset/query the SPARQL query endpoint.  http://*host*/dataset/update the SPARQL Update language endpoint.  http://*host*/dataset/data the SPARQL Graph Store Protocol endpoint.  http://*host*/dataset/upload the file upload endpoint. Default port 3030
  • 39. + Script Control  Load data s-put http://localhost:3030/ds/data default books.ttl  Get it back s-get http://localhost:3030/ds/data default  Query it with SPARQL using the .../query endpoint. s-query --service http://localhost:3030/ds/query 'SELECT * {?s ?p ?o}'  Update it with SPARQL using the .../update endpoint. s-update --service http://localhost:3030/ds/update 'CLEAR DEFAULT'
  • 40. + Summary  Covered:   SPARQL endpoints  Creating and managing endpoints   SPARQL through APIS HTTP Protocol Later  Transforming data into RDF  Virtual RDF (R2RML, D2RQ)