gap> db := AttachAnArangoDatabase( ); [object ArangoDatabase "example"] gap> db._isSystem(); false gap> db._name(); "example" gap> db._drop( "test" ); true gap> coll := db._create( "test" ); [ArangoCollection "test"] gap> db.test; [ArangoCollection "test"] gap> coll.count(); 0 gap> db.test.count(); 0 gap> InsertIntoDatabase( rec( _key := "1", TP := "x-y" ), coll ); [ArangoDocument] gap> coll.count(); 1 gap> db._truncate( coll ); true gap> coll.count(); 0 gap> coll.save( rec( _key := "1", TP := "x-y" ) ); [ArangoDocument] gap> coll.count(); 1 gap> db._truncate( coll ); true gap> coll.count(); 0 gap> coll.save( rec( _key := "1", TP := "x-y" ) ); [ArangoDocument] gap> coll.save( rec( _key := "2", TP := "x*y" ) ); [ArangoDocument] gap> InsertIntoDatabase( rec( _key := "3", TP := "x+2*y" ), coll ); [ArangoDocument] gap> coll.count(); 3 gap> UpdateDatabase( "3", rec( TP := "x+y", a := 42, b := " a\nb " ), coll ); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> UpdateDatabase( "3", rec( c := rec( d := [ 1, "e" ] ) ), coll ); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> coll.ensureIndex(rec( type := "hash", fields := [ "TP" ] )); [ArangoDocument] gap> t := rec( query := "FOR e IN test SORT e._key RETURN e", count := true );; gap> t := db._createStatement( t ); [ArangoStatement in [object ArangoDatabase "example"]] gap> c := t.execute(); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> c.count(); 3 gap> a := c.toArray(); [ArangoArray of length 3] gap> Length( a ); 3 gap> Length( List( a ) ); 3 gap> a[1].TP; "x-y" gap> a[2].TP; "x*y" gap> a[3].TP; "x+y" gap> a[3].a; 42 gap> a[3].b; " a\nb " gap> IsBound( a[3].c ); true gap> a[3].c; rec( d := [ 1, "e" ] ) gap> c := t.execute(); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> i := Iterator( c ); <iterator> gap> d1 := NextIterator( i ); [ArangoDocument] gap> d1.TP; "x-y" gap> d2 := NextIterator( i ); [ArangoDocument] gap> d2.TP; "x*y" gap> d3 := NextIterator( i ); [ArangoDocument] gap> d3.TP; "x+y" gap> d3.a; 42 gap> d3.b; " a\nb " gap> IsBound( d3.c ); true gap> d3.c; rec( d := [ 1, "e" ] ) gap> r3 := DatabaseDocumentToRecord( d3 );; gap> IsRecord( r3 ); true gap> Set( NamesOfComponents( r3 ) ); [ "TP", "_id", "_key", "_rev", "a", "b", "c" ] gap> [ r3._id, r3._key, r3.TP, r3.a, r3.b, r3.c ]; [ "test/3", "3", "x+y", 42, " a\nb ", rec( d := [ 1, "e" ] ) ] gap> UpdateDatabase( "1", rec( TP := "x+y" ), coll ); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> q := QueryDatabase( rec( TP := "x+y" ), ["_key","TP","a","b","c"], coll ); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> a := q.toArray(); [ArangoArray of length 2] gap> Set( List( a, DatabaseDocumentToRecord ) ); [ rec( TP := "x+y", _key := "1", a := fail, b := fail, c := fail ), rec( TP := "x+y", _key := "3", a := 42, b := " a\nb ", c := rec( d := [ 1, "e" ] ) ) ] gap> RemoveFromDatabase( "2", coll ); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> coll.count(); 2 gap> db._exists( "test/1" ); true gap> IsRecord( coll.exists( "1" ) ); true gap> db._exists( "test/2" ); false gap> coll.exists( "2" ); false gap> db._exists( "test/3" ); true gap> db._document( "test/3" ); [ArangoDocument] gap> coll.document( "3" ); [ArangoDocument] gap> q := QueryDatabase( rec( TP := "x+y" ), coll ); [ArangoQueryCursor in [object ArangoDatabase "example"]] gap> q.count(); 2 gap> MarkFirstDocument( rec( TP := "x+y" ), rec( TP_lock := "me1" ), coll ); [ArangoDocument] gap> MarkFirstDocument( rec( TP := "x+y" ), rec( TP_lock := "me2" ), coll ); [ArangoDocument]
‣ HOMALG_IO_ArangoShell | ( global variable ) |
‣ InfoArangoDB | ( info class ) |
‣ IsArangoDatabase ( arg ) | ( filter ) |
Returns: true
or false
The GAP category of Arango databases.
‣ IsDatabaseCollection ( arg ) | ( filter ) |
Returns: true
or false
The GAP category of collections in a database.
‣ IsDatabaseStatement ( arg ) | ( filter ) |
Returns: true
or false
The GAP category of database statements.
‣ IsDatabaseCursor ( arg ) | ( filter ) |
Returns: true
or false
The GAP category of database cursors.
‣ IsDatabaseArray ( arg ) | ( filter ) |
Returns: true
or false
The GAP category of database arrays.
‣ IsDatabaseDocument ( arg ) | ( filter ) |
Returns: true
or false
The GAP category of documents in a database collecton.
‣ AttachAnArangoDatabase ( opts ) | ( function ) |
Returns: an Arango database
Attach an existing database by invoking arangosh
with an optional list of options opts which if not provided defaults to HOMALG_IO_ArangoShell.options
.
‣ InsertIntoDatabase ( keys_values_rec, collection ) | ( operation ) |
‣ InsertIntoDatabase ( keys_values_rec, collection ) | ( operation ) |
Returns: none
Insert a new document into collection with keys and values given by the record keys_values_rec.
‣ UpdateDatabase ( query_rec, str, collection ) | ( operation ) |
‣ UpdateDatabase ( query_rec, keys_values_rec, collection ) | ( operation ) |
‣ UpdateDatabase ( id, keys_values_rec, collection ) | ( operation ) |
Returns: a database cursor
Update the document(s) filtered by the record query_rec or with the identifier string id in collection using the keys-values record keys_values_rec of which str = GapToJsonString
( keys_values_rec ). The option to directly provide a string str is for experts.
‣ RemoveFromDatabase ( id, collection ) | ( operation ) |
Returns: none
Remove the document with identifier id from collection.
‣ RemoveKeyFromCollection ( key_name, query_rec, collection ) | ( operation ) |
‣ RemoveKeyFromCollection ( key_name, collection ) | ( operation ) |
Returns: a database cursor
Remove the key with the name key_name from the documents in the collection coll satisfying the query record query_rec. If not specified query_rec defaults to the empty record.
‣ QueryDatabase ( collection ) | ( operation ) |
‣ QueryDatabase ( query_str, collection ) | ( operation ) |
‣ QueryDatabase ( query_rec, collection ) | ( operation ) |
‣ QueryDatabase ( query_str, result, collection ) | ( operation ) |
‣ QueryDatabase ( query_rec, result, collection ) | ( operation ) |
Returns: a database cursor
Return the cursor defined by the query within collection defined by the following options:
If the option FILTER
:= query_str or FILTER
:= query_rec is provided, then the query is filtered according to query_str or according to the names of components of the query record query_rec as keys and the values of the components as values. A value fail
is translated to null
. This is the way to query for nonbound keys. If a value is a list, then it is iterpreted as [ "O1", value1, "O2", value2, ... ], where "O1", "O2", ... are comparison operators joined with the and operator. (see https://docs.arangodb.com/3.2/AQL/Operators.html). The interpretation of this list might change in future!
If the option RETURN
:= result (result record/list/string) is provided, then documents in the resulting cursor will only contain the values of the components of the record result. More precisely, RETURN:= rec( new_key1_name := "key1_in_document", ... )
. If instead a result list RETURN=[ "key1", "key2", ... ]
is provided then it is automatically converted into RETURN:=rec( key1 := "key1", key2 := "key2"... )
.
QueryDatabase
( query_str, collection ) is a shorthand for QueryDatabase
( collection : FILTER
:= query_str ).
QueryDatabase
( query_rec, collection ) is a shorthand for QueryDatabase
( collection : FILTER
:= query_rec ).
QueryDatabase
( query_str, result, collection ) is a shorthand for QueryDatabase
( collection : FILTER
:= query_str, RETURN
:= result ). QueryDatabase
( query_rec, result, collection ) is a shorthand for QueryDatabase
( collection : FILTER
:= query_rec, RETURN
:= result ).
‣ MarkFirstNDocuments ( n, query_rec, mark_rec, collection ) | ( operation ) |
Returns: a database array, false
, or fail
Mark by the entries of mark_rec the first n (or less) documents in collection (1) satisfying query_rec and (2) not containing values for the keys in mark_rec and return them in a database array. If (1) fails return [ false ]
. If (1) and (2) fail return [ fail ]
. The operation is atomic.
‣ MarkFirstDocument ( query_rec, mark_rec, collection ) | ( operation ) |
Returns: a database document, false
, or fail
Returns MarkFirstNDocuments( 1,
query_rec, mark_rec, collection )[1]
, or false
, or fail
‣ Iterator ( cursor ) | ( operation ) |
‣ Iterator ( array ) | ( operation ) |
Returns: an iterator
Convert database cursor into a GAP iterator.
Convert database array into a GAP iterator.
‣ ListOp ( array ) | ( operation ) |
‣ ListOp ( cursor ) | ( operation ) |
Returns: a list
Convert database array into a GAP list of database documents.
Use as List
(array).
Convert database cursor into a GAP list of database documents.
Use as List
(cursor).
‣ ListOp ( array, f ) | ( operation ) |
‣ ListOp ( cursor, f ) | ( operation ) |
Returns: a list
Convert database array into a GAP list of database documents by applying the function f.
Use as List
(array, f).
Convert database cursor into a GAP list of database documents by applying the function f.
Use as List
(cursor, f).
‣ SumOp ( cursor, f ) | ( operation ) |
‣ SumOp ( array, f ) | ( operation ) |
Returns: a list
Convert database cursor into a GAP list of database documents by applying the function f.
Use as Sum
(cursor, f).
Convert database array into a GAP list of database documents by applying the function f.
Use as Sum
(array, f).
‣ DatabaseDocumentToRecord ( document ) | ( operation ) |
Returns: a record
Convert document into a GAP record.
‣ DisplayInArangoSh ( object ) | ( operation ) |
Returns: none
Display in arangosh
, the Arango shell.
‣ ArangoImport ( filename, collection ) | ( operation ) |
Returns: none
Import file named filename to collection. Accepted options:
type
separator (as a string, if type is "csv" or "tsv")
options (remaining options as a string)
See (https://docs.arangodb.com/3.2/Manual/Administration/Arangoimp.html).
‣ DocumentsWithDeadLocks ( json_key, collection ) | ( operation ) |
Returns: a list of documents
Check collection for documents d
with existing d.(json_key_lock)
created on this server but with no GAP process with PID=d.(json_key_lock).PID
. Here json_key_lock := Concatenation(
json_key, "_lock" )
.
‣ RemoveDeadLocksFromDocuments ( json_key, collection ) | ( operation ) |
Returns: a list of documents
Remove the deadlocks in all documents found by DocumentsWithDeadLocks(
json_key, collection )
.
generated by GAPDoc2HTML