diff --git a/proto/caosdb/entity/v1alpha1/main.proto b/proto/caosdb/entity/v1alpha1/main.proto index a16a6f01614b49a7eb923e2eafbeeb02a1d9fb35..a0c3e75c68fa8b38fccf7e171af2925ab6dafcd7 100644 --- a/proto/caosdb/entity/v1alpha1/main.proto +++ b/proto/caosdb/entity/v1alpha1/main.proto @@ -25,6 +25,108 @@ option java_package = "org.caosdb.api.entity.v1alpha1"; option cc_enable_arenas = true; package caosdb.entity.v1alpha1; +// Data type for references to other entities. +message ReferenceDataType { + // The name of the record type which defines the scope of the reference. + string name = 1; +} + +// Data type for list value. +message ListDataType { + // A list can be a list of atomic data types or references. + oneof list_data_type { + // List of atomic data types (e.g. List of DOUBLE) + AtomicDataType atomic_data_type = 1; + // List of reference (e.g. List of Person(s)) + ReferenceDataType reference_data_type = 2; + } +} + +// Atomic data types. +enum AtomicDataType { + // The data type is unset/unknown. + ATOMIC_DATA_TYPE_UNSPECIFIED = 0; + // TEXT data type. + ATOMIC_DATA_TYPE_TEXT = 1; + // DOUBLE data type. + ATOMIC_DATA_TYPE_DOUBLE = 2; + // DATETIME data type. + ATOMIC_DATA_TYPE_DATETIME = 3; + // INTEGER data type. + ATOMIC_DATA_TYPE_INTEGER = 4; + // BOOLEAN data type. + ATOMIC_DATA_TYPE_BOOLEAN = 5; +} + +// The property value's data type. +message DataType { + // Wraps atomic types, LIST and REFERENCE + oneof data_type { + // The atomic data types. + AtomicDataType atomic_data_type = 1; + // A list data type. + ListDataType list_data_type = 2; + // A reference data type. + ReferenceDataType reference_data_type = 3; + } +} + +// Represents collection values (e.g. for lists). +message CollectionValues { + // List of scalar values. + repeated ScalarValue values = 1; +} + +// Represents special values which are otherwise hard to tranfer via protobuf. +enum SpecialValue { + // Represent the NULL value. + SPECIAL_VALUE_UNSPECIFIED = 0; + // The empty string. + SPECIAL_VALUE_EMPTY_STRING = 1; +} + +// A scalar property value. +message ScalarValue { + // Wraps different optimized representations of a single value. + oneof scalar_value { + // The value as integer + int64 integer_value = 1; + // The value as double + double double_value = 2; + // The value as bool + bool boolean_value = 3; + // The value as string + string string_value = 4; + // The value is a special value (e.g. NULL or the empty string) + SpecialValue special_value = 5; + } +} + +// The value of a property. +message Value { + // Wraps scalar and multi-dimensional values. + oneof value { + // The scalar values. + ScalarValue scalar_value = 1; + // The list values. + CollectionValues list_values = 2; + } +} + +// The roles of entities. +enum EntityRole { + // Unspecified role. + ENTITY_ROLE_UNSPECIFIED = 0; + // RecordType + ENTITY_ROLE_RECORD_TYPE = 1; + // Record + ENTITY_ROLE_RECORD = 2; + // Property + ENTITY_ROLE_PROPERTY = 3; + // File + ENTITY_ROLE_FILE = 4; +} + // Messages codes. Entities and transactions contain errors, warnings and info // messages which use these codes. enum MessageCode { @@ -318,13 +420,13 @@ message Entity { // transactions. Version version = 4; // Entity role (e.g. RecordType, Property, Record) - string role = 5; + EntityRole role = 5; // Default unit of this entity (only used by properties). string unit = 6; - // Default datatype of this entity (only used by properties). - string datatype = 7; + // Default data type of this entity (only used by properties). + DataType data_type = 7; // Default value of this entity (only used by properties). - string value = 8; + Value value = 8; // Properties of this entity. repeated Property properties = 9; // Parents of this entity. @@ -356,6 +458,27 @@ message Hash { string value = 2; } +// The property importance. +enum Importance { + // The importance is unset/unknown. + IMPORTANCE_UNSPECIFIED = 0; + // The property is obligatory for children of this entity. The server will + // flag an error when an obligatory property of a parent is missing during + // updates or insertions of a child entity. It says: "YOU MUST!" + IMPORTANCE_OBLIGATORY = 1; + // The property is recommended for children of this entity. The server will + // flag a warning when a recommended property of a parent is missing during + // updates or insertions of a child entity. It says: "YOU SHOULD!" + IMPORTANCE_RECOMMENDED = 2; + // The property is merely suggested for children of this entity. It says: + // "YOU MAY WANT TO?" + IMPORTANCE_SUGGESTED = 3; + // The property is fix and child entities should not add this property to + // themselves (This is a bit like static in object-oriented programming + // languages). It says: "KINDLY IGNORE THIS ONE FOR CHILDREN OF THIS ENTITY" + IMPORTANCE_FIX = 4; +} + // Property of an entity. Don't confuse with an Entity with role="Property" message Property { // ID of the implemented Entity @@ -365,13 +488,13 @@ message Property { // Property description string description = 3; // Property value - string value = 4; + Value value = 4; // Property importance - string importance = 5; + Importance importance = 5; // Property unit string unit = 6; // Property datatype - string datatype = 7; + DataType data_type = 7; // Errors of this property repeated Message errors = 8; // Warnings of this property @@ -436,6 +559,8 @@ message EntityResponse { message IdResponse { // The entity id. string id = 1; + // The entity version. + Version version = 5; // Errors for this entity which occurred during the current transaction. The // presence of errors indicates that a transaction was not successful and the // errors describe why this is the case.