Learn OrientDB

  • WatchOrientDB Tutorial 1 of 5: Getting Started
  • WatchOrientDB Tutorial 2 of 5: Querying Grateful Dead
  • WatchOrientDB Tutorial 3 of 5: Create a Schema in OrientDB
  • WatchOrientDB Tutorial 4 of 5: Populate the Database
  • WatchOrientDB Tutorial 5 of 5: Use of the Articles DB

a look at OrientDB: The graph-document NoSQL

in this put up, i’m going to provide you with a quick introduction to a OrientDB. In after posts in this series, i will steal you through the use of OrientDB with bittersweet.

you have doubtless heard of document databases, like MongoDB, and you may accept heard of blueprint databases, like Neo4j. i’m inclined to guess you have not heard of very abounding, if any, blueprint-document databases.

That’s appropriate. OrientDB touts itself as “The graph-doc NoSQL.” From the web page:

OrientDB is an start supply GraphDB with a mixture of aspects taken from document Databases and object orientation.

complete unique? Or loopy? Or both?

We discovered OrientDB after activity fairly a ways down the direction with Neo4j1, best to discover that Neo4j’s pricing for its “business” features specifically, HA turned into beyond our startup-constrained reach. OrientDB’s has an Apache2 authorization which is greater acquiescent than Neo4j’s.2

i really like the GraphDB ideas, akin to directed acreage relationships as neatly because the flexibility that comes with the blueprint method. if you’re unusual with graph database concepts, check out these two posts one and two by means of Thiago Jackiw.

in order for you a album on doc databases, check out this post from 10gen.

In essence, OrientDB holds the promise of a versatile schema from its document DB roots, along with relationships as first-class citizens, like a blueprint database. a good illustration of both worlds is how OrientDB helps embedded and Referenced Relationships. the former are contained internal the checklist and only accessible by the use of that container. Referenced relationships are like edges from the graph DB apple, accessible as aboriginal-class objects with a inaugurate vertex, conclusion acme, and homes.

acclimatize has some outstanding claims, akin to greater than a hundred and fifty,000 insertssecond and already has a billow service at the back of it in Nuvolabase. really, Nuvolabase presents a audience of the “studio” app that incorporates OrientDB, which that you may see here.

now not fabricated in america

if you looked on the Nuvolabase appraisement, you likely observed that it’s no longer in decent ol’ ‘Merican dollars. at present, it looks the significant majority of OrientDB shoppers are in Europe. additionally, the enterprise at the back of OrientDB, orient technologies, is in London. I best point out it as a result of 1 i am in the States, and a pair of I’ve not heard a good deal about OrientDB before I stumbled aloft it. apart from that, I don’t in reality see it as a controversy.

setting up

satisfactory heritage, let’s installation OrientDB and play with it. OrientDB is accounting in Java, so you should definitely be able to run it anyplace. It comes with a server, animate, and gremlin animate. Don’t be concerned about gremlin at the moment, I’ll discuss it after.

The purchasable types to down load are here. presently, i’d suggest the 1.5.0 reliable liberate. just click the massive green button on that web page to get a zipper of the liberate.

abstract that book to a directory, which I’ll assume is called orientdb. The directory structure of OrientDB is relatively normal:

I’ll only touch on the config, bin and databases directories these days.


There are several info in the config directory. We just need to run the “common” server, so initiate up the orientdb-server-config.xml book.

be aware XML? It remains XML and it still dominates Java configuration. regardless, there are agglomeration of settings in here so that you can analysis on your personal or I’ll publish about later, most likely. For now, scroll bottomward unless you see <clients> part.

This part defines you estimated it the users that can access the server. by way of default, OrientDB provides a “root” and “guest” person. i like so as to add my own user with a a good deal extra in your price range countersign, so think chargeless to add:

<user substances=”*” countersign,password” name.”person”>

The substances attribute controls what the person can do. a value of * makes that user omnipotent, so administer your self for that reason. There is a few documentation on the OrientDB wiki, nonetheless it doesn’t consider finished.

shop the config book and shut it.


The databases directory holds you estimated it once again the databases served by way of this server. Any databases in this listing are seen to the server without configuration. in the event you actualize a brand new database, a brand new binder may be created in this directory with the same identify as your database. We’ll do that in slightly.

This directory is, although, with ease the default listing for databases. you could add other accumulator sites by means of agreement.

OrientDB supports three accumulator “engines”: memory, local, and plocal. reminiscence is self-allegorical.

The local and plocal storage varieties employ the filesystem. local is the “historical method,” it seems, and is probably the most characteristic wealthy right now. Plocal is the “new means,” however is missing some big-time aspects, such as transactions. you could read extra right here.

OrientDB ships with a audience database called tinkerpop, which that you would be able to comedy with once we fan the flames of the server.

Bin: hearth it Up

The bin listing, as is so regularly the case, has the enjoyable stuff. specifically, it includes scripts to launch the a variety of types of servers and consoles. these days, we’ll just commence the boilerplate standalone server, using server.sh or server.bat if you’re on home windows.

be aware: I needed to chmod +x *.sh inside that directory, as all my carapace scripts had been no longer executable.

once you fire up the server, you’ll see anything like:

Ahhh…don’t you love ASCII paintings? I do. as long as you don’t see any error, everthing is ready to go. OrientDB comes with a handy web application where that you would be able to browse the database, create courses, statistics, indices, and many others. through default, it lives at

as soon as logged in, you should definitely

The flat app begins you off on the “action” tab within the “Database” section. This suggests the courses purchasable together with some other metadata. The crucial ones to word are V and E, which angle for vertex and part, respectively. These are the faulty courses of your blueprint database, and if you actualize a brand new type also knows as a “vertex category” or “facet category” it will accede from one of these classes.

The tinkerpop database doesn’t have any vertex subclasses, but it does have three part subclasses: followed_by,, sung_by, and written_by. The adumbration that they’re an area bracket is the ‘E’ price in the superclass column. vertex subclasses, as you doubtless guessed, have a ‘V’ in that cavalcade. Oh, and you may actualize subclasses of subclasses.

that you may suppose of classes plenty like classes in the article-oriented world. They define a “type of record.” As a brief demo, opt for the “V” class within the table and click on the “question” button. You’ll be taken to the query page, which appears like:

here which you could see the information and houses of the V class. Any aspect that begins with a ‘’ so, rid, edition, and category is a OrientDB equipment acreage, meaning all courses accept them. The rest are either user described or described as a part of a accord. the connection residences originate with in_ or out_, every protecting the ids of the side records advancing into or out of every vertex for each relationship classification.

Your first appear at the OrientDB can also be, smartly, disorienting. the connection homes and unusual ids like, “#11:0” can pick you appropriate out of your consolation zone. a brief chat about how the information is structured in OrientDB may additionally help.


As previously outlined, OrientDB breaks the facts into OO-like classes. These courses have inheritence and, within the graph apple, can be either a Vertex or an Edge bracket. every type has one or more clusters, which can be “a normal strategy to neighborhood records”. that you may neighborhood a class into clusters according to allegation.

as an instance, if you had an invoice classification, you may group the 2012 invoices into a Invoice2012 cluster and the 2013 invoices into a Invoice2013 array. You specify which array to make use of for a given checklist should you create that list. each type has as a minimum one absence physical cluster it is acclimated if none is specified on listing creation.

The element of clusters is to community records that you’ll are looking to query collectively. We haven’t achieved tons with them yet, however plan to make use of them substantially as we develop with OrientDB.

statistics are what you possibly can are expecting: an instance of a category. they are files in the doc DB feel, as well as nodes within the blueprint DB experience. statistics are living in a array and accept the action described by way of the type. classes, Clusters, and information are the bobcat’s share of OrientDB’s facts structure.

Relationships, as I’ve alluded to, are the “edges” of the property blueprint and are aboriginal-classification residents. they’ve course meaning, an “in” vertex and an “out” vertex and may accept residences. a great deal of a blueprint database’s velocity comes from the convenience of traversing the graph from vertex to part to acme, and many others. which is why graphs are the choice of best sociable networking websites. These styles of relationships are meant to evade the “be part of pain” of the average RDBMS, the place the burden of hundreds of thousands of joins trigger huge efficiency issues.

fidgeting with statistics

The bin directory additionally has a animate script both .sh or .bat, depending on your OS. open a new terminal and stir up the console.

OrientDB has an in depth console command record. these days, we’ll actualize a database, add a acme class, create some statistics, again question for that records.

create a Database
actualize database plocal:databasessitepoint-look at various person flow plocal blueprint

notice: I began my console.sh from the root of the OrientDB setting up, so the about course to my databases folder is reflected aloft. in case you begun the console from the bin dir, you’ll need to put in a relative or absolute course to get the database to be created within the right location.

note that the animate has fabricated this new database “existing.” This potential commands and queries may be run towards this database.

create a vertex class and vertex

Let’s actualize a “grownup” acme class and make two people.

create type person extends V
=> category created efficaciously. complete courses in database now: eleven

remember, a vertex type is just a bracket of acme.

Now, we are able to add a property .

actualize acreage person.identify string
=> acreage created effectively with identity=1

And now, create our enthusiasts.

create acme person set identify=’Joanie’
=> Created vertex ‘adult#eleven:0name:Joanie v0′ in 0.076000 secs.

create vertex grownup set name=’Joanie’
=> Created acme ‘person#eleven:1identify:Chachie v0’ in 0.001000 secs.
actualize an part type and area

creating our facetaccord is awfully akin to developing our acme category and vertices. however, you don’t should actualize an part classification if your relationship is not going to have any houses. We’ll keep it essential these days and simply mimic what we did with vertices.

create classification loves extends E
=> class created efficaciously. total courses in database now: 12

actualize part loves from #11:1 to #11:0
=> Created area ‘lovesin:#11:0,out:#11:1’ in 0.003000 secs.
choose from adult

# |RID |identify
0 |#eleven:0|Joanie
1 |#eleven:1|Chachie

select identify as field, out_loves.identify as loves from adult

# |RID |discipline|loves
0 |#-2:1|Joanie |null
1 |#-2:2|Chachie|Joanie

You’ll word that OrientDB has a really SQL-ish syntax, which is exceptional in the event you’re trying to abstract the entire new ideas

there is tons more which you can do, without doubt. This example serves to edge your whistle.


That’s as far as I are looking to go along with OrientDB these days. in the next submit, I’ll talk about the orientdb-jruby gem as well as a brand new gem codename: “oriented” we’re writing as part of our assignment. except again, discover the OrientDB animate and studio software and check out the Google community affiliated beneath.


1: Which is in fact, definitely amazing. really, if it weren’t for finances issues, I likely won’t have appeared past Neo4j.

2: To be glowing, Neo4j licenses their commercial and commercial enterprise offerings. for my part, you couldn’t really deploy a creation app with out their business features. OrientDB also prices for his or her “commercial enterprise” offering, as shown right here, nevertheless it doesn’t get rid of any of the elements that permit ascent. here’s now not a publish about Neo4j vs OrientDB, so that’s all I should say about that.

Glenn works for skookum digital Works by day and manages the SitePoint ruby channel at nighttime. He brand to fake he has a abstruse identity, but can not come up with a very good superhero name. he’s clearing for,Roob”, for now.

You may also like...