2. Introduction
The Semantic Web, as originally envisioned, is a system that enables
machines to "understand" and respond to complex human requests
based on their meaning. Such an "understanding" requires that the
relevant information sources be semantically structured.
Tim Berners-Lee originally expressed the vision of the Semantic Web as
follows:
I have a dream for the Web [in which computers] become capable of analysing all the
data on the Web – the content, links, and transactions between people and
computers. A "Semantic Web", which makes this possible, has yet to emerge, but
when it does, the day-to-day mechanisms of trade, bureaucracy and our daily lives
will be handled by machines talking to machines.
3. Some other thoughts…
Are you a member of
the SPARQL cult
Alex Karp CEO Palantir
Its about graphs not
trees
Pascal Hitzler
Professor and Director of Data Science at the
Department of Computer Science and Engineering at
Wright State University in Dayton, Ohio
In the six degrees of
separation, not all degrees
are equal.
Malcolm Gladwell, The Tipping
Point: How Little Things Can Make a
Big Difference
4. The Talk Structure
Triples and RDF
◦ What is the Big Deal
Resource Description Framework (RDF)
◦ A formal way to represent information
◦ Some of Nomenclature
◦ Some data structures
SPARQL
◦ A language not dissimilar to SQL but can interrogate the Semantic Web
Ontological Representations
◦ A formal way to describe structure
Analytics
◦ Some SNA stuff
The Triple Store Implementations
Some of my stuff – Dealing with Massive RDF Lists
7. The Triple
Subject Predicate Object
Resource or Blank Resource Resource, Literal or Blank
Triple
Note: The URL can identify data in the cloud
or on premise.
Note: No need for NULLs
8. RDF
• RDF - Resource Description Framework and it is a flexible schema-
less data model
• Standards based – W3C
• RDF Syntax
o N3/Turtle
o XML
• Predefined RDF Structures
o Bag
o Seq
o Alt
o List
These are the only data
structures
10. RDF Property Constants
Note: A Predicate is also referred to as property used when the
object is a Literal
Property Description Usage
rdf:first First Element in a list rdf:Property
rdf:rest Rest of the List rdf:Property
rdf:_i List Sequence rdf:Property
rdf:nil End of the List rdf:Resource
Note: If a Predicate is a number the number value is preceded
by an underscore _
13. SPARQL
SPARQL(pronounced "sparkle", a recursive
acronym[2] for SPARQL Protocol and RDF Query Language) is an RDF
query language, that is, a semantic query language for databases, able
to retrieve and manipulate data stored in Resource Description
Framework (RDF) format. It was made a standard by the RDF Data
Access Working Group (DAWG) of the World Wide Web Consortium, and
is recognized as one of the key technologies of the semantic web. On 15
January 2008, SPARQL 1.0 became an official W3C
Recommendation, and SPARQL 1.1 in March, 2013.
Note: Source Wikipedia
14. The Language Structure
PREFIX abc: <nul://sparql/exampleOntology#> .
SELECT ?capital ?country WHERE {
?x abc:cityname ?capital ;
<nul://sparql/exampleOntology#isCapitalOf> ?y.
?y abc:countryname ?country ;
abc:isInContinent abc:Africa.
}
CURI
Resource
Note: It is a bit like an SQL Select Statement
Fully
Qualified
Triple
Variable
16. Describe
DESCRIBE ?x WHERE {
?x a txn:Occurrence.
?x dcterms:date "2010-09-29".
}
LIMIT 10
txn:Occurrence
"2010-09-29".
Note: Describe always returns RDF !
Node to
describe
17. Ask
ASK {
?x a txn:Occurrence.
?x dcterms:date "2010-09-29".
}
Yes or No
18. Select
SELECT ?person ?name ?email WHERE {
?person foaf:email ?email.
?person foaf:name ?name.
?person foaf:skill "internet".
}
LIMIT 50
Note: Results are returned in a tabular format
19. Results from the Select
person name email
<http://www.w3.org/People/karl/karl-foaf.xrdf#me> "Karl Dubost" <mailto:karl@w3.org>
<http://www.w3.org/People/card#amy> "Amy van der Hiel" <mailto:amy@w3.org>
<http://www.w3.org/People/card#edd> "Edd Dumbill" <mailto:edd@xmlhack.com>
<http://www.w3.org/People/card#dj> "Dean Jackson" <mailto:dean@w3.org>
<http://www.w3.org/People/card#edd> "Edd Dumbill" <mailto:edd@usefulinc.com>
<http://www.aaronsw.com/about.xrdf#aaronsw> "Aaron Swartz" <mailto:me@aaronsw.com>
<http://www.w3.org/People/card#i> "Timothy Berners-Lee" <mailto:timbl@w3.org>
<http://www.w3.org/People/EM/contact#me> "Eric Miller" <mailto:em@w3.org>
<http://www.w3.org/People/card#edd> "Edd Dumbill" <mailto:edd@xml.com>
<http://www.w3.org/People/card#dj> "Dean Jackson" <mailto:dino@grorg.org>
<http://www.w3.org/People/card#libby> "Libby Miller" <mailto:libby.miller@bristol.ac.uk>
<http://www.w3.org/People/Connolly/#me> "Dan Connolly" <mailto:connolly@w3.org>
21. The Optional Clause Result
foaf:based_near
foaf:name
foaf:based_near
foaf:img
foaf:homepage
mo:MusicArtist
foaf:name
mo:MusicArtist
foaf:based_near
foaf:name
foaf:homepage
foaf:img
foaf:img
22. Select - Filter
PREFIX prop: <http://dbpedia.org/property/> .
ASK WHERE {
<http://dbpedia.org/resource/Amazon_River> prop:length ?amazon .
<http://dbpedia.org/resource/Nile> prop:length ?nile .
FILTER(?amazon > ?nile) .
}
Note: Filters are applied after the results are selected
Note: Filters can appear anywhere within the SELECT statement
23. Alternatives - Union
PREFIX go: <http://purl.org/obo/owl/GO#> .
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
PREFIX odo: <http://www.obofoundry.org/ro/ro.owl#> .
SELECT DISTINCT ?label ?process
COUNT(*) AS ?count
WHERE {
{ ?process obo:part_of go:GO_0007165 }
UNION
{ ?process rdfs:subClassOf go:GO_0007165 }
?process rdfs:label ?label
}
GROUP BY ?label ORDER BY DESC(COUNT(*))
GROUP BY ?interest ORDER BY DESC(COUNT(*))
COUNT(*) AS ?count
24. SPARQL - Update
PREFIX prop: <http://dbpedia.org/property/> .
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA {
<http://example/book1> dc:title "A new book" ;
dc:creator "A.N.Other" . }
PREFIX dc: <http://purl.org/dc/elements/1.1/>
DELETE DATA {
<http://example/book2> dc:title "David Copperfield" ;
dc:creator "Edmund Wells" . }
Note: You can only insert and delete triplets
25. Quads – The Graph
CONSTRUCT {
GRAPH :g { ?s :p ?o }
{ ?s :p ?o }
<http://purl.org/obo/owl/GO#> { :s ?p :o }
WHERE {
.
.
.
}
Note: Can be seen as a schema in a relational database
Default Graph
URI
27. Property Paths
Syntax Form Matches
uri
A URI or a prefixed name. A path
of length one.
^elt Inverse path (object to subject).
(elt)
A group path elt, brackets control
precedence.
elt1 / elt2
A sequence path of elt1, followed
by elt2
elt1 ^ elt2
Shorthand for elt1 / ^elt2, that
is elt1 followed by the inverse
of elt2.
elt1 | elt2
A alternative path of elt1,
or elt2 (all possibilities are tried).
elt*
A path of zero or more
occurrences of elt.
elt+
A path of one or more occurrences
of elt.
elt? A path of zero or one elt.
elt{n,m}
A path between n and m
occurrences of elt.
elt{n}
Exactly n occurrences of elt. A
fixed length path.
elt{n,} n or more occurrences of elt.
elt{,n}
Between 0 and n occurrences
of elt.
SELECT ?value WHERE {
:list rdf:rest* []
[] rdf:first ?value
}
Note: Note the use [] this tells
the SPARQL parser that the triples
share a common resource.
32. RDFS
RDF Schema (or RDFS) defines classes and properties.
The resources in the RDFS vocabulary have URIrefs beginning with
http://www.w3.org/2000/01/rdf-schema#
ex:Vehicle rdf:type rdfs:Class.
ex:Car rdfs:subClassOf ex:Vehicle .
ex:Van rdfs:subClassOf ex:Vehicle .
ex:Truck rdfs:subClassOf ex:Vehicle .
ex:MiniVan rdfs:subClassOf ex:Van .
ex:MiniVan rdfs:subClassOf ex:Car .
Class
Vehicle
Van
MiniVan
Truck Car
MiniVan
33. OWL
The Ontology Web Language (OWL) is a family of knowledge
representation languages for authoring ontologies. Ontologies are a formal
way to describe taxonomies and classification networks, essentially defining
the structure of knowledge for various domains: the nouns representing
classes of objects and the verbs representing relations between the objects.
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class>
<owl:oneOf rdf:parseType="Collection">
<owl:Thing rdf:about="#Tosca" />
<owl:Thing rdf:about="#Salome" />
</owl:oneOf>
</owl:Class>
<owl:Class>
<owl:oneOf rdf:parseType="Collection">
<owl:Thing rdf:about="#Turandot" />
<owl:Thing rdf:about="#Tosca" />
</owl:oneOf>
</owl:Class>
</owl:intersectionOf>
</owl:Class>
OWL is intended to be used when the information
contained in documents needs to be processed by
applications, as opposed to situations where the
content only needs to be presented to humans. OWL
can be used to explicitly represent the meaning of
terms in vocabularies and the relationships between
those terms. OWL has more facilities for expressing
meaning and semantics than XML, RDF, and RDFS, and
thus OWL goes beyond these languages in its ability to
represent machine interpretable content on the Web.
35. Ontologies
The Friend Of A Friend (FOAF) ontology
Project homepage: http://www.foaf-project.org/
Namespace: http://xmlns.com/foaf/0.1/
Typical prefix: foaf:
Documentation: http://xmlns.com/foaf/spec/
The Dublin Core (DC) ontology
Project homepage: http://dublincore.org/
Namespace: http://purl.org/dc/elements/1.1/ and http://purl.org/dc/terms/
Typical prefix: dc: and dcterm:
Documentation: http://dublincore.org/specifications/
Description: this is a light weight RDFS vocabulary for describing generic
metadata.
38. Aduna Sesame
Aduna Sesame
◦ Multiple back-end relational database support
◦ MYSQL
◦ PostgresDB
◦ Oracle (Provided by Oracle)
◦ Various Third Party Implementations
◦ Limited support for the property path expression
◦ Not great for massive graph retrievals
◦ Comes with a complient REST interface
◦ Excellent Management Console
39. Sesame Back-ends
Ontotext GraphDB™
Ontotext GraphDB™ (formerly OWLIM) is a leading RDF Triplestore built on OWL (Ontology Web
Language) standards, and fully compatible with the Sesame APIs. GraphDB handles massive loads,
queries and OWL inferencing in real time. Ontotext offers three versions: GraphDB™ Lite, GraphDB™
Standard and GraphDB™ Enterprise.
CumulusRDF
CumulusRDF is an RDF store on a cloud-based architecture, fully compatible with the
Sesame APIs. CumulusRDF provides a REST-based API with CRUD operations to manage
RDF data. The current version uses Apache Cassandra as storage backend.
Systap Blazegraph™
Blazegraph™ (formerly known as Bigdata) is an enterprise graph database by Systap, LLC
that provides a horizontally scaling, fully Sesame-compatible, storage and retrieval
solution for very large volumes of RDF.
40. Apache Jena
Apache Jena
◦ Multiple back-end relational database support
◦ Does support property paths
◦ OK on large graph retrievals
ARQ (SPARQL)
Query your RDF data using ARQ, a SPARQL 1.1compliant engine. ARQ supports remote federated
queries and free text search.
Fuseki
Expose your triples as a SPARQL end-point accessible over HTTP. Fuseki provides REST-style interaction
with your RDF data.
Inference API
Reason over your data to expand and check the content of your triple store. Configure your own
inference rules or use the built-in OWL and RDFS reasoners.
Note: Originally developed by Hewlett Packard
42. Oracle
Has 2 implementations
◦ Has two implementations
◦ A relation back-end (part of the Spatial Pack)
Not so Good (not good for large Graphs)
◦ Built on Oracle Big Data/NoSQL technology
◦ Utilises Apache Jena
◦ Get Neil’s thumbs up
Oracle has nearly two decades of experience working with spatial and graph
database technologies. We have combined this with cutting edge research
from Oracle Labs to deliver advanced analytics for the NoSQL and Hadoop
platform.
Oracle Big Data Spatial and Graph- Q&A with James Steiner,
VP of product management
Melli Annamalai, PhD
43. Bench Mark – Load Times
0
10
20
30
40
50
60
70
80
20
40
60
80
100
120
140
160
180
200
220
240
(Systap) Bigdata
(Sesame) Postgres
(Oracle) Spatial
(Sesame) File
Time in Minutes
44. Bench Mark – Retrieval Times
0
5
10
15
20
25
30
35
40
45
20
40
60
80
100
120
140
160
180
200
220
240
(Systap) Bigdata
(Sesame) Postgres
(Oracle) Spatial
(Sesame) File
TriplesRetrieved–1000s
Time in Minutes
46. Bongo’s Goals
Focus on Tabular Data
◦ Develop an efficient RDF list structure
◦ Creation and Extraction
◦ Integrates with other RDF Implementations
◦ Property Path expression support
◦ Nice Thin and Thick GUIs with an accompanying Command Line Interface
Subject Predicate Object
Triple
Key – only for literals values not resources
47. Retrieval Patterns
Subject Object Predicate Description
○ Any Any Retrieve all the triplets
for a given subject.
○ ○ Any Retrieve all the triplets for a given
object.
Any ○ Any Retrieve all the triplets for a given
predicate
Any Any ○ Retrieve all triplets for a given
object
Any ○ ○ Retrieve all triplets for a specific
object and predicate combination
○ Any ○ Return all the triplets for a given
subject and object
Any Any Any Return all the triplets contained
with in a graph
○ ○ ○ Determine if a specific triple
pattern exists within a graph
52. Conclusion
This talk covered:
RDF
RDF Structures
The SPARQL language
SPARQL Analytical Tools
Property Paths
R Integration
Ontology and Ontological Support
Triple Store Implementations
My Stuff
Bongo
Snail
Note: Read Foundations of Semantic Web Technologies
Pacscal Hitzler, Markus Krotzsch and Sebastian Rudolph
RDF defines a reification vocabulary which provides for describing RDF statements without stating them. These descriptions of statements can be queried by using the defined vocabulary.