OrientDB Mathematica Package

OrientDB RESTful HTTP-JSON API in Mathematica

3 minute read

Overview

The main function of this Mathematica package, ODBapi, is built on top of the URLFetch built-in function. OrientDB RESTful HTTP API commands are ported into Wolfram Language through URLFetch and then ODBapi commands are built with arguments that specify options with rules of the form name -> value. This package has also other utility functions especially implemented for OrientDB. OrientDB Package is part of the DBAPI application project. Visit the official page of the project for installation and testing instructions.

Discussion

OrientDB is a multi-model, NoSQL, DBMS based on 16 years of research. Orient Technologies, the company that supports the product, has published more than 60 releases and there is constant and frequent adaptation to user demand and the latest technology available. OrientDB is Open Source and FREE for any purpose. Good news are that this OrientDB Mathematica Package is also Open Source and Free.

OrientDB is using an SQL-like programming language for managing data. We consider that this can be a turning point for innovation, adaptation, and extension of SQL language. Although SQL is widely used and familiar to many programmers, we argue that its use becomes complicated on graph data models. OrientDB SQL, i.e. OSQL, has been extended to cover operations on Graph Model, but with the cost of adding extra SQL commands. This level of detail can be hidden from the user, and a more abstracted language can be built to cover both the Graph Model and the underlying Document Model.

Moreover, normally SQL consists of a Data Definition Language, Data Manipulation Language and Data Control Language. In OrientDB there are 34 different commands divided into six categories. Four of them are related to the manipulation of data structure (Graph,Schema,Index,Database) and two of them concern operations (Create-Read-Update-Delete and Utility).

There is some analogy of OSQL with the ODBapi function of the OrientDB Package. We are overloading the function with multiple definitions that are derived from the use of optional and mandatory arguments. This differentation is based on the commands (Add, Del, Get, Update, Import/Export, Login/Logout) and the various data structures (Server, Database, Class-Vertex-Edge, Property, Record, Document, Value). See the documentation page below for more information.

We argue that this effort to transform the OrientDB SQL set of commands to a function with parameters is a good start for a uniform, universal treatment of data language (UDL). Most important in such a design are: the parameter for the basic operation (ADD, DEL, GET, UPD, LNK, IRT, LOG), and the parameter for the type of construct e.g. Database, Class, Property, Record, and Value.

With that guideline in mind, SELECT becomes GET, INSERT and CREATE become ADD, TRUNCATE AND DELETE become DEL, UPDATE and ALTER become UPD. The current OrientDB package needs more programming effort to reach the state we described. But we foresee that it will be far more intuitive, user-friendly and easy to program than its SQL ancestor.

Conclusion

Most of the functionality of OrientDB HTTP-JSON API is embedded in Mathematica. The user is able to work with OrientDB database in the native Wolfram Language environment. The DBAPI application project in general combines fundamental bult-in data structures, List, Rule, Association and Dataset of the Wolfram Language with the native JSON permanent storage, retrieval and manipulation mechanism of OrientDB database. The project is open source and free, therefore it can be downloaded from those interested in building Mathematica application projects and those interested in porting data from RESTful services and NoSQL databases into Mathematica.

Documentation Pages

For demonstration purposes, we have included here the following documentation pages in pdf format for the ODBapi and ODBgetFieldAttributes functions of the OrientDB Package

DBAPI Posts

2016

From Declarative to Functional Database Operations
SQL CRUD RESTful Transformations in Mathematica and OrientDB
A new alternative, functional way to program databases

2015

OrientDB Mathematica Package
OrientDB RESTful HTTP-JSON API in Mathematica
Extends Wolfram Language (Mathematica) by porting OrientDB RESTful API

AtomicDB Mathematica AddOn (ADBM)
Demo and Professional Versions in Wolfram Programming Language
The first add-on for AtomicDB that makes it fully compatible to work with Wolfram Language: