Next: , Previous: , Up: Top   [Index]


3 The Entity class

Class: Entity

This class represents Entities (Records, RecordTypes, Properties) in the CaosDB server, much like in libcaosdb. Detailed information can be found there.

Instance Variable of Entity: string role

One of “RECORD”, “RECORD_TYPE”, “PROPERTY”, “FILE”.

Instance Variable of Entity: string id

See libcaosdb.

Instance Variable of Entity: string versionId
Instance Variable of Entity: string name
Instance Variable of Entity: string description
Instance Variable of Entity: string unit
Instance Variable of Entity: array value

The exact type of the value property should match the datatype of the Entity object.

Instance Variable of Entity: array filepath

Only for “FILE” entities: the file path on the server.

Instance Variable of Entity: array localpath

Only for “FILE” entities: the local path to the file (for upload).

Method on Entity: Entity ([struct data])

The constructor takes an optional data argument which may provide initial content. The typical user will just use the empty constructor Entity() and add content later. (Details about requirements for a valid data struct array can be found in the source code.)

Method on Entity: get_datatype ()
Method on Entity: get_parents ()
Method on Entity: get_properties ()
Method on Entity: get_errors ()

Returns : cell

A cell array of Message objects, this Entity’s errors.
Method on Entity: get_warnings ()

Returns : cell

A cell array of Message objects, this Entity’s warnings.
Method on Entity: get_infos ()

Returns : cell

A cell array of Message objects, this Entity’s info messages.
Method on Entity: set_datatype (string dtype_name, [logical is_reference = false, logical is_list = false])

Set the datatype of this Entity in a consistent manner.

Parameters

dtype_name : string

Either the atomic datatype (for scalar simple values) or the ID of the referenced entity (in the case of reference values).

is_reference : logical

True if the value is a reference, else false (the default).

is_list : logical

True if the value is list types, false if it is a scalar (the default).
Method on Entity: set_parents (cell parents)

Parameters parents : cell

A cell array with the parents (objects of class Parent).
Method on Entity: set_properties (cell properties)

Parameters properties : cell

A cell array with the properties (objects of class Property).
Method on Entity: has_errors ()

Returns : logical

True iff this Entity has stored any error messages).
Method on Entity: has_warnings ()

Returns : logical

True iff this Entity has stored any warning messages).
Method on Entity: has_infos ()

Returns : logical

True iff this Entity has stored any info messages).
Method on Entity: to_struct ([bool warn=true])

Note: This method is mostly interesting for internal use of the library, end users probably will never need it.

Convert to a struct which has all the fields that may be needed for interaction with the backend C++ functions.

If the datatype indicates a list value, the value is interpreted as such. It is an error if the value is list-like (cell string or more than one numeric element) while the datatype indicates a scalar value.


Next: , Previous: , Up: Top   [Index]