Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
@c This file is a part of the CaosDB Project.
@c
@c Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
@c Copyright (C) 2021 Daniel Hornung <d.hornung@indiscale.com>
@c
@c This program is free software: you can redistribute it and/or modify
@c it under the terms of the GNU Affero General Public License as
@c published by the Free Software Foundation, either version 3 of the
@c License, or (at your option) any later version.
@c
@c This program is distributed in the hope that it will be useful,
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@c GNU Affero General Public License for more details.
@c
@c You should have received a copy of the GNU Affero General Public License
@c along with this program. If not, see <https://www.gnu.org/licenses/>.
@node Entity
@comment node-name, next, previous, up
@chapter The Entity class
@c %%%%%%%%%%%%%%% Entity %%%%%%%%%%%%%%%
@deftp {Class} Entity
This class represents Entities (Records, RecordTypes, Properties) in the CaosDB server, much like in
libcaosdb. Detailed information can be found @url{https://docs.indiscale.com/caosdb-cpplib, there}.
@end deftp
@c %%%%%%%%%%%%%%% properties %%%%%%%%%%%%%%%
@deftypeivar {Entity} string role
One of ``@code{RECORD}'', ``@code{RECORD_TYPE}'', ``@code{PROPERTY}'', ``@code{FILE}''.
@end deftypeivar
@deftypeivar {Entity} string id
See libcaosdb.
@end deftypeivar
@deftypeivar {Entity} string versionId
@end deftypeivar
@deftypeivar {Entity} string name
@end deftypeivar
@deftypeivar {Entity} string description
@end deftypeivar
@deftypeivar {Entity} string unit
@end deftypeivar
@deftypeivar {Entity} array value
The exact type of the @var{value} property should match the datatype of the Entity object.
@end deftypeivar
@deftypeivar {Entity} array filepath
Only for ``@code{FILE}'' entities: the file path on the server.
@end deftypeivar
@deftypeivar {Entity} array localpath
Only for ``@code{FILE}'' entities: the local path to the file (for upload).
@end deftypeivar
@c %%%%%%%%%%%%%%% methods %%%%%%%%%%%%%%%
@defmethod Entity Entity ([struct @var{data}])
The constructor takes an optional @var{data} argument which may provide initial content. The
typical user will just use the empty constructor @code{Entity()} and add content later. (Details
about requirements for a valid @var{data} struct array can be found in the
@url{https://gitlab.indiscale.com/caosdb/src/caosdb-octavelib/-/blob/main/src/lib/maoxdb.hpp, source
code}.)
@end defmethod
@defmethod Entity get_datatype ()
@end defmethod
@defmethod Entity get_parents ()
@end defmethod
@defmethod Entity get_properties ()
@end defmethod
@defmethod Entity get_errors ()
@end defmethod
@defmethod Entity get_warnings ()
@end defmethod
@defmethod Entity get_infos ()
@end defmethod
@defmethod Entity set_datatype (string @var{dtype_name}, [logical @var{is_reference} = false, logical @var{is_list} = false])
Set the datatype of this Entity in a consistent manner.
@strong{Parameters}
@param{dtype_name, string, Either the atomic datatype (for scalar simple values) or the ID of the referenced entity (in the case of reference values).}
@param{is_reference, logical, True if the value is a reference@comma{} else false (the default).}
@param{is_list, logical, True if the value is list types@comma{} false if it is a scalar (the default).}
@end defmethod
@defmethod Entity set_parents (cell @var{parents})
@strong{Parameters}
@param{parents, cell, A cell array with the parents (objects of class @var{Parent}).}
@end defmethod
@defmethod Entity set_properties (cell @var{properties})
@strong{Parameters}
@param{properties, cell, A cell array with the properties (objects of class @var{Property}).}
@end defmethod
@defmethod Entity has_errors ()
@strong{Returns}
@param{, logical, True iff this Entity has stored any error messages).}
@end defmethod
@defmethod Entity has_warnings ()
@strong{Returns}
@param{, logical, True iff this Entity has stored any warning messages).}
@end defmethod
@defmethod Entity has_infos ()
@strong{Returns}
@param{, logical, True iff this Entity has stored any info messages).}
@end defmethod
@defmethod Entity to_struct ([bool @var{warn}=true])
@strong{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 @var{datatype} indicates a list value, the @var{value} is interpreted as such. It is an error
if the @var{value} is list-like (cell string or more than one numeric element) while the
@var{datatype} indicates a scalar value.
@end defmethod