ArangoDB



  • ArangoDB Tutorial
  • ArangoDB Useful Resources

Files for arangodb, version 0.0.12; Filename, size File type Python version Upload date Hashes; Filename, size arangodb-0.0.12-py2.py3-none-any.whl (18.2 kB) File type Wheel Python version 2.7 Upload date Apr 18, 2015 Hashes View.

  1. ArangoDB is a free and open source, NoSQL and multi-model database that provides all the database features that are needed for a modern web application. ArangoDB does not use the traditional data storage system as in MySQL or PostgreSQL. It is specially designed for being high performance, open source and easily scalable.
  2. ArangoDB is the leading native multi-model database with over 9000 stargazers on.
  3. We are also on Slack - ArangoDB Community Slack channel, but Stackoverflow is the right place for questions. Important note: There are two types of posts: discussion and questions. For programming question, please check Stackoverflow first.
  4. ArangoDB - AQL Example Queries - In this chapter, we will consider a few AQL Example Queries on an Actors and Movies Database. These queries are based on graphs.
  • Selected Reading

In this chapter, we will consider a few AQL Example Queries on an Actors and Movies Database. These queries are based on graphs.

Problem

Given a collection of actors and a collection of movies, and an actIn edges collection (with a year property) to connect the vertex as indicated below − Dragon age alistair wedding mod.

[Actor] <- act in -> [Movie]

How do we get −

  • All actors who acted in 'movie1' OR 'movie2'?
  • All actors who acted in both 'movie1' AND 'movie2”?
  • All common movies between 'actor1' and 'actor2”?
  • All actors who acted in 3 or more movies?
  • All movies where exactly 6 actors acted in?
  • The number of actors by movie?
  • The number of movies by actor?
  • The number of movies acted in between 2005 and 2010 by actor?

Solution

During the process of solving and obtaining the answers to the above queries, we will use Arangosh to create the dataset and run queries on that. All the AQL queries are strings and can simply be copied over to your favorite driver instead of Arangosh.

Let us start by creating a Test Dataset in Arangosh. First, download this file −

Output

You can see in the output above that we have downloaded a JavaScript file dataset.js. This file contains the Arangosh commands to create the dataset in the database. Instead of copying and pasting the commands one by one, we will use the --javascript.execute option on Arangosh to execute the multiple commands non-interactively. Consider it the life saver command!

Now execute the following command on the shell −

Supply the password when prompted as you can see in the above screenshot. Now we have saved the data, so we will construct the AQL queries to answer the specific questions raised in the beginning of this chapter.

First Question

Let us take the first question: All actors who acted in 'movie1' OR 'movie2'. Suppose, we want to find the names of all the actors who acted in 'TheMatrix' OR 'TheDevilsAdvocate' −

We will start with one movie at a time to get the names of the actors −

Output

We will receive the following output −

Now we continue to form a UNION_DISTINCT of two NEIGHBORS queries which will be the solution −

Output

Second Question

Arangodb Open Source

Let us now consider the second question: All actors who acted in both 'movie1' AND 'movie2'. This is almost identical to the question above. But this time we are not interested in a UNION but in an INTERSECTION −

Pricing

Output

We will receive the following output −

Third Question

Let us now consider the third question: All common movies between 'actor1' and 'actor2'. This is actually identical to the question about common actors in movie1 and movie2. We just have to change the starting vertices. As an example, let us find all the movies where Hugo Weaving ('Hugo') and Keanu Reeves are co-starring −

Output

We will receive the following output −

Fourth Question

Let us now consider the fourth question. All actors who acted in 3 or more movies. This question is different; we cannot make use of the neighbors function here. Instead we will make use of the edge-index and the COLLECT statement of AQL for grouping. The basic idea is to group all edges by their startVertex (which in this dataset is always the actor). Then we remove all actors with less than 3 movies from the result as here we have included the number of movies an actor has acted in −

Output

For the remaining questions, we will discuss the query formation, and provide the queries only. The reader should run the query themselves on the Arangosh terminal.

Fifth Question

Let us now consider the fifth question: All movies where exactly 6 actors acted in. The same idea as in the query before, but with the equality filter. However, now we need the movie instead of the actor, so we return the _to attribute

The number of actors by movie?

We remember in our dataset _to on the edge corresponds to the movie, so we count howoften the same _to appears. This is the number of actors. The query is almost identical tothe ones before but without the FILTER after COLLECT

Sixth Question

Let us now consider the sixth question: The number of movies by an actor.

ArangoDB

Graph Databases Arangodb

The way we found solutions to our above queries will help you find the solution to this query as well.

Arangodb Pricing

The Benefits of Graph Computing

A graph is a structure composed of vertices and edges. Both vertices and edges can have an arbitrary number of key/value-pairs called properties. Vertices denote discrete objects such as a person, a place, or an event. Edges denote relationships between vertices. For instance, a person may know another person, have been involved in an event, and/or have recently been at a particular place. Properties express non-relational information about the vertices and edges. Example properties include a vertex having a name and an age, and an edge having a timestamp and/or a weight. Together, the aforementioned graph is known as a property graph and it is the foundational data structure of Apache TinkerPop.

Arangodb Pdf


If a user's domain is composed of a heterogeneous set of objects (vertices) that can be related to one another in a multitude of ways (edges), then a graph may be the right representation to use. In a graph, each vertex is seen as an atomic entity (not simply a 'row in a table') that can be linked to any other vertex or have properties added or removed at will. This empowers the data modeler to think in terms of actors within a world of complex relations as opposed to, in relational databases, statically-typed tables joined in aggregate. Once a domain is modeled, that model must then be exploited in order to yield novel, differentiating information. Graph computing has a rich history that includes not only query languages devoid of table-join semantics, but also algorithms that support complex reasoning: path analysis, vertex clustering and ranking, subgraph identification, and more. The world of applied graph computing offers a flexible, intuitive data structure along with a host of algorithms able to effectively leverage that structure.

ArangoDB

Arangodb Oasis

Apache TinkerPop™ is an open source, vendor-agnostic, graph computing framework distributed under the commercial friendly Apache2 license. When a data system is TinkerPop-enabled, its users are able to model their domain as a graph and analyze that graph using the Gremlin graph traversal language. Furthermore, all TinkerPop-enabled systems integrate with one another allowing them to easily expand their offerings as well as allowing users to choose the appropriate graph technology for their application. Sometimes an application is best served by an in-memory, transactional graph database. Sometimes a multi-machine distributed graph database will do the job. Or perhaps the application requires both a distributed graph database for real-time queries and, in parallel, a Big(Graph)Data processor for batch analytics. Whatever the application's requirements, there exists a TinkerPop-enabled graph system out there to meet its needs.