More Related Content Similar to Triple Stores (20) Triple Stores1. Triple Stores
Dr. Stephan Volmer
Slide 1 of 34
sparkler! by Vicky Brock
http://www.flickr.com/photos/vickyb/2105951692/
Attribution-ShareAlike 2.0 Generic
C
Dr. Stephan Volmer
© Zühlke 2013
2. Triple Stores
No talk without agenda!
• NoSQL
• Semantic
Web
• RDF
• SPARQL
• Triple
Stores
• Conclusions
Triple Stores | Dr. Stephan Volmer
Slide 2 of 34
© Zühlke 2013
3. NoSQL
New generation of modern web-scale databases!
big data
distributed
schema-free
relaxed consistency
open source
non-relational
simple interface
semi-structured data
eventually consistent
easy replication
Triple Stores | Dr. Stephan Volmer
Slide 3 of 34
© Zühlke 2013
4. NoSQL
New generation of modern web-scale databases!
XML Databases
Multi-Model Databases
Object Databases
Column Family Stores
Graph Databases
Key Value Stores
Triple Stores
Document Databases
Wide Column Stores
Multi-Value Databases
Triple Stores | Dr. Stephan Volmer
Grid & Cloud Database Solutions
Slide 4 of 34
© Zühlke 2013
5. Sematic Web
The tale of unstructured data and standardized metadata…
• Unstructured
common
• How
data is becoming more and more
do we best handle unstructured data?
Relational databases are not the answer!
• Metadata
helps describe the content of
unstructured data
• Creating
a standard will help push forward the
semantic web
Triple Stores | Dr. Stephan Volmer
Slide 5 of 34
© Zühlke 2013
6. Semantic Web
The semantic web is a web of data!
•
Collaborative movement led by the international standards body,
the World Wide Web Consortium (W3C)
•
Promotes common data formats on the World Wide Web
•
Aims at converting the current web dominated by unstructured
and semi-structured documents into a “web of data”
“The Semantic Web provides a common framework that allows
data to be shared and reused across applications, enterprises,
and community boundaries.”
Triple Stores | Dr. Stephan Volmer
Slide 6 of 34
© Zühlke 2013
7. Semantic Web
The semantic web stack!
User Interface & Applications
Trust
Proof
Logic
Querying
Rules
Taxonomies
Data Interchange
Cryptography
Ontologies
Syntax
Identifiers
Triple Stores | Dr. Stephan Volmer
Character Set
Slide 7 of 34
© Zühlke 2013
8. Semantic Web
The semantic web stack!
User Interface & Applications
Trust
Proof
Logic
Triple Stores | Dr. Stephan Volmer
Rules
Cryptography
Ontologies
Slide 8 of 34
© Zühlke 2013
9. RDF
RDF? YAA, RTFM & STFU!
Resource Description Framework
•
Family of standards from W3C
http://www.w3c.org/RDF/
•
Make statements about things
The sky has the colour blue
•
Syntax is XML
<sky colour="blue"/>
Triple Stores | Dr. Stephan Volmer
Slide 9 of 34
© Zühlke 2013
10. RDF
RDF makes statements about things!
The sky has the colour blue
thing
property
value
triple
Triple Stores | Dr. Stephan Volmer
Slide 10 of 34
© Zühlke 2013
11. RDF
Syntax and semantics, baby!
• Triple
• Any
data structure is a simple EAV model
data structure can be represented as triples
E
A
V
<entity>
<attribute-value>
<value>
<subject>
<predicate>
<object>
• RDF
uses different terminology
Triple Stores | Dr. Stephan Volmer
Slide 11 of 34
© Zühlke 2013
12. RDF
URIs in RDF – we no speak americano!
• Provide
namespaces to uniquely name the things
we want to talk about
• Provide
a way to identify the properties and types
of things in a way that is sharable and unique
• Anyone
can say anything about any things with a
shared URI identifier
Triple Stores | Dr. Stephan Volmer
Slide 12 of 34
© Zühlke 2013
13. RDF
URIs in RDF – we no speak americano!
• Subject
• Object
and Predicate are always URIs
is either a literal or another URI
<http://www.zuehlke.com/person/stv>
subject
<http://www.zuehlke.com/properties/name>
predicate
"Stephan Volmer"
object
<http://www.zuehlke.com/person/stv>
<http://www.zuehlke.com/properties/business-unit>
<http://www.zuehlke.com/business-units/dns>
<http://www.zuehlke.com/person/stv>
<http://www.zuehlke.com/properties/email>
"stephan.volmer@zuehlke.com"
Triple Stores | Dr. Stephan Volmer
Slide 13 of 34
© Zühlke 2013
14. RDF
RDF graphs are the glue to make it work.
• Logical
• One
collection of triples
store may contain many graphs
• Named
graphs are RDF graphs with a
URI name often called the context
• Graphs
–
–
–
–
–
can be targeted
import data into a graphs
export a graph
query / update data in graph
merging data from different sources
controlling access to data
Triple Stores | Dr. Stephan Volmer
Slide 14 of 34
© Zühlke 2013
15. RDF
Namespaces, ontologies and other fun stuff…
prefix:person
prefix:company
prefix:ont
prefix:rdf
<http://www.zuehlke.com/person/>
<http://www.zuehlle.com/company/>
<http://www.zuehlke.com/types/>
<http://www.w3c.org/1999/02/22-rdf-syntax-ns#>
person:stv
person:stv
person:stv
person:stv
rdf:type
ont:worksfor
ont:name
ont:email
ont:person
company:zuehlke
"Stephan Volmer"
"stephan.volmer@zuehlke.com"
vocabulary
Triple Stores | Dr. Stephan Volmer
Slide 15 of 34
© Zühlke 2013
16. RDF
Say good-bye to schema-free, say hello to schema-less!
• Core
• Any
RDF is schema-free
shape of data can be poured into a triple store
• Sometimes
a common ontology is helpful for
sharing and reusing knowledge bases
RDF
Schema
Triple Stores | Dr. Stephan Volmer
• Set
of RDF properties for defining
types and their constraints
• RDF
schema is expressed as RDF
Slide 16 of 34
© Zühlke 2013
17. RDF
Behold, they are one people, and they have all one language!
prefix:person
prefix:ont
prefix:rdf
prefix:rdfs
prefix:xsd
<http://www.zuehlke.com/person/>
<http://www.zuehlke.com/types/>
<http://www.w3c.org/1999/02/22-rdf-syntax-ns#>
<http://www.w3.org/2000/01/rdf-schema#>
<http://www.w3.org/2001/XMLSchema#>
person:stv
ont:person
ont:age
ont:age
ont:age
rdf:type
rdf:type
rdf:type
rdfs:domain
rdfs:range
Triple Stores | Dr. Stephan Volmer
ont:person
rdfs:class
rdfs:property
ont:person
xsd:integer
Slide 17 of 34
© Zühlke 2013
18. RDF
RDF object models – bridging the gap!
• Associations
• Maps
• Mapping
are at the heart of the RDF model
well to object models with entity to entity associations
between object model and RDF model can be loose
• Object
model can be a subset of the RDF model
• Allows
much greater flexibility in evolving the model and data
independently
• RDF
is schema-less, but schema languages are available
• It
is possible to impose constraints in the RDF model
Triple Stores | Dr. Stephan Volmer
Slide 18 of 34
© Zühlke 2013
19. RDF
RDF object models – bridging the gap!
var stv = this.context.Persons.Create(‚stv‛);
person:stv rdf:type ont:person
var zuehlke = this.context.Companies.Create(‚zuehlke‛);
company:zuehlke rdf: type:company
stv.Age = 44;
person:stv ont:age ‘41’^^xsd:integer
stv.Labels.Add(‚Lead Software Archtitect‛);
stv.Labels.Add(‚Frankfurt‛);
person:stv ont:label ‚Lead Software Architect‛
person:stv ont:label ‚Frankfurt‛
stv.WorksFor = zuehlke;
person:stv ont:worksfor company:zuehlke
Triple Stores | Dr. Stephan Volmer
Slide 19 of 34
© Zühlke 2013
20. RDF
Wait! Haven’t we seen something similar before?
{
"person":
{
"id": "stv",
"age": 44,
"labels": [ "Lead Software Architect", "Frankfurt" ],
"worksfor":
{
"company":
{
"id": "zuehlke"
}
}
}
}
Triple Stores | Dr. Stephan Volmer
Slide 20 of 34
© Zühlke 2013
21. RDF
Chimera or visionary idea?
Google recently purchased the biggest RDF-based
encyclopedia on the Web and formally announced
that it will use RDF embedded in Web pages.
Yahoo and Microsoft are following
their footsteps.
Triple Stores | Dr. Stephan Volmer
Slide 21 of 34
© Zühlke 2013
22. SPARQL
Ariadne's thread to the rescue!
User Interface & Applications
Trust
Proof
Logic
Rules
Taxonomies
Data Interchange
Cryptography
Ontologies
Syntax
Identifiers
Triple Stores | Dr. Stephan Volmer
Character Set
Slide 22 of 34
© Zühlke 2013
23. SPARQL
The Babel fish is probably the oddest thing in the universe.
• SPARQL
is pronounced “sparkle”
• SPARQL
is a recursive acronym for
SPARQL Protocol and RDF Query Language
• SPARQL
became an offical W3C recommendation
• SPARQL
allows for a query to consist of
in 2008
–
–
–
–
triple patterns,
conjunctions,
disjunctions, and
optional patterns
Triple Stores | Dr. Stephan Volmer
Slide 23 of 34
© Zühlke 2013
24. SPARQL
A scientific dialect is perfected when its terms are hard to
understand.
• Returns
all triples in a store
select * where {
?a ?b ?c
}
• Returns
all persons
select ?a where {
?a rdf:type ont:person
}
Triple Stores | Dr. Stephan Volmer
Slide 24 of 34
© Zühlke 2013
25. SPARQL
A scientific dialect is perfected when its terms are hard to
understand.
• Returns
all persons with an age sorted by age
select ?a ?age where {
?a rdf:type ont:person .
?a ont:age ?age
}
order by ?age
• Returns
all persons over 18
select ?a where {
?a rdf:type ont:person .
?a ont:age ?age .
filter (?age > 18)
}
Triple Stores | Dr. Stephan Volmer
Slide 25 of 34
© Zühlke 2013
26. SPARQL
Finally, bringing matters to the head…
• Change
all Bills to Williams
FOAF Vocabulary Specification 0.98
prefix:foaf
<http://xmlns.com/foaf/0.1/>
delete {
?person foaf:givenName ‚Bill‛
}
insert {
?person foaf:givenName ‚William‛
}
where {
?person foaf:givenName ‚Bill‛
}
Triple Stores | Dr. Stephan Volmer
Slide 26 of 34
© Zühlke 2013
27. SPARQL
Finally, bringing matters to the head…
• Delete
old book records
Dublin Core Metadata Initiative
prefix:dcmi
prefix:xsd
<http://purl.org/dc/elements/1.1/>
<http://www.w3.org/2001/XMLSchema#>
delete {
?book ?p ?v
}
where {
?book dcmi:date ?date .
filter ( ?date < ‚1970-01-01T00:00-02:00‛^^xsd:dateTime )
?book ?p ?v
}
Triple Stores | Dr. Stephan Volmer
Slide 27 of 34
© Zühlke 2013
28. Triple Stores
A home for homeless triples.
• Persistent
• Core
data store for the RDF model
data structures are triples and graphs
• Triple
stores are usually transactional
• Several
standards for triple stores are proposed
– RDF
– RDFS
– SPARQL
• Standardization
is critical
Standardization is what made SQL popular
Triple Stores | Dr. Stephan Volmer
Slide 28 of 34
© Zühlke 2013
29. Triple Stores
Triple stores fall into three broad categories!
In-Memory
Stores
Transient storage of triples in memory
Native
Stores
Persistent storage of triples in native stores
with their own storage implementation
Non-Native
Stores
Persistent storage of triples on top of thirdparty databases
Triple Stores | Dr. Stephan Volmer
Slide 29 of 34
© Zühlke 2013
30. Triple Stores
Architecture should speak of its time and place…
Triple Store Operations
SPARQL Protocol
• Insert/delete
• Batch
REST Interface
API
insert/delete
• Export
graph
• SPARQL
update
Transaction
Processor
query
• SPARQL
SPARQL
Processor
Triple Stores | Dr. Stephan Volmer
Triple Store
Slide 30 of 34
© Zühlke 2013
32. Conclusions
Do triple stores offer an advantage over relational
databases?
• No
need to create schemas
• No
need to link tables because you can have one
to many relationships directly
• Can
create new predicates (columns) on the fly
• Can
run queries off of this data just like in a
relational database model
Triple Stores | Dr. Stephan Volmer
Slide 32 of 34
© Zühlke 2013
33. Conclusions
Will triple stores eventually replace relational databases?
• Triple
stores offer more flexibility
• More
powerful and complex queries can be written
• In
the short term relational databases and triple
stores will live side by side
• Many
companies are already using triple stores on
top of their existing relational databases
Triple Stores | Dr. Stephan Volmer
Slide 33 of 34
© Zühlke 2013
Editor's Notes Properties are first class citizens. Properties are first class citizens.