Chapter 3
Chapter 3
USING SEMANTIC
DATA
Querying Data
Information is represented in RDF, need to be accessed for reasoning
and developing applications.
SPARQL query language, pronounced ‘sparkle’, is the standard query
language and protocol for Linked Open Data on the web or for
semantic graph databases (also called RDF triplestores), for letting us
select, extract, and otherwise easily get a hold of particular sections of
knowledge expressed in RDF.
SPARQL is specifically designed for RDF, and is tailored to and relies
upon the various technologies underlying the web.
SPARQL, short for “SPARQL Protocol and RDF Query Language”,
enables users to query information from databases or any data source
that can be mapped to RDF.
SPARQL lets us translate heavily interlinked, graph data into
normalized, tabular data with rows and columns which can
be opened in programs like Excel, or import into a
visualization suite such as plot.ly or Palladio.
It is useful to think of a SPARQL query as a Mad Lib - a set
of sentences with blanks in them. The database will take
this query and find every set of matching statements that
correctly fill in those blanks, returning the matching values
to us as a table.
Take this SPARQL query:
SELECT ?painting
WHERE {
?painting <has medium> <oil on canvas> .
}
?painting - the node (or nodes) that the database will
return.
On receiving this query, the database will search for all
values of ?painting that properly complete the RDF
statement <has medium> <oil on canvas> .
Visualization by the query
When the query runs against the full database, it looks for
the subjects, predicates, and objects that match this
statement, while excluding the rest of the data:
painting
The Nightwatch
Woman with a Balance
RDF and SPARQL has the ability to create complex queries
that reference many variables at a time.
For example, we could search our pseudo-RDF database
for paintings by any artist who is Dutch:
SELECT ?artist ?painting
WHERE {
?artist <has nationality> <Dutch> .
?painting <was created by> ?artist .
}
Used a second variable, ?artist.
The RDF database will return all matching combinations
of ?artist and ?painting that fulfill both of these
statements.
artist painting
Rembrandt van Rijn The Nightwatch
Johannes Vermeer Woman with a Balance
Inferences:
Each page contains the structured data to describe an entity (Jason, Marie and
Italy) and the link to the entity that could be described on a different page or
even on a different website.
Linked open data graph visualization Salzburgerland Tourism
Linked Data vs. Open Data
When data can be freely used and distributed by anyone it is called Open Data.
Open Data not same as Linked Data. Open Data can be made available to
everyone without links to other data. At the same time, data can be linked
without being freely available for reuse and distribution.
The W3C community puts a lot of efforts in enriching the
Linked Open Data (LOD) cloud.
Linked Open Data is a powerful blend of Linked Data and Open Data: it is both
linked and uses open sources
Example: DBPedia a crowd-sourced community effort to
extract structured information from Wikipedia and make it
available on the web(RDF). DBPedia not only includes
Wikipedia data, but also incorporates links
to other datasets on the Web, e.g., to Geonames. –
THANK YOU
07/05/2024 47