SlideShare a Scribd company logo
ArangoDB & Ashikawa
                             Workshop

                              Frank Celler & Lucas Dohmen, triAGENS, Cologne
                                              RuPy 2012, Brno
                                                 2012-11-16




                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Agenda
                              Brief Introduction to ArangoDB

                              Installing ArangoDB

                              CRUD Operations for Documents

                              ArangoDB Query Language

                              Using the Ruby Driver Ashikawa

                              Build a small Ruby example

                                    www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
multi-model NoSQL database and application
                     server

                     Basically, it's a document store...

                     ...but also supports key / value access

                     ... and provides functionality to store and analyse
                     document relations, making it a graph database,
                     too

                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
arangod: the server, written in C++

                     arangosh: JavaScript shell

                     arangoimp: Import for JSON / CSV

                     Ashikawa: Ruby driver



                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Mac OS X

     brew install arangodb                                                                                     installs stable 1.0.4
     brew install --devel arangodb                                                                  installs development 1.1.beta2
     If this is your first install, automatically load on login with:
         mkdir -p ~/Library/LaunchAgents
         cp /usr/local/Cellar/arangodb/1.0.4/homebrew.mxcl.arangodb.plist ~/Library/LaunchAgents/
         launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.arangodb.plist

     If this is an upgrade and you already have the homebrew.mxcl.arangodb.plist loaded:
         launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.arangodb.plist
         cp /usr/local/Cellar/arangodb/1.0.4/homebrew.mxcl.arangodb.plist ~/Library/LaunchAgents/
         launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.arangodb.plist

     To start the ArangoDB server manually, run:
         /usr/local/sbin/arangod

     To start the ArangoDB shell, run:
         arangosh




                                          www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Download a Package
     Use http://www.arangodb.org/download to download a package for


                     Centos

                     Debian

                     Ubuntu

                     SuSE

                     Mint

                     Mac OS X


                                www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
From the Source
     ~> git clone -b 1.0 https://github.com/triAGENS/ArangoDB
     Cloning into 'ArangoDB'...

     ~> ./build.sh
     ....
     ########################################################
     arangod
     ########################################################

     bin/arangod:
          $Revision:          READLINE 0x0402.hex $
          $Revision:          V8 3.9.4 $
          $Revision:          BASICS 1.0.4 (c) triAGENS GmbH $
          $Revision:          BOOST 1.48.0 $
          $Revision:          BASICS-C 1.0.4 (c) triAGENS GmbH $
          $Revision:          NCURSES ncurses $
          $Revision:          REST 1.0.4 (c) triAGENS GmbH $
          $Revision:          OPENSSL OpenSSL 0.9.8r 8 Feb 2011 $
          $Revision:          LIBEV 4.11 $




                  see http://www.arangodb.org/manuals/current/Compiling.html for details


                                           www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Arango Shell
     ~> /usr/local/sbin/arangod &
     ~> /usr/local/bin/arangosh
                                                       _
       __ _ _ __ __ _ _ __   __ _ ___ ___| |__
      / _` | '__/ _` | '_  / _` |/ _ / __| '_ 
     | (_| | | | (_| | | | | (_| | (_) __  | | |
      __,_|_| __,_|_| |_|__, |___/|___/_| |_|
                            |___/

     Welcome to arangosh 1.0.4. Copyright (c) 2012 triAGENS GmbH.
     Using Google V8 3.9.24 JavaScript engine.
     Using READLINE 0x0402.hex.

     Connected to Arango DB 127.0.0.1:8529 Version 1.0.4

     ------------------------------------- Help -------------------------------------
     Predefined objects:
        arango:                                          ArangoConnection
        db:                                              ArangoDatabase
        edges:                                           ArangoEdges
     Example:
      > db._collections();                               list all collections
      > db.<coll_name>.all().toArray();                  list all documents
      > id = db.<coll_name>.save({ ... });               save a document
      > db.<coll_name>.remove(<_id>);                    delete a document
      > db.<coll_name>.document(<_id>);                  get a document
      > help                                             show help pages
      > exit




                                           www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
First Steps
     Create a collection (similar to a table)

     arangosh> db._create("cars");
     [ArangoCollection 2769319, "cars" (status loaded)]
     arangosh> db.cars.toArray();
     [ ]

     Create a document in that collection

     arangosh> db._create("cars");
     [ArangoCollection 2769319, "cars" (status loaded)]
     arangosh> db.cars.toArray();
     [ ]

     arangosh> db.cars.save({ manufacturer: "skoda", model: "superb", year: 2010 });
     { error : false, _id : "2769319/4407719", _rev : 4407719 }
     arangosh> db.cars.document("2769319/4407719");
     { year : 2010, manufacturer : "skoda", model : "superb", _id : "2769319/4407719", _rev : 4407719 }




                                                www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Web Interface
                                   start at http://localhost:8529/




                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Create Read Update Delete


     Create: octavia = db.cars.save({ model: “octavia“ });

     Read: db.cars.document(octavia._id);

     Update: db.cars.replace(octavia, { model: “fabia“ });

     Delete: db.cars.remove(octavia._id);




                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
List & Sub-Objects

     arangosh> r = db.cars.save({ model: "yeti",
       address: { city: "Cologne", street: "Trankgasse" },
       drivers: [ "fceller", "lucas" ]});

     arangosh> car = db.cars.document(r);
     {
       model : "yeti",
       address : {
          city : "Cologne",
          street : "Trankgasse"
        },
       drivers : [
          "fceller",
          "lucas"
       ],
       _id : "2769319/6504871",
       _rev : 6504871
     }




                               www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Import Data

     ~> curl "http:/ /www.arangodb.org/rupy2012/airports.csv" > airports.csv
     ~> head -2 airports.csv
     "id","ident","type","name","latitude_deg","longitude_deg","elevation_ft","continent",...
     6523,"00A","heliport","Total Rf Heliport",40.07080078125,-74.9336013793945,11,"NA",....

     ~> curl "http://www.arangodb.org/rupy2012/names_10000.json" > names_10000.json
     ~> head -2 names_10000.json
     {"name":{"first":"Caren","last":"Ferm"},"gender":"female","birthday":"1971-07-22","contact":{"address":{"street":"3
     Wyoming Cir","zip":"08053","city":"Marlton","state":"NJ"},"email":["caren.ferm@nosql-matters.org","ferm@nosql-
     matters.org","caren@nosql-matters.org"],"region":"856","phone":["856-5374929"]},"likes":
     ["boxing"],"memberSince":"2008-11-07"}
     {"name":{"first":"Jack","last":"Irias"},"gender":"male","birthday":"1967-02-20","contact":{"address":{"street":"7
     Santa fe Way","zip":"19885","city":"Wilmington","state":"DE"},"email":["jack.irias@nosql-matters.org","irias@nosql-
     matters.org","jack@nosql-matters.org"],"region":"302","phone":[]},"likes":
     ["snowboarding"],"memberSince":"2009-04-27"}




                                   www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Import Data

     ~> /usr/local/bin/arangoimp --type json --collection users --create-collection true names_10000.json
     Connected to Arango DB 127.0.0.1:8529 Version 1.0.4
     ----------------------------------------
     collection           : users
     create               : yes
     reusing ids          : no
     file                 : names_10000.json
     type                 : json
     quote                : "
     separator            : ,
     connect timeout : 5
     request timeout : 300
     ----------------------------------------
     Starting JSON import...

     created             : 10000
     errors              : 0
     total               : 10000




                                   www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Import Data

     ~> /usr/local/bin/arangoimp --type csv --collection airports --create-collection true airports.csv
     Connected to Arango DB 127.0.0.1:8529 Version 1.0.4
     ----------------------------------------
     collection           : airports
     create               : yes
     reusing ids          : no
     file                 : airports.csv
     type                 : csv
     quote                : "
     separator            : ,
     connect timeout : 5
     request timeout : 300
     ----------------------------------------
     Starting CSV import...

     created             : 43991
     errors              : 0
     total               : 43992




                                   www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Query Data
            Grep 5 users and return their names and ids
     FOR u IN users
         LIMIT 5
         RETURN u


     arangosh> a = db._createStatement(
       { query: "for u in users limit 5 return u" }).execute()
     [object ArangoQueryCursor]

     arangosh> a.next()
     { _id : "6570407/264716711", _rev : 264716711, gender : "male", birthday :
     "1964-01-09", memberSince : "2008-09-18", name : { last : "Geving", first :
     "Millard" }, contact : { region : "409", phone : ["409-0605391"], address : { zip :
     "75941", city : "Diboll", state : "TX", street : "18 Woodlawn Loop" }, email :
     ["millard.geving@nosql-matters.org", "geving@nosql-matters.org", "millard@nosql-
     matters.org"] }, likes : ["shopping", "skiing"] }




                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Query Data
                  Find out how many users live in each city



     FOR u IN users
       COLLECT city = u.contact.address.city INTO g
       LIMIT 0,20
       RETURN { "city" : city, "users" : length(g) }




                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Query Data
       Find the 5 regions in state CA with the most inhabitants



     FOR u IN users
       FILTER u.contact.address.state == "CA"
       COLLECT region = u.contact.region INTO group
       SORT LENGTH(group) DESC
       LIMIT 0, 5
       RETURN { "region" : region, "count" : LENGTH(group) }




                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Query Data
                        Find the other top 5 hobbies of male users that also like running



     FOR likes IN (
       FOR u IN users
         FILTER u.gender == "male" && "running" IN u.likes
         FOR value IN u.likes
           FILTER value != "running"
           RETURN value
     )
     COLLECT what = likes INTO group
     SORT LENGTH(group) DESC
     LIMIT 0, 5
     RETURN { "what" : what, "count" : LENGTH(group) }




                                   www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Query Data
                              Find the 10 nearest larger airports around Cologne




     FOR a IN NEAR(airports, 50.67, 6.9, 200, "distance")
       FILTER a.type == "large_airport"
       SORT a.distance ASC
       LIMIT 0, 10
       RETURN { "name" : a.name,
                "code" : a.iata_code,
                "country" : a.iso_country,
                "city" : a.municipality,
                "distance" : CONCAT(TO_STRING(CEIL(a.distance/1000)), ' km') }




                                  www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Indexes
                                        Create a Geo–Index



     arangosh> db.airports.ensureGeoIndex('latitude_deg', 'longitude_deg');
     {
         id : "716390823/3631628711",
         type : "geo2",
         constraint : false,
         fields : [
            "latitude_deg",
            "longitude_deg"
         ],
         isNewlyCreated : true,
         error : false,
         code : 201
       }




                              www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12
Thank You!

                 Stay in Touch:

                       Fork me on github

                       Google Group: ArangoDB

                       Twitter: @fceller & @arangodb

                       www.arangodb.org

                               www.arangodb.org (c) f.celler@triagens.de
Donnerstag, 15. November 12

More Related Content

What's hot

iOS: Web Services and XML parsing
iOS: Web Services and XML parsingiOS: Web Services and XML parsing
iOS: Web Services and XML parsing
Jussi Pohjolainen
 
(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf
Guido Schmutz
 

What's hot (20)

Polyglot Persistence
Polyglot PersistencePolyglot Persistence
Polyglot Persistence
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 
Introduction to couchdb
Introduction to couchdbIntroduction to couchdb
Introduction to couchdb
 
CouchDB introduction
CouchDB introductionCouchDB introduction
CouchDB introduction
 
OrientDB the database for the web 1.1
OrientDB the database for the web 1.1OrientDB the database for the web 1.1
OrientDB the database for the web 1.1
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchApps
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 
Connecting to a REST API in iOS
Connecting to a REST API in iOSConnecting to a REST API in iOS
Connecting to a REST API in iOS
 
Heuritech: Apache Spark REX
Heuritech: Apache Spark REXHeuritech: Apache Spark REX
Heuritech: Apache Spark REX
 
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj TalkSpark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
 
Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application Benchx: An XQuery benchmarking web application
Benchx: An XQuery benchmarking web application
 
Intro To Couch Db
Intro To Couch DbIntro To Couch Db
Intro To Couch Db
 
iOS: Web Services and XML parsing
iOS: Web Services and XML parsingiOS: Web Services and XML parsing
iOS: Web Services and XML parsing
 
Couch db
Couch dbCouch db
Couch db
 
N hidden gems in hippo forge and experience plugins (dec17)
N hidden gems in hippo forge and experience plugins (dec17)N hidden gems in hippo forge and experience plugins (dec17)
N hidden gems in hippo forge and experience plugins (dec17)
 
(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf
 
DataFrame: Spark's new abstraction for data science by Reynold Xin of Databricks
DataFrame: Spark's new abstraction for data science by Reynold Xin of DatabricksDataFrame: Spark's new abstraction for data science by Reynold Xin of Databricks
DataFrame: Spark's new abstraction for data science by Reynold Xin of Databricks
 
RethinkDB - the open-source database for the realtime web
RethinkDB - the open-source database for the realtime webRethinkDB - the open-source database for the realtime web
RethinkDB - the open-source database for the realtime web
 
Using Webservice in iOS
Using Webservice  in iOS Using Webservice  in iOS
Using Webservice in iOS
 
Avro introduction
Avro introductionAvro introduction
Avro introduction
 

Similar to Rupy2012 ArangoDB Workshop Part1

Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
Kar Juan
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
diego_k
 

Similar to Rupy2012 ArangoDB Workshop Part1 (20)

RR & Docker @ MuensteR Meetup (Sep 2017)
RR & Docker @ MuensteR Meetup (Sep 2017)RR & Docker @ MuensteR Meetup (Sep 2017)
RR & Docker @ MuensteR Meetup (Sep 2017)
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
 
Getting started with Perl XS and Inline::C
Getting started with Perl XS and Inline::CGetting started with Perl XS and Inline::C
Getting started with Perl XS and Inline::C
 
Container (Docker) Orchestration Tools
Container (Docker) Orchestration ToolsContainer (Docker) Orchestration Tools
Container (Docker) Orchestration Tools
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipeline
 
Paris container day june17
Paris container day   june17Paris container day   june17
Paris container day june17
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Sprockets
SprocketsSprockets
Sprockets
 
Apache Spark Workshop
Apache Spark WorkshopApache Spark Workshop
Apache Spark Workshop
 
TIAD 2016 : Migrating 100% of your production services to containers
TIAD 2016 : Migrating 100% of your production services to containersTIAD 2016 : Migrating 100% of your production services to containers
TIAD 2016 : Migrating 100% of your production services to containers
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
Architecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based DeploymentsArchitecting .NET Applications for Docker and Container Based Deployments
Architecting .NET Applications for Docker and Container Based Deployments
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku Secrets
 
Book
BookBook
Book
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 

More from ArangoDB Database

More from ArangoDB Database (20)

ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
 
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
 
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
 
ArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at ScaleArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at Scale
 
GraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDBGraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDB
 
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
 
Graph Analytics with ArangoDB
Graph Analytics with ArangoDBGraph Analytics with ArangoDB
Graph Analytics with ArangoDB
 
Getting Started with ArangoDB Oasis
Getting Started with ArangoDB OasisGetting Started with ArangoDB Oasis
Getting Started with ArangoDB Oasis
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBCustom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDB
 
Hacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge GraphsHacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge Graphs
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
 
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning MetadataArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
 
ArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at ScaleArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at Scale
 
Webinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB OasisWebinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB Oasis
 
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
 
3.5 webinar
3.5 webinar 3.5 webinar
3.5 webinar
 
Webinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDBWebinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDB
 
An introduction to multi-model databases
An introduction to multi-model databasesAn introduction to multi-model databases
An introduction to multi-model databases
 
Running complex data queries in a distributed system
Running complex data queries in a distributed systemRunning complex data queries in a distributed system
Running complex data queries in a distributed system
 
Guacamole Fiesta: What do avocados and databases have in common?
Guacamole Fiesta: What do avocados and databases have in common?Guacamole Fiesta: What do avocados and databases have in common?
Guacamole Fiesta: What do avocados and databases have in common?
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 

Rupy2012 ArangoDB Workshop Part1

  • 1. ArangoDB & Ashikawa Workshop Frank Celler & Lucas Dohmen, triAGENS, Cologne RuPy 2012, Brno 2012-11-16 www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 2. Agenda Brief Introduction to ArangoDB Installing ArangoDB CRUD Operations for Documents ArangoDB Query Language Using the Ruby Driver Ashikawa Build a small Ruby example www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 3. multi-model NoSQL database and application server Basically, it's a document store... ...but also supports key / value access ... and provides functionality to store and analyse document relations, making it a graph database, too www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 4. arangod: the server, written in C++ arangosh: JavaScript shell arangoimp: Import for JSON / CSV Ashikawa: Ruby driver www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 5. Mac OS X brew install arangodb installs stable 1.0.4 brew install --devel arangodb installs development 1.1.beta2 If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/arangodb/1.0.4/homebrew.mxcl.arangodb.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.arangodb.plist If this is an upgrade and you already have the homebrew.mxcl.arangodb.plist loaded: launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.arangodb.plist cp /usr/local/Cellar/arangodb/1.0.4/homebrew.mxcl.arangodb.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.arangodb.plist To start the ArangoDB server manually, run: /usr/local/sbin/arangod To start the ArangoDB shell, run: arangosh www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 6. Download a Package Use http://www.arangodb.org/download to download a package for Centos Debian Ubuntu SuSE Mint Mac OS X www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 7. From the Source ~> git clone -b 1.0 https://github.com/triAGENS/ArangoDB Cloning into 'ArangoDB'... ~> ./build.sh .... ######################################################## arangod ######################################################## bin/arangod: $Revision: READLINE 0x0402.hex $ $Revision: V8 3.9.4 $ $Revision: BASICS 1.0.4 (c) triAGENS GmbH $ $Revision: BOOST 1.48.0 $ $Revision: BASICS-C 1.0.4 (c) triAGENS GmbH $ $Revision: NCURSES ncurses $ $Revision: REST 1.0.4 (c) triAGENS GmbH $ $Revision: OPENSSL OpenSSL 0.9.8r 8 Feb 2011 $ $Revision: LIBEV 4.11 $ see http://www.arangodb.org/manuals/current/Compiling.html for details www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 8. Arango Shell ~> /usr/local/sbin/arangod & ~> /usr/local/bin/arangosh _ __ _ _ __ __ _ _ __ __ _ ___ ___| |__ / _` | '__/ _` | '_ / _` |/ _ / __| '_ | (_| | | | (_| | | | | (_| | (_) __ | | | __,_|_| __,_|_| |_|__, |___/|___/_| |_| |___/ Welcome to arangosh 1.0.4. Copyright (c) 2012 triAGENS GmbH. Using Google V8 3.9.24 JavaScript engine. Using READLINE 0x0402.hex. Connected to Arango DB 127.0.0.1:8529 Version 1.0.4 ------------------------------------- Help ------------------------------------- Predefined objects: arango: ArangoConnection db: ArangoDatabase edges: ArangoEdges Example: > db._collections(); list all collections > db.<coll_name>.all().toArray(); list all documents > id = db.<coll_name>.save({ ... }); save a document > db.<coll_name>.remove(<_id>); delete a document > db.<coll_name>.document(<_id>); get a document > help show help pages > exit www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 9. First Steps Create a collection (similar to a table) arangosh> db._create("cars"); [ArangoCollection 2769319, "cars" (status loaded)] arangosh> db.cars.toArray(); [ ] Create a document in that collection arangosh> db._create("cars"); [ArangoCollection 2769319, "cars" (status loaded)] arangosh> db.cars.toArray(); [ ] arangosh> db.cars.save({ manufacturer: "skoda", model: "superb", year: 2010 }); { error : false, _id : "2769319/4407719", _rev : 4407719 } arangosh> db.cars.document("2769319/4407719"); { year : 2010, manufacturer : "skoda", model : "superb", _id : "2769319/4407719", _rev : 4407719 } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 10. Web Interface start at http://localhost:8529/ www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 11. Create Read Update Delete Create: octavia = db.cars.save({ model: “octavia“ }); Read: db.cars.document(octavia._id); Update: db.cars.replace(octavia, { model: “fabia“ }); Delete: db.cars.remove(octavia._id); www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 12. List & Sub-Objects arangosh> r = db.cars.save({ model: "yeti", address: { city: "Cologne", street: "Trankgasse" }, drivers: [ "fceller", "lucas" ]}); arangosh> car = db.cars.document(r); { model : "yeti", address : { city : "Cologne", street : "Trankgasse" }, drivers : [ "fceller", "lucas" ], _id : "2769319/6504871", _rev : 6504871 } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 13. Import Data ~> curl "http:/ /www.arangodb.org/rupy2012/airports.csv" > airports.csv ~> head -2 airports.csv "id","ident","type","name","latitude_deg","longitude_deg","elevation_ft","continent",... 6523,"00A","heliport","Total Rf Heliport",40.07080078125,-74.9336013793945,11,"NA",.... ~> curl "http://www.arangodb.org/rupy2012/names_10000.json" > names_10000.json ~> head -2 names_10000.json {"name":{"first":"Caren","last":"Ferm"},"gender":"female","birthday":"1971-07-22","contact":{"address":{"street":"3 Wyoming Cir","zip":"08053","city":"Marlton","state":"NJ"},"email":["caren.ferm@nosql-matters.org","ferm@nosql- matters.org","caren@nosql-matters.org"],"region":"856","phone":["856-5374929"]},"likes": ["boxing"],"memberSince":"2008-11-07"} {"name":{"first":"Jack","last":"Irias"},"gender":"male","birthday":"1967-02-20","contact":{"address":{"street":"7 Santa fe Way","zip":"19885","city":"Wilmington","state":"DE"},"email":["jack.irias@nosql-matters.org","irias@nosql- matters.org","jack@nosql-matters.org"],"region":"302","phone":[]},"likes": ["snowboarding"],"memberSince":"2009-04-27"} www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 14. Import Data ~> /usr/local/bin/arangoimp --type json --collection users --create-collection true names_10000.json Connected to Arango DB 127.0.0.1:8529 Version 1.0.4 ---------------------------------------- collection : users create : yes reusing ids : no file : names_10000.json type : json quote : " separator : , connect timeout : 5 request timeout : 300 ---------------------------------------- Starting JSON import... created : 10000 errors : 0 total : 10000 www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 15. Import Data ~> /usr/local/bin/arangoimp --type csv --collection airports --create-collection true airports.csv Connected to Arango DB 127.0.0.1:8529 Version 1.0.4 ---------------------------------------- collection : airports create : yes reusing ids : no file : airports.csv type : csv quote : " separator : , connect timeout : 5 request timeout : 300 ---------------------------------------- Starting CSV import... created : 43991 errors : 0 total : 43992 www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 16. Query Data Grep 5 users and return their names and ids FOR u IN users LIMIT 5 RETURN u arangosh> a = db._createStatement( { query: "for u in users limit 5 return u" }).execute() [object ArangoQueryCursor] arangosh> a.next() { _id : "6570407/264716711", _rev : 264716711, gender : "male", birthday : "1964-01-09", memberSince : "2008-09-18", name : { last : "Geving", first : "Millard" }, contact : { region : "409", phone : ["409-0605391"], address : { zip : "75941", city : "Diboll", state : "TX", street : "18 Woodlawn Loop" }, email : ["millard.geving@nosql-matters.org", "geving@nosql-matters.org", "millard@nosql- matters.org"] }, likes : ["shopping", "skiing"] } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 17. Query Data Find out how many users live in each city FOR u IN users COLLECT city = u.contact.address.city INTO g LIMIT 0,20 RETURN { "city" : city, "users" : length(g) } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 18. Query Data Find the 5 regions in state CA with the most inhabitants FOR u IN users FILTER u.contact.address.state == "CA" COLLECT region = u.contact.region INTO group SORT LENGTH(group) DESC LIMIT 0, 5 RETURN { "region" : region, "count" : LENGTH(group) } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 19. Query Data Find the other top 5 hobbies of male users that also like running FOR likes IN ( FOR u IN users FILTER u.gender == "male" && "running" IN u.likes FOR value IN u.likes FILTER value != "running" RETURN value ) COLLECT what = likes INTO group SORT LENGTH(group) DESC LIMIT 0, 5 RETURN { "what" : what, "count" : LENGTH(group) } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 20. Query Data Find the 10 nearest larger airports around Cologne FOR a IN NEAR(airports, 50.67, 6.9, 200, "distance") FILTER a.type == "large_airport" SORT a.distance ASC LIMIT 0, 10 RETURN { "name" : a.name, "code" : a.iata_code, "country" : a.iso_country, "city" : a.municipality, "distance" : CONCAT(TO_STRING(CEIL(a.distance/1000)), ' km') } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 21. Indexes Create a Geo–Index arangosh> db.airports.ensureGeoIndex('latitude_deg', 'longitude_deg'); { id : "716390823/3631628711", type : "geo2", constraint : false, fields : [ "latitude_deg", "longitude_deg" ], isNewlyCreated : true, error : false, code : 201 } www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12
  • 22. Thank You! Stay in Touch: Fork me on github Google Group: ArangoDB Twitter: @fceller & @arangodb www.arangodb.org www.arangodb.org (c) f.celler@triagens.de Donnerstag, 15. November 12