chickadee » arcadedb

arcadedb

arcadedb is a CHICKEN Scheme egg module providing a driver or REPL for the ArcadeDB database.

About ArcadeDB

ArcadeDB is a multi-model NoSQL database providing graph and document models, while supporting a wide range of data query languages, such as:

as well as providing a HTTP/JSON/REST API.

SQL

The native query language of ArcadeDB is a dialect of SQL, closely related to OrientDB's OSQL, which supports the SQL command categories:

for the remaining categories holds:

About arcadedb

The arcadedb module implements a driver and console for ArcadeDB in CHICKEN Scheme with the functionality:

Runtime Dependencies

Naturally, arcadedb requires a running remote or local ArcadeDB server:

which in turn requires a Java distribution, i.e. OpenJDK 11. A local server setup is described below. Furthermore, the arcadedb module requires curl for the HTTP requests:

during runtime, and imports the uri-common egg to url-encode strings, as well as the medea egg to decode JSON:

Local Server Setup

A local ArcadeDB server can be set up via install or container.

Install

  1. Download package: ArcadeDB package
  2. Extract package: tar -xf arcadedb-latest.tar.gz
  3. Start server: ARCADEDB_HOME=/path/to/arcadedb/ bin/server.sh -Darcadedb.server.rootPassword=mypassword &
  4. Exit server: kill `cat bin/arcade.pid`

Container

  1. Install Docker
  2. Download container: docker pull arcadedata/arcadedb
  3. Start container: docker run --rm -d -p 2480:2480 -e JAVA_OPTS="-Darcadedb.server.rootPassword=mypassword --name arcadedb0 arcadedata/arcadedb
  4. Stop container: docker stop arcadedb0

Procedures

Help Message

a-help

a-helpprocedure

Returns void, prints help about using the arcadedb module.

Server Connection

a-connect

a-connect user pass host #!rest portprocedure

Returns alist with single entry if connection to server using strings user, pass, host, and optionally number port was successful; returns #f if a server error occurs or no response is received.

Server Information

a-status

a-statusprocedure

Returns list holding the cluster configuration of the server; returns empty list '() if no replicas are configured; returns #f if a server error occurs or no response is received.

a-healthy?

a-healthy?procedure

Returns boolean answering if server is ready.

a-list

a-listprocedure

Returns list of symbols holding available databases of the server; returns #f if a server error occurs or no response is received.

a-version

a-versionprocedure

Returns string version number of the server; returns #f if a server error occurs or no response is received.

Database Management

a-exist?

a-exist? dbprocedure

Returns boolean answering if database symbol db exists of the server.

a-create

a-create dbprocedure

Returns boolean that is true if creating new database symbol db on the server was successful; returns #f if a server error occurs or no response is received.

a-open?

a-open? dbprocedure

Returns boolean answering if database symbol db is open on the server.

a-open

a-open dbprocedure

Returns boolean that is true if opening database symbol db on the server was successful; returns #f if a server error occurs or no response is received.

a-close

a-close dbprocedure

Returns boolean that is true if closing database symbol db on the server was successful; returns #f if a server error occurs or no response is received.

a-drop

a-drop dbprocedure

Returns boolean that is true if deleting database symbol db on the server was successful; returns #f if a server error occurs or no response is received.

Database Interaction

a-query

a-query db lang queryprocedure

Returns list holding the result of string query in language symbol lang` of database symbol db; returns #f if a server error occurs or no response is received.

a-command

a-command db lang cmdprocedure

Returns list holding the result of string cmd in language symbol lang to database symbol db; returns #f if a server error occurs or no response is received.

a-script

a-script db pathprocedure

Returns list holding the result of the last statement of SQL script in string path to database symbol db; returns #f if a server error occurs or no response is received.

A SQL script file has to have the file extension .sql.

Database Macros

a-import

a-import db urlprocedure

boolean that is true if importing from string url into database symbol db on the server was successful; returns #f if a server error occurs or no response is received.

This function can be a minimalistic ETL (Extract-Transform-Load) tool: If one needs to import data from another database with a HTTP API and the query can be encoded (as for ArcadeDB) in the URL, the extraction and transformation is performed in the remote query, while the loading corresponds to the import of the query result. The supported formats are OrientDB, Neo4J, GraphML, GraphSON, XML, CSV, JSON, RDF.

a-describe

a-describe dbprocedure

Returns alist of type descriptions for database symbol db; returns #f if a server error occurs or no response is received.

This function emulates the SQL DESCRIBE statement.

a-load

a-load db path typeprocedure

Returns boolean that is true if loading JSON file at string path into database symbol db as symbol type on the server was successful; returns #f if a server error occurs or no response is received.

a-backup

a-backup dbprocedure

Returns boolean that is true if backing-up database symbol db on the server was successful.

a-check

a-check dbprocedure
a-check db fix?procedure

Returns list-of-alists integrity check report, attempts to fix if true boolean fix? is passed. returns #f if a server error occurs or no response is received.

a-comment

a-comment dbprocedure
a-comment db msgprocedure

Returns string current database comment of database symbol db, if msg is not passed; returns #t if string msg was set as comment for database symbol db on the server successfully; returns #f if no comment is set, a server error occurs or no response is received.

This function emulates the SQL COMMENT ON DATABASE statement, by creating a type D and upserting or reading the first comment property.

Changelog

License

Copyright (c) 2022 Christian Himpe under zlib-acknowledgement license.

Contents »