TypeDBLiteValue
Defined in: libs/runtime/src/interpreter.ts:159
A result cell: a concept, the way the TypeDB driver hands one back. A cell carries what it is:
- an entity or relation: its
iidand its actualtype—writer, not thepersonthe query wrote, because TypeDB answers the instance’s own type; - an attribute: its actual
typeand its value; - a value: a value type and a value (an expression’s or a reducer’s result);
- a type: a schema type by its label —
person, or a role type asemployment:employee— which is whatmatch $x sub person;answers. It has no iid and no value.
The three as…() readers work on an attribute or value cell and throw on a thing or a type, with the driver’s
own message shape. A repository that projects a thing reads iid and type and nothing else.
Member summary
Section titled “Member summary”Properties
| Name | Description |
|---|---|
| type | The type label: a thing’s type, an attribute’s type, or a value’s value type. |
Accessors
| Name | Description |
|---|---|
| iid | A thing’s internal id. |
| iidHex | The concept’s iid as TypeQL writes it — 0x…, what iid($x) answers and $x iid … matches (see iid.ts). |
| label | The type cell’s label. |
Methods
| Name | Description |
|---|---|
| asDouble() | An attribute’s or value’s number as a double. |
| asInteger() | An attribute’s or value’s integer. |
| asString() | An attribute’s or value’s text. |
| isAttribute() | Whether this cell is an attribute. |
| isEntity() | Whether this cell is an entity. |
| isRelation() | Whether this cell is a relation. |
| isThing() | Whether this cell is a thing, an entity or a relation: one with an iid. |
| isType() | Whether this cell is a schema type, as match $x sub person; answers. |
| isValue() | Whether this cell is a value: the result of an expression or a reducer. |
| toString() | A stable rendering for every kind — what a shell prints and a set comparison keys on. |
| attribute() | An attribute cell: its type, and its value as text. |
| entity() | An entity cell: its iid and its own type. |
| relation() | A relation cell: its iid and its own type. |
| type() | A schema type, by label — person, or a role type as relation:role. |
| value() | A value cell: the result of an expression or a reducer, with its value type and its value as text. |
Properties
Section titled “Properties”
readonlytype:string
Defined in: libs/runtime/src/interpreter.ts:163
The type label: a thing’s type, an attribute’s type, or a value’s value type.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get iid():
number
Defined in: libs/runtime/src/interpreter.ts:230
A thing’s internal id. Throws on an attribute or value cell, which have none.
Returns
Section titled “Returns”number
iidHex
Section titled “iidHex”Get Signature
Section titled “Get Signature”get iidHex():
string
Defined in: libs/runtime/src/interpreter.ts:241
The concept’s iid as TypeQL writes it — 0x…, what iid($x) answers and $x iid … matches (see
iid.ts). A thing or an attribute has one; a value or a type does not.
Returns
Section titled “Returns”string
Get Signature
Section titled “Get Signature”get label():
string
Defined in: libs/runtime/src/interpreter.ts:199
The type cell’s label. Throws on any other kind — a thing has a type, not a label.
Returns
Section titled “Returns”string
Methods
Section titled “Methods”asDouble()
Section titled “asDouble()”asDouble():
number
Defined in: libs/runtime/src/interpreter.ts:289
An attribute’s or value’s number as a double.
Returns
Section titled “Returns”number
Throws
Section titled “Throws”on a thing or a type, and on a value that is not a number.
asInteger()
Section titled “asInteger()”asInteger():
number
Defined in: libs/runtime/src/interpreter.ts:276
An attribute’s or value’s integer. It throws rather than coercing, matching the driver.
Returns
Section titled “Returns”number
Throws
Section titled “Throws”on a thing or a type, and on a value that is not an integer.
asString()
Section titled “asString()”asString():
string
Defined in: libs/runtime/src/interpreter.ts:260
An attribute’s or value’s text.
Returns
Section titled “Returns”string
Throws
Section titled “Throws”on a thing or a type, which have no string value.
isAttribute()
Section titled “isAttribute()”isAttribute():
boolean
Defined in: libs/runtime/src/interpreter.ts:220
Whether this cell is an attribute.
Returns
Section titled “Returns”boolean
isEntity()
Section titled “isEntity()”isEntity():
boolean
Defined in: libs/runtime/src/interpreter.ts:205
Whether this cell is an entity.
Returns
Section titled “Returns”boolean
isRelation()
Section titled “isRelation()”isRelation():
boolean
Defined in: libs/runtime/src/interpreter.ts:210
Whether this cell is a relation.
Returns
Section titled “Returns”boolean
isThing()
Section titled “isThing()”isThing():
boolean
Defined in: libs/runtime/src/interpreter.ts:215
Whether this cell is a thing, an entity or a relation: one with an iid.
Returns
Section titled “Returns”boolean
isType()
Section titled “isType()”isType():
boolean
Defined in: libs/runtime/src/interpreter.ts:194
Whether this cell is a schema type, as match $x sub person; answers.
Returns
Section titled “Returns”boolean
isValue()
Section titled “isValue()”isValue():
boolean
Defined in: libs/runtime/src/interpreter.ts:225
Whether this cell is a value: the result of an expression or a reducer.
Returns
Section titled “Returns”boolean
toString()
Section titled “toString()”toString():
string
Defined in: libs/runtime/src/interpreter.ts:299
A stable rendering for every kind — what a shell prints and a set comparison keys on.
Returns
Section titled “Returns”string
attribute()
Section titled “attribute()”
staticattribute(type,value):TypeDBLiteValue
Defined in: libs/runtime/src/interpreter.ts:179
An attribute cell: its type, and its value as text.
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”TypeDBLiteValue
entity()
Section titled “entity()”
staticentity(iid,type):TypeDBLiteValue
Defined in: libs/runtime/src/interpreter.ts:169
An entity cell: its iid and its own type.
Parameters
Section titled “Parameters”number
string
Returns
Section titled “Returns”TypeDBLiteValue
relation()
Section titled “relation()”
staticrelation(iid,type):TypeDBLiteValue
Defined in: libs/runtime/src/interpreter.ts:174
A relation cell: its iid and its own type.
Parameters
Section titled “Parameters”number
string
Returns
Section titled “Returns”TypeDBLiteValue
type()
Section titled “type()”
statictype(label):TypeDBLiteValue
Defined in: libs/runtime/src/interpreter.ts:189
A schema type, by label — person, or a role type as relation:role.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”TypeDBLiteValue
value()
Section titled “value()”
staticvalue(valueType,value):TypeDBLiteValue
Defined in: libs/runtime/src/interpreter.ts:184
A value cell: the result of an expression or a reducer, with its value type and its value as text.
Parameters
Section titled “Parameters”valueType
Section titled “valueType”string
string
Returns
Section titled “Returns”TypeDBLiteValue
TypeDBLite is an independent open-source project, built on TypeDB with thanks. It is not affiliated with, sponsored by, or endorsed by TypeDB Ltd. Released under the MPL-2.0 license.