This is the main class of the CaosDB client for Octave.
The Caosdb
class holds information about the connection to a CaosDB server. It provides a
convenient interface to the possible transactions (insert, query, retrieve, update, delete) with the
server.
The name of the connection which shall be used for transactions via this Caosdb
object. The
available connections are taken from the active libcaosdb configuration. If connection
is
the empty string, the default connection will be used.
The constructor takes an optional connection argument which, if given, is used as connection name for transactions via this object.
Return a string with information about the libraries and the server.
Retrieve entities by IDs.
entities = Caosdb.retrieve_by_id("my_id", {"more", "ids"});
Parameters
ids : string or cell array of strings
The ID(s) of the entity (entities) to be retrieved.
Returns
entities : cell array
The retrieved entities.
Execute a query.
entities = Caosdb.query("FIND Record Foo WITH bar=baz"); entities = Caosdb.query("COUNT Record Foo WITH bar=baz");
Parameters
query_str : string
The query to be executed.
Returns
entities : cell array
The retrieved entities. If the query was a COUNT query, the result is an int64 instead.
Insert an entity.
inserted = Caosdb.insert(entities);
Parameters
entities : cell array
A cell array with the entities to be inserted.
Returns
inserted : cell array
The resulting inserted entities (sparse, only for ID and version).
Update an entity.
updated = Caosdb.update(entities);
Parameters
entities : cell array
A cell array with the entities to be updated. All entities must have a valid ID.
Returns
updated : cell array
The resulting updated entities.
Delete entities by IDs.
entities = Caosdb.delete_by_id("my_id", {"more", "ids"});
The usage is equivalent to retrieve_by_id(...)
.
Note: |
Parameters
ids : string or cell array of strings
The ID(s) of the entity (entities) to be deleted.
Returns
entities : cell array
The deleted entities.
Download a file by ID.
entity = Caosdb.download_file_by_single_id("my_id", "/save/file/here.dat");
Inserting files is done by creating a "FILE
" Entity and inserting it.
Parameters
ids : string
The ID of the file to be downloaded.
local_path : string
The location where the file shall be saved.
Returns
entity : cell array
1x1 cell array with the retrieved file entity.