The concepts TypeDB returns inside conceptRows answers.
Every entry in a row is one of:
| Struct | TypeQL | Notes |
|---|---|---|
TypeDB.Concept.Entity | an entity instance | iid, optional type |
TypeDB.Concept.Relation | a relation instance | iid, optional type |
TypeDB.Concept.Attribute | an attribute instance | iid, value, value_type, optional type |
TypeDB.Concept.Value | a computed value | value, value_type |
TypeDB.Concept.EntityType | entity type | label |
TypeDB.Concept.RelationType | relation type | label |
TypeDB.Concept.AttributeType | attribute type | label, optional value_type |
TypeDB.Concept.RoleType | a relation role | label |
nil | an unbound optional variable | |
| a list | a list-valued variable | elements are concepts |
type is nil when the query ran with include_instance_types: false.
Values
value holds the value exactly as it came over the wire, which is what the
HTTP API defines: JSON primitives for boolean, integer, double and
string, and strings for decimal, date, datetime, datetime-tz and
duration.
Use typed_value/1 to convert to native Elixir terms:
iex> attr = %TypeDB.Concept.Attribute{iid: "0x1", value: "2024-03-01", value_type: "date"}
iex> TypeDB.Concept.typed_value(attr)
~D[2024-03-01]Conversion never loses information: datetime-tz and duration become
TypeDB.DateTimeTZ and TypeDB.Duration structs, which keep the original
wire form alongside the parsed fields.
Summary
Types
A row entry: a concept, an unbound variable, or a list of concepts.
Functions
Casts a wire value given its TypeDB value type name.
Decodes one wire-format row entry into concept structs.
Returns the iid of an instance, or nil for types and values.
Returns the label of a type, or of the type of an instance when it was included.
Returns the value converted to a native Elixir term.
Returns the wire-format value of an attribute or value concept, nil otherwise.
Types
A row entry: a concept, an unbound variable, or a list of concepts.
@type instance() :: TypeDB.Concept.Entity.t() | TypeDB.Concept.Relation.t() | TypeDB.Concept.Attribute.t()
@type t() :: instance() | type() | TypeDB.Concept.Value.t()
@type type() :: TypeDB.Concept.EntityType.t() | TypeDB.Concept.RelationType.t() | TypeDB.Concept.AttributeType.t() | TypeDB.Concept.RoleType.t()
Functions
Casts a wire value given its TypeDB value type name.
Decodes one wire-format row entry into concept structs.
Raises TypeDB.Error with kind: :decode when the payload does not look like
anything the HTTP API can produce.
Returns the iid of an instance, or nil for types and values.
Returns the label of a type, or of the type of an instance when it was included.
Returns the value converted to a native Elixir term.
boolean→booleaninteger→integerdouble→floatstring→String.t()decimal→Decimal.t()when the optionalDecimallibrary is loaded, otherwise a string. TypeDB renders decimals with TypeQL's literal suffix ("12.345dec"), which is stripped either way — the value differs in type whenDecimalis absent, not in content. The suffix survives inTypeDB.Concept.value/1, which is the raw wire valuedate→Date.t()datetime→NaiveDateTime.t()datetime-tz→TypeDB.DateTimeTZ.t()duration→TypeDB.Duration.t()
Values that cannot be parsed are returned unchanged rather than raising, so a future TypeDB value type never breaks a running application.
Returns the wire-format value of an attribute or value concept, nil otherwise.