guacamole: an Object
Document Mapper for
ArangoDB
Max Neunhöffer
Ruby on Rails Meetup SF, 19 February 2015
www.arangodb.com
Document and Key/Value Stores
Document store
A document store stores a set of documents, which usually
means JSON data, th...
Graph Databases
Graph database
A graph database stores a labelled graph. Vertices and
edges are documents. Graphs are good...
The Multi-Model Approach
Multi-model database
A multi-model database combines a document store with a
graph database and a...
is a multi-model database (document store & graph database),
is open source and free (Apache 2 license),
offers convenient ...
guacamole
is an Object Document Mapper for Ruby and ArangoDB,
builds on the low-level Ruby driver ashikawa-core
implements...
Models . . .
Make a class into a model
class Pony
include Guacamole::Model
attribute :name, String
attribute :color, Strin...
. . . and Collections
Create a collection
Collections provide the link to the database
class PoniesCollection
include Guac...
Relations between objects — embedding
class Comment
include Guacamole::Model
attribute :text, String
end
class Post
includ...
Relations between objects — references
class Authorship
include Guacamole::Edge
from :users
to :posts
end
class PostsColle...
URLs
https://www.arangodb.com/
https://github.com/triAGENS/guacamole
https://github.com/triAGENS/ashikawa-core
10
Nächste SlideShare
Wird geladen in …5
×

guacamole: an Object Document Mapper for ArangoDB

1.043 Aufrufe

Veröffentlicht am

In this talk I will give a brief introduction and overview for guacamole, showing how easy it is to get started with using ArangoDB as the persistence layer for a Rails app. I will also explain the philosophy behind ArangoDB's "multi-model approach", but still show concrete code examples, and all of this in 15 minutes.

Veröffentlicht in: Technologie
0 Kommentare
0 Gefällt mir
Statistik
Notizen
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Keine Downloads
Aufrufe
Aufrufe insgesamt
1.043
Auf SlideShare
0
Aus Einbettungen
0
Anzahl an Einbettungen
3
Aktionen
Geteilt
0
Downloads
9
Kommentare
0
Gefällt mir
0
Einbettungen 0
Keine Einbettungen

Keine Notizen für die Folie

guacamole: an Object Document Mapper for ArangoDB

  1. 1. guacamole: an Object Document Mapper for ArangoDB Max Neunhöffer Ruby on Rails Meetup SF, 19 February 2015 www.arangodb.com
  2. 2. Document and Key/Value Stores Document store A document store stores a set of documents, which usually means JSON data, these sets are called collections. The database has access to the contents of the documents. each document in the collection has a unique key secondary indexes possible, leading to more powerful queries different documents in the same collection: structure can vary no schema is required for a collection database normalisation can be relaxed Key/value store Opaque values, only key lookup without secondary indexes: =⇒ high performance and perfect scalability 1
  3. 3. Graph Databases Graph database A graph database stores a labelled graph. Vertices and edges are documents. Graphs are good to model relations. graphs often describe data very naturally (e.g. the facebook friendship graph) graphs can be stored using tables, however, graph queries notoriously lead to expensive joins there are interesting and useful graph algorithms like “shortest path” or “neighbourhood” need a good query language to reap the benefits horizontal scalability is troublesome graph databases vary widely in scope and usage, no standard 2
  4. 4. The Multi-Model Approach Multi-model database A multi-model database combines a document store with a graph database and a key/value store. Vertices are documents in a vertex collection, edges are documents in an edge collection. a single, common query language for all three data models is able to compete with specialised products on their turf allows for polyglot persistence using a single database queries can mix the different data models can replace a RDMBS in many cases 3
  5. 5. is a multi-model database (document store & graph database), is open source and free (Apache 2 license), offers convenient queries (via HTTP/REST and AQL), including joins between different collections, configurable consistency guarantees using transactions is memory efficient by shape detection, uses JavaScript throughout (Google’s V8 built into server), API extensible by JS code in the Foxx Microservice Framework, offers many drivers for a wide range of languages, is easy to use with web front end and good documentation, and enjoys good community as well as professional support. 4
  6. 6. guacamole is an Object Document Mapper for Ruby and ArangoDB, builds on the low-level Ruby driver ashikawa-core implements the Data Mapper Pattern (and not ActiveRecord) offers Models and Collections allows embedding objects and allows object relations (by using graphs in ArangoDB) 5
  7. 7. Models . . . Make a class into a model class Pony include Guacamole::Model attribute :name, String attribute :color, String validates :color, presence: true end p = Pony.new p.color = :pink # => "pink" p.type = "Earthpony" # => ["Earthpony"] p = Pony.new p.valid? # => false p.errors[:color] # => ["can't be blank"] 6
  8. 8. . . . and Collections Create a collection Collections provide the link to the database class PoniesCollection include Guacamole::Collection end p = Pony.new(name: "Paul") PoniesCollection.save p # => #<Pony:0x124 ...> p.name = "Tom" PoniesCollection.save p ponies = PoniesCollection.by_example(color: 'green') .limit(10) # => #<Guacamole::Query:0x1212 ...> ponies.first # => #<Pony:0x90u81 ...> 7
  9. 9. Relations between objects — embedding class Comment include Guacamole::Model attribute :text, String end class Post include Guacamole::Model attribute :title, String attribute :body, String attribute :comments, Array[Comment] end class PostsCollection include Guacamole::Collection map do embeds :comments end end 8
  10. 10. Relations between objects — references class Authorship include Guacamole::Edge from :users to :posts end class PostsCollection include Guacamole::Collection map do attribute :author, via: Authorship end end 9
  11. 11. URLs https://www.arangodb.com/ https://github.com/triAGENS/guacamole https://github.com/triAGENS/ashikawa-core 10

×