NoSQL and Triple Stores

6,098 views

Published on

Compare and contrast RDF triple stores and NoSQL: are triples stores NoSQL or not?

Talk given 2011-09-08 tot he BigData/NoSQL meetup at Bristol University.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,098
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
74
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

NoSQL and Triple Stores

  1. 1. NoSQL and Triple Stores Andy Seaborne
  2. 2. NoSQL From http://nosql-database.org/ <ul><li>Graph Databases </li></ul><ul><li>Key-Value stores
  3. 3. Column Stores
  4. 4. Document Stores </li></ul><ul><li>Triples Stores </li></ul>
  5. 5. NoSQL <ul><li>Non-relational
  6. 6. Distributed
  7. 7. Open-source
  8. 8. horizontally scalable
  9. 9. Schema-free
  10. 10. easy replication support
  11. 11. simple API
  12. 12. eventually consistent / BASE (not ACID)
  13. 13. a huge data amount </li></ul>From http://nosql-database.org/
  14. 14. Triple Stores <ul><li>Data Model: RDF </li><ul><li>Subject-predicate-object </li></ul><li>Don't store triples </li><ul><li>they store named sets of triples </li></ul><li>Schema-less </li><ul><li>“Dump and run” data management </li></ul><li>SPARQL </li><ul><li>Query Language
  15. 15. Protocol using HTTP </li></ul></ul>
  16. 16. RDF “ Ant in Action” title creator Author “ Steve Loughran” name “ 193239480X ” ISBN10 creator Author “ Erik Hatcher” name http://webbooks/b4598
  17. 17. RDF “ Ant in Action” title creator Author “ Steve Loughran” name “ 193239480X ” ISBN10 creator Author “ Erik Hatcher” name shop Stock item item $49.99 price ref http://webbooks/b4598
  18. 18. RDF “ Ant in Action” title creator Author “ Steve Loughran” name “ 193239480X ” ISBN10 creator Author “ Erik Hatcher” name shop Stock item “ good” item $49.99 price ref creator rating “ Andy Seaborne” http://review.org/review57 http://webbooks/b4598
  19. 19. Turtle @prefix : <http://example.org/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . :Andy a foaf:Person ; foaf:name &quot;Andy Seaborne&quot; ; foaf:mbox <mailto:andy@apache.org> ; foaf:knows :Paolo ; foaf:knows :Steve . :Paolo a foaf:Person ; foaf:name &quot;Paolo Castagna&quot; ; foaf:mbox <mailto:castagna@apache.org> . :Steve foaf:name &quot;Steve Loughran&quot; ; foaf:mbox_sha1 &quot;0678d36518d039a64ee4baba0a568afe535ce5f3&quot; .
  20. 20. RDF RDF is a graph Your computer thinks of this is as a logical table (but probably stores it differently) Subject Predicate Object
  21. 21. A SPARQL Query Looks Like … @prefix person: <http://example/person/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . person:A foaf:name &quot;Alice&quot; . person:A foaf:mbox <mailto:alice@example.net> . person:B foaf:name &quot;Bob&quot; . PREFIX person: <http://example/person/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?person foaf:mbox <mailto:alice@example.net> . ?person foaf:name ?name . } ----------- | name | =========== | &quot;Alice&quot; | -----------
  22. 22. A SPARQL Query Looks Like … @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix stock: <http://example.org/stock#> . stock:book1 dc:title &quot;SPARQL Query Language Tutorial&quot; . stock:book2 dc:title &quot;SPARQL Query Language (2nd ed)&quot; . stock:book3 dc:title &quot;Moving from SQL to SPARQL&quot; . stock:book4 dc:title &quot;Applying XQuery&quot; . PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX stock: <http://example.org/stock#> SELECT ?book ?title { ?book dc:title ?title . FILTER (regex(?title , &quot; SPARQL &quot; )) } -------------------------------------------------- | book | title | ================================================== | stock:book3 | &quot;Moving from SQL to SPARQL&quot; | | stock:book2 | &quot;SPARQL Query Language (2nd ed)&quot; | | stock:book1 | &quot;SPARQL Query Language Tutorial&quot; | --------------------------------------------------
  23. 23. SPARQL: All people who know 3 others PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name { { SELECT ?x (count(*) AS ?count) { ?x foaf:knows ?y . } GROUP BY ?x HAVING (?count = 3) } ?x foaf:name ?name . }
  24. 24. SPARQL Protocol GET /foo/sparql?query=SELECT (Count(*) AS ?c) { ?s ?p ?o } Accept: application/sparq-results+json GET /foo/sparql?query=SELECT%20%28Count%28%2A%29%20AS%20%3Fc%29%20{%20%3Fs%20%3Fp%20%3Fo%20} { &quot;head&quot;: { &quot;vars&quot;: [ &quot;c&quot; ] } , &quot;results&quot;: { &quot;bindings&quot;: [ { &quot;c&quot;: { &quot;datatype&quot;: &quot;http://www.w3.org/2001/XMLSchema#integer&quot; , &quot;type&quot;: &quot;typed-literal&quot; , &quot;value&quot;: &quot;10&quot; } } ] } }
  25. 25. SPARQL Graph Store Protocol <ul><li>Simple way to manage a store
  26. 26. GET, PUT, POST, DELETE
  27. 27. Naming </li><ul><li>Same server http://server/store/graph1
  28. 28. Different server http://server/store?graph=http://example/g1 http://server/store?graph=http%3A//example/g1 </li></ul></ul>
  29. 29. RESTful operation PUT /store?graph=http%3A//example/g1 HTTP/1.1 Host: server.com Content-type: application/rdf+xml <?xml version='1.0' encoding='UTF-8'?> <rdf:RDF xmlns:rdf='...'> ... </rdf:RDF>
  30. 30. Triples Store as NoSQL <ul><li>Mostly open source
  31. 31. Some distributed
  32. 32. API Not proprietary </li></ul><ul><li>Looks like SQL
  33. 33. Eventual consistency </li></ul><ul><ul><li>Huge amount of data? </li><ul><li>Garlik: 20 Billion triples (cluster, ~20 machines)
  34. 34. AllegroGraph: 1 Trillion (single, very large machine) </li></ul></ul></ul>

×