SPARQL: Query Language for RDF
指導⽼老師 許慶⽣生 教授
Sir Tim Berners-Lee
Born 8 June 1955
British computer scientist.
The inventor of the World Wide
The concept of the Semantic
Web is the brainchild of the
original creator of the WorldWide Web.(1998)
This NeXT Computer was used by Berners-Lee at CERN and
became the world's ﬁrst web server
An extension of the World Wide Web that allows computers to
intelligently search, combine, and process Web content based on
the meaning that this content has to humans.(Pascal Hitzler, Markus
Krotzsch, and Sebastian Rudolph 2010).
The idea behind the Semantic Web is 'to weave a Web that not only
links documents to each other but also recognises the meaning of
the information in those documents.' (Frauenfelder 2001);
—Tim Berners-Lee, 2006
「…….,Web 2.0 and access to a semantic Web
integrated across a huge space of data, you'll
have access to an unbelievable data resource
–Tim Berners-Lee, 2006
(Resource Description Framework)
Formal language for describing structured information.
The goal of RDF is to enable applications to exchange data
on the Web while still preserving their original meaning.
RDF consequently is often viewed as the basic
representation format for developing the Semantic Web.
Based on a very simple graph-oriented data schema.
A ﬁrst ofﬁcial speciﬁcation was published in 1999 by the
What is SPARQL?
pronounced as sparkle
RDF query and inference languages
Accordingly simple RDF graphs are used as fundamental query
One of the key technologies of the semantic web.!
Represented using Turtle (Terse RDF Triple Language)
SPARQL allows for a query to consist of triple patterns,
conjunctions, disjunctions, and optional patterns
Matching Literals with Numeric Types
Integers in a SPARQL query indicate an RDF typed literal with the datatype
For example: 42 is a shortened form of "42"^^<http://www.w3.org/2001/
Building RDF Graphs
The SELECT query form returns variable bindings.
The CONSTRUCT query form returns an RDF graph.
The graph is built based on a template which is used to
generate RDF triples based on the results of matching the
graph pattern of the query.
RDF Term Constraints
Restricting the Values of Strings
SPARQL FILTER functions like regex can test RDF literals. regex
matches only plain literals with no language tag. regex can be used to
match the lexical forms of other literals by using the str function.
RDF Term Constraints
Restricting Numeric Values
Pascal Hitzler, Markus Krotzsch, and Sebastian Rudolph (2010). Foundations of Semantic Web
Technologies. Taylor and Francis Group, ISBN-10: 142009050X, ISBN-13: 978-1420090505.