You are looking at historical revision 42523 of this page. It may differ significantly from its current revision.

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 the models:

while supporting a range of data query languages, such as:

as well as providing a JSON / REST-like / HTTP 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 in version 11, i.e. OpenJDK. 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

[procedure] (a-help)

Returns void, prints help about using the arcadedb module.

Server Connection

a-server

[procedure] (a-server user pass host . port)

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

Server Information

a-ready?

[procedure] (a-ready?)

Returns boolean answering if server is ready.

a-version

[procedure] (a-version)

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

Server Databases

a-list

[procedure] (a-list)

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

a-exist?

[procedure] (a-exist? db)

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

Database Management

a-new

[procedure] (a-new db)

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

This command can only be executed by the root or admin user.

a-delete

[procedure] (a-delete db)

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

This command can only be executed by the root or admin user.

Database Connection

a-use

[procedure] (a-use db)

Returns boolean that is true if database symbol db is connected; returns #f if a server error occurs or no response is received.

a-using

[procedure] (a-using)

Returns symbol naming current database; returns #f if no database is connected.

Database Interaction

a-query

[procedure] (a-query db lang query)

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

Valid lang symbols are: sql, cypher, gremlin, graphql, mongo.

a-command

[procedure] (a-command db lang cmd)

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

Valid lang symbols are: sql, sqlscript, cypher, gremlin, graphql, mongo.

Database Macros

a-config

[procedure] (a-config)

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

a-schema

[procedure] (a-schema)

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

This function emulates the SQL DESCRIBE statement.

a-script

[procedure] (a-script path)

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

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

a-upload

[procedure] (a-upload path type)

Returns boolean that is true if uploading JSON file at string path into current database as symbol type succeded; returns #f if a server error occurs or no response is received.

A JSON script file has to have the file extension .json.

a-ingest

[procedure] (a-ingest url)

boolean that is true if importing from string url into current database succeded; 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-jaccard

[procedure] (a-jaccard type x y)

Returns flonum being the Jaccard similarity index, given a symbol type and two symbol arguments x and y.

a-backup

[procedure] (a-backup)

Returns boolean that is true if backing-up current database succeded.

a-stats

[procedure] (a-stats)

Returns list-of-alists reporting statistics on current database; returns #f if a server error occurs or no response is received.

a-health

[procedure] (a-health)

Returns list-of-alists reporting health of current database; returns #f if a server error occurs or no response is received.

a-repair

[procedure] (a-repair)

Returns boolean that is true if automatic repair succeeded.

a-metadata

[procedure] (a-metadata id key value)

Returns boolean that is true if adding custom attribute with symbol key and string value to type or property symbol id succeeded.

a-comment

[procedure] (a-comment)
[procedure] (a-comment msg)

Returns string current database comment of current database, if msg is not passed; returns #t if string msg was set as comment for current database succeded; 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 sys and upserting or reading the first comment property.

Changelog

License

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