Node.js driver API reference

Connection

TypeDB

Namespace variables
Name

DEFAULT_ADDRESS

cloudDriver

cloudDriver(addresses, credential): Promise<TypeDBDriver>

Creates a connection to TypeDB Cloud, authenticating with the provided credentials.

Input parameters
Name Description Type

addresses

List of addresses of the individual TypeDB Cloud servers. As long one specified address is provided, the driver will discover the other addresses from that server.

string | string[]

credential

The credentials to log in, and encryption settings. See TypeDBCredential Examples const driver = TypeDB.cloudDriver(["127.0.0.1:11729"], new TypeDBCredential(username, password)); Copy

TypeDBCredential

Returns

Promise<TypeDBDriver>

coreDriver

coreDriver(address?): Promise<TypeDBDriver>

Creates a connection to TypeDB.

Input parameters
Name Description Type

address

Address of the TypeDB server. Examples const driver = TypeDB.coreDriver("127.0.0.1:11729"); Copy

string = DEFAULT_ADDRESS

Returns

Promise<TypeDBDriver>

TypeDBDriver

Fields
Name Type Description

databases

DatabaseManager

The DatabaseManager for this connection, providing access to database management methods.

users

UserManager

The UserManager instance for this connection, providing access to user management methods. Only for TypeDB Cloud.

close

close(): Promise<void>

Closes the driver. Before instantiating a new driver, the driver that’s currently open should first be closed.

Returns

Promise<void>

Code examples
driver.close()

isOpen

isOpen(): boolean

Checks whether this connection is presently open.

Returns

boolean

Code examples
driver.isOpen()

session

session(database, type, options?): Promise<TypeDBSession>
Input parameters
Name Description Type

database

string

type

SessionType

options

TypeDBOptions

Returns

Promise<TypeDBSession>

user

user(): Promise<User>

Returns the logged-in user for the connection. Only for TypeDB Cloud.

Returns

Promise<User>

Code examples
driver.user()

TypeDBCredential

User credentials and TLS encryption settings for connecting to TypeDB Cloud.

password

get password(): string
Returns

string

tlsRootCAPath

get tlsRootCAPath(): string
Returns

string

username

get username(): string
Returns

string

new TypeDBCredential

new TypeDBCredential(username, password, tlsRootCAPath?): TypeDBCredential
Input parameters
Name Description Type

username

The name of the user to connect as

string

password

The password for the user

string

tlsRootCAPath

Path to the CA certificate to use for authenticating server certificates.

string

Returns

TypeDBCredential

DatabaseManager

Provides access to all database management methods.

all

all(): Promise<Database[]>

Retrieves all databases present on the TypeDB server

Returns

Promise<Database[]>

Code examples
driver.databases().all()

contains

contains(name): Promise<boolean>

Checks if a database with the given name exists

Input parameters
Name Description Type

name

The database name to be checked

string

Returns

Promise<boolean>

Code examples
driver.databases().contains(name)

create

create(name): Promise<void>

Create a database with the given name

Input parameters
Name Description Type

name

The name of the database to be created

string

Returns

Promise<void>

Code examples
driver.databases().create(name)

get

get(name): Promise<Database>

Retrieve the database with the given name.

Input parameters
Name Description Type

name

The name of the database to retrieve

string

Returns

Promise<Database>

Code examples
driver.databases().get(name)

Database

Fields
Name Type Description

name

string

The database name as a string.

preferredReplica

Replica

The preferred replica for this database. Operations which can be run on any replica will prefer to use this replica. Only works in TypeDB Cloud

primaryReplica

Replica

The primary replica for this database. Only works in TypeDB Cloud

replicas

Replica

The Replica instances for this database. Only works in TypeDB Cloud

delete

delete(): Promise<void>

Deletes this database.

Returns

Promise<void>

Code examples
database.delete()

schema

schema(): Promise<string>

Returns a full schema text as a valid TypeQL define query string.

Returns

Promise<string>

Code examples
database.schema()

Replica

The metadata and state of an individual raft replica of a database.

Fields
Name Type Description

address

string

The address of the server hosting this replica

databaseName

string

The database for which this is a replica.

preferred

boolean

Checks whether this is the preferred replica of the raft cluster. If true, Operations which can be run on any replica will prefer to use this replica.

primary

boolean

Checks whether this is the primary replica of the raft cluster.

term

number

The raft protocol ‘term’ of this replica.

UserManager

Provides access to all user management methods.

all

all(): Promise<User[]>

Retrieves all users which exist on the TypeDB server.

Returns

Promise<User[]>

Code examples
driver.users.all()

contains

contains(name): Promise<boolean>

Checks if a user with the given name exists.

Input parameters
Name Description Type

name

string

Returns

Promise<boolean>

Code examples
driver.users.contains(username)

create

create(name, password): Promise<void>

Create a user with the given name & password.

Input parameters
Name Description Type

name

string

password

The password of the user to be created

string

Returns

Promise<void>

Code examples
driver.users.create(username, password)

delete

delete(name): Promise<void>

Deletes a user with the given name.

Input parameters
Name Description Type

name

string

Returns

Promise<void>

Code examples
driver.users.delete(username)

get

get(name): Promise<User>

Retrieve a user with the given name.

Input parameters
Name Description Type

name

string

Returns

Promise<User>

Code examples
driver.users.get(username)

passwordSet

passwordSet(name, password): Promise<void>

Sets a new password for a user. This operation can only be performed by administrators.

Input parameters
Name Description Type

name

string

password

The new password

string

Returns

Promise<void>

Code examples
driver.users.passwordSet(username, password)

User

User class

Fields
Name Type Description

passwordExpirySeconds

number

The number of seconds remaining till this user’s current password expires.

username

string

The name of this user.

passwordUpdate

passwordUpdate(oldPassword, newPassword): Promise<void>

Updates the user’s password.

Input parameters
Name Description Type

oldPassword

Old password

string

newPassword

New password

string

Returns

Promise<void>

Code examples
user.passwordUpdate("oldpassword", "nEwp@ssw0rd");

Session

TypeDBSession

Fields
Name Type Description

database

Database

The database of the session. Examples session.database() Copy

options

TypeDBOptions

Gets the options for the session

type

SessionType

The current session’s type (SCHEMA or DATA)

close

close(): Promise<void>

Closes the session. Before opening a new session, the session currently open should first be closed.

Returns

Promise<void>

Code examples
session.close()

isOpen

isOpen(): boolean

Checks whether this session is open.

Returns

boolean

Code examples
session.isOpen()

onClose

onClose(callback): void

Registers a callback function which will be executed when this session is closed.

Input parameters
Name Description Type

callback

The callback function.

(() ⇒ Promise<void>)

Returns

void

Code examples
session.onClose(function)

onReopen

onReopen(callback): void

Registers a callback function which will be executed when this session is reopened. A session may be closed if it times out, or loses the connection to the database. In such situations, the session is reopened automatically when opening a new transaction.

Input parameters
Name Description Type

callback

The callback function.

(() ⇒ Promise<void>)

Returns

void

Code examples
session.onReopen(function)

transaction

transaction(type, options?): Promise<TypeDBTransaction>

Opens a transaction to perform read or write queries on the database connected to the session.

Input parameters
Name Description Type

type

TransactionType

options

Options for the session

TypeDBOptions

Returns

Promise<TypeDBTransaction>

Code examples
session.transaction(transactionType, options)

SessionType

This class is used to specify the type of the session.

Namespace variables
Name

DATA

SCHEMA

isData

isData(): boolean
Returns

boolean

isSchema

isSchema(): boolean
Returns

boolean

TypeDBOptions

TypeDB session and transaction options. TypeDBOptions object can be used to override the default server behaviour. Options could be specified either as constructor arguments or using setters.

explain

get explain(): boolean

If set to True, enables explanations for queries. Only affects read transactions.

Returns

boolean

explain

set explain(value): void

If set to True, enables explanations for queries. Only affects read transactions.

Returns

void

infer

get infer(): boolean

If set to True, enables inference for queries. Only settable at transaction level and above. Only affects read transactions.

Returns

boolean

infer

set infer(value): void

If set to True, enables inference for queries. Only settable at transaction level and above. Only affects read transactions.

Returns

void

parallel

get parallel(): boolean

If set to True, the server uses parallel instead of single-threaded execution.

Returns

boolean

parallel

set parallel(value): void

If set to True, the server uses parallel instead of single-threaded execution.

Returns

void

prefetch

get prefetch(): boolean

If set to True, the first batch of answers is streamed to the driver even without an explicit request for it.

Returns

boolean

prefetch

set prefetch(value): void

If set to True, the first batch of answers is streamed to the driver even without an explicit request for it.

Returns

void

prefetchSize

get prefetchSize(): number

If set, specifies a guideline number of answers that the server should send before the driver issues a fresh request.

Returns

number

prefetchSize

set prefetchSize(value): void

If set, specifies a guideline number of answers that the server should send before the driver issues a fresh request.

Returns

void

readAnyReplica

get readAnyReplica(): boolean

If set to True, enables reading data from any replica, potentially boosting read throughput. Only settable in TypeDB Cloud.

Returns

boolean

readAnyReplica

set readAnyReplica(value): void

If set to True, enables reading data from any replica, potentially boosting read throughput. Only settable in TypeDB Cloud.

Returns

void

schemaLockAcquireTimeoutMillis

get schemaLockAcquireTimeoutMillis(): number

If set, specifies how long the driver should wait if opening a session or transaction is blocked by a schema write lock.

Returns

number

schemaLockAcquireTimeoutMillis

set schemaLockAcquireTimeoutMillis(value): void

If set, specifies how long the driver should wait if opening a session or transaction is blocked by a schema write lock.

Returns

void

sessionIdleTimeoutMillis

get sessionIdleTimeoutMillis(): number

If set, specifies a timeout that allows the server to close sessions if the driver terminates or becomes unresponsive.

Returns

number

sessionIdleTimeoutMillis

set sessionIdleTimeoutMillis(millis): void

If set, specifies a timeout that allows the server to close sessions if the driver terminates or becomes unresponsive.

Returns

void

traceInference

get traceInference(): boolean

If set to True, reasoning tracing graphs are output in the logging directory. Should be used with parallel = False.

Returns

boolean

traceInference

set traceInference(value): void

If set to True, reasoning tracing graphs are output in the logging directory. Should be used with parallel = False.

Returns

void

transactionTimeoutMillis

get transactionTimeoutMillis(): number

If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

Returns

number

transactionTimeoutMillis

set transactionTimeoutMillis(millis): void

If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

Returns

void

new TypeDBOptions

new TypeDBOptions(obj?): TypeDBOptions
Input parameters
Name Description Type

obj

If set to True, enables explanations for queries. Only affects read transactions.

{ explain?: boolean; infer?: boolean; parallel?: boolean; prefetch?: boolean; prefetchSize?: number; readAnyReplica?: boolean; schemaLockAcquireTimeoutMillis?: number; sessionIdleTimeoutMillis?: number; traceInference?: boolean; transactionTimeoutMillis?: number; } = {}

Returns

TypeDBOptions

Opts

Interface for TypeDBOptions. Use TypeDBOptions instead.

Fields
Name Type Description

explain

boolean

If set to True, enables explanations for queries. Only affects read transactions.

infer

boolean

If set to True, enables inference for queries. Only settable at transaction level and above. Only affects read transactions.

parallel

boolean

If set to True, the server uses parallel instead of single-threaded execution.

prefetch

boolean

If set to True, the first batch of answers is streamed to the driver even without an explicit request for it.

prefetchSize

number

If set, specifies a guideline number of answers that the server should send before the driver issues a fresh request.

readAnyReplica

boolean

If set to True, enables reading data from any replica, potentially boosting read throughput. Only settable in TypeDB Cloud.

schemaLockAcquireTimeoutMillis

number

If set, specifies how long the driver should wait if opening a session or transaction is blocked by a schema write lock.

sessionIdleTimeoutMillis

number

If set, specifies a timeout that allows the server to close sessions if the driver terminates or becomes unresponsive.

traceInference

boolean

If set to True, reasoning tracing graphs are output in the logging directory. Should be used with parallel = False.

transactionTimeoutMillis

number

If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

Transaction

TypeDBTransaction

Fields
Name Type Description

concepts

ConceptManager

The ConceptManager for this transaction, providing access to all Concept API methods.

logic

LogicManager

The LogicManager for this Transaction, providing access to all Concept API - Logic methods.

options

TypeDBOptions

The options for the transaction.

query

QueryManager

TheQueryManager for this Transaction, from which any TypeQL query can be executed.

type

TransactionType

The transaction’s type (READ or WRITE)

close

close(): Promise<void>

Closes the transaction.

Returns

Promise<void>

Code examples
transaction.close()

commit

commit(): Promise<void>

Commits the changes made via this transaction to the TypeDB database. Whether or not the transaction is commited successfully, it gets closed after the commit call.

Returns

Promise<void>

Code examples
transaction.commit()

isOpen

isOpen(): boolean

Checks whether this transaction is open.

Returns

boolean

Code examples
transaction.isOpen()

onClose

onClose(callback): void

Registers a callback function which will be executed when this transaction is closed.

Input parameters
Name Description Type

callback

The callback function.

((error?) ⇒ Promise<void>)

Returns

void

Code examples
transaction.onClose(function);

rollback

rollback(): Promise<void>

Rolls back the uncommitted changes made via this transaction.

Returns

Promise<void>

Code examples
transaction.rollback()

TransactionType

This class is used to specify the type of transaction.

Namespace variables
Name

READ

WRITE

isRead

isRead(): boolean

Checks whether this is the READ TransactionType

Returns

boolean

isWrite

isWrite(): boolean

Checks whether this is the WRITE TransactionType

Returns

boolean

QueryManager

Provides methods for executing TypeQL queries in the transaction.

define

define(query, options?): Promise<void>

Performs a TypeQL Define query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Define query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Promise<void>

Code examples
transaction.query.define(query, options)

delete

delete(query, options?): Promise<void>

Performs a TypeQL Delete query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Delete query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Promise<void>

Code examples
transaction.query.delete(query, options)

explain

explain(explainable, options?): Stream<Explanation>

Performs a TypeQL Explain query in the transaction.

Input parameters
Name Description Type

explainable

The Explainable to be explained

Explainable

options

Specify query options

TypeDBOptions

Returns

Stream<Explanation>

Code examples
transaction.query.explain(explainable, options)

fetch

fetch(query, options?): Stream<JSONObject>

Performs a TypeQL Fetch query in the transaction.

Returns a stream of JSON Objects of strings to JSON. JSON can be: Arrays of JSON, Objects of strings to JSON, or primitives such as strings or numbers or booleans.

Input parameters
Name Description Type

query

The TypeQL Fetch query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Stream<JSONObject>

Code examples
transaction.query.fetch(query, options)

get

get(query, options?): Stream<ConceptMap>

Performs a TypeQL Get query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Stream<ConceptMap>

Code examples
transaction.query.get(query, options)

getAggregate

getAggregate(query, options?): Promise<Value>

Performs a TypeQL Get Aggregate query in the transaction. Returns an empty promise if the aggregate was not well-defined (such as stddev of 0 elements).

Input parameters
Name Description Type

query

The TypeQL Get Aggregate query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Promise<Value>

Code examples
transaction.query.getAggregate(query, options)

getGroup

getGroup(query, options?): Stream<ConceptMapGroup>

Performs a TypeQL Get Group query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get Group query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Stream<ConceptMapGroup>

Code examples
transaction.query.getGroup(query, options)

getGroupAggregate

getGroupAggregate(query, options?): Stream<ValueGroup>

Performs a TypeQL Get Group Aggregate query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get Group Aggregate query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Stream<ValueGroup>

Code examples
transaction.query.getGroupAggregate(query, options)

insert

insert(query, options?): Stream<ConceptMap>

Performs a TypeQL Insert query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Insert query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Stream<ConceptMap>

Code examples
transaction.query.insert(query, options)

undefine

undefine(query, options?): Promise<void>

Performs a TypeQL Undefine query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Undefine query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Promise<void>

Code examples
transaction.query.undefine(query, options)

update

update(query, options?): Stream<ConceptMap>

Performs a TypeQL Update query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Update query to be executed

string

options

Specify query options

TypeDBOptions

Returns

Stream<ConceptMap>

Code examples
transaction.query.update(query, options)

Answer

ConceptMapGroup

Contains an element of the group query result.

Fields
Name Type Description

conceptMaps

ConceptMap

The ConceptMaps of the group.

owner

Concept

The concept that is the group owner.

ConceptMap

Contains a mapping of variables to concepts.

Fields
Name Type Description

explainables

Explainables

The Explainables object for this ConceptMap, exposing which of the concepts in this ConceptMap are explainable.

concepts

concepts(): IterableIterator<Concept>

Produces an iterator over all concepts in this ConceptMap.

Returns

IterableIterator<Concept>

Code examples
conceptMap.concepts()

get

get(variable): Concept

Retrieves a concept for a given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

string

Returns

Concept

Code examples
conceptMap.get(variable)

map

map(): Map<string, Concept>

Returns the inner Map where keys are query variables, and values are concepts.

Returns

Map<string, Concept>

Code examples
conceptMap.map()

variables

variables(): IterableIterator<string>

Produces an iterator over all variables in this ConceptMap.

Returns

IterableIterator<string>

Code examples
conceptMap.variables()

Stream<T>

A stream of elements offering a functional interface to manipulate elements. Typically the elements are generated/retrieved lazily.

[asyncIterator]

[asyncIterator](): AsyncIterator<T, any, undefined>
Returns

AsyncIterator<T, any, undefined>

collect

collect(): Promise<T[]>

Collects all the answers from this stream into an array

Returns

Promise<T[]>

Code examples
results = transaction.query.match(query).collect().await;

every

every(callbackFn): Promise<boolean>

Checks whether a condition is satisfied by ALL answers in this stream.

Input parameters
Name Description Type

callbackFn

((value) ⇒ unknown)

Returns

Promise<boolean>

filter

filter(filter): Stream<T>

Returns a new stream from this stream consisting only of elements which satisfy a given condition.

Input parameters
Name Description Type

filter

The condition to evaluate. Examples // For a query "match $p isa person, has age $a;", only retrieve results having $a >= 60.results = transaction.query.match(query).filter(cm => cm.get("a").value > 60).collect(); Copy

((value) ⇒ boolean)

Returns

Stream<T>

first

first(): Promise<T>

Returns the first element in the stream.

Returns

Promise<T>

flatMap

flatMap<U>(mapper): Stream<U>

Given a function which accepts a single element of this stream and returns a new stream, This function returns a new stream obtained by applying the function to each element in the stream, and concatenating each result thus obtained

Input parameters
Name Description Type

mapper

The mapping function to apply. Must return a stream.

((value) ⇒ Stream<U>)

Returns

Stream<U>

forEach

forEach(fn): Promise<void>

Executes the given function for each element in the stream.

Input parameters
Name Description Type

fn

The function to evaluate for each element.

((value) ⇒ void)

Returns

Promise<void>

iterator

iterator(): AsyncIterator<T, any, undefined>
Returns

AsyncIterator<T, any, undefined>

map

map<U>(mapper): Stream<U>
Input parameters
Name Description Type

mapper

The mapping function to apply. Returns a new stream from this stream by applying the mapper function to each element.

((value) ⇒ U)

Returns

Stream<U>

new Stream

new Stream<T>(): Stream<T>
Returns

Stream<T>

some

some(callbackFn): Promise<boolean>

Checks whether a condition is satisfied by ANY answer in this stream.

Input parameters
Name Description Type

callbackFn

((value) ⇒ unknown)

Returns

Promise<boolean>

ValueGroup

Contains an element of the group aggregate query result.

Fields
Name Type Description

owner

Concept

Retrieves the concept that is the group owner. Examples valueGroup.owner Copy

value

Value

Retrieves the Value answer of the group, if there is one. Examples valueGroup.value Copy

Explainables

Contains explainable objects.

Fields
Name Type Description

attributes

Map

All of this ConceptMap’s explainable attributes.

ownerships

Map

All of this ConceptMap’s explainable ownerships.

relations

Map

All of this ConceptMap’s explainable relations.

attribute

attribute(variable): Explainable

Retrieves the explainable attribute with the given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

string

Returns

Explainable

Code examples
conceptMap.explainables.attribute(variable)

ownership

ownership(owner, attribute): Explainable

Retrieves the explainable attribute ownership with the pair of (owner, attribute) variable names.

Input parameters
Name Description Type

owner

The string representation of the owner variable

string

attribute

The string representation of the attribute variable

string

Returns

Explainable

Code examples
conceptMap.explainables.ownership(owner, attribute)

relation

relation(variable): Explainable

Retrieves the explainable relation with the given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

string

Returns

Explainable

Code examples
conceptMap.explainables.relation(variable)

Explainable

Contains an explainable object.

Fields
Name Type Description

conjunction

string

The subquery of the original query that is actually being explained.

id

number

A unique ID that identifies this Explainable.

Explanation

An explanation of which rule was used for inferring the explained concept, the condition of the rule, the conclusion of the rule, and the mapping of variables between the query and the rule’s conclusion.

Fields
Name Type Description

conclusion

ConceptMap

The Conclusion for this Explanation.

condition

ConceptMap

The Condition for this Explanation.

rule

Rule

Retrieves the Rule for this Explanation.

variableMapping

Map

Retrieves the query variables for this Explanation.

Concept

ConceptManager

Provides access for all Concept API methods.

getAttribute

getAttribute(iid): Promise<Attribute>

Retrieves an Attribute by its iid.

Input parameters
Name Description Type

iid

The iid of the Attribute to retrieve

string

Returns

Promise<Attribute>

Code examples
transaction.concepts().getAttribute(iid)

getAttributeType

getAttributeType(label): Promise<AttributeType>

Retrieves an AttributeType by its label.

Input parameters
Name Description Type

label

The label of the AttributeType to retrieve

string

Returns

Promise<AttributeType>

Code examples
transaction.concepts().getAttributeType(label)

getEntity

getEntity(iid): Promise<Entity>

Retrieves an Entity by its iid.

Input parameters
Name Description Type

iid

The iid of the Entity to retrieve

string

Returns

Promise<Entity>

Code examples
transaction.concepts().getEntity(iid)

getEntityType

getEntityType(label): Promise<EntityType>

Retrieves an EntityType by its label.

Input parameters
Name Description Type

label

The label of the EntityType to retrieve

string

Returns

Promise<EntityType>

Code examples
transaction.concepts().getEntityType(label)

getRelation

getRelation(iid): Promise<Relation>

Retrieves a Relation by its iid.

Input parameters
Name Description Type

iid

The iid of the Relation to retrieve

string

Returns

Promise<Relation>

Code examples
transaction.concepts().getRelation(iid)

getRelationType

getRelationType(label): Promise<RelationType>

Retrieves a RelationType by its label.

Input parameters
Name Description Type

label

The label of the RelationType to retrieve

string

Returns

Promise<RelationType>

Code examples
transaction.concepts().getRelationType(label)

getRootAttributeType

getRootAttributeType(): Promise<AttributeType>

Retrieve the root AttributeType, “attribute”.

Returns

Promise<AttributeType>

Code examples
transaction.concepts().getRootAttributeType()

getRootEntityType

getRootEntityType(): Promise<EntityType>

Retrieves the root EntityType, “entity”.

Returns

Promise<EntityType>

Code examples
transaction.concepts().getRootEntityType()

getRootRelationType

getRootRelationType(): Promise<RelationType>

Retrieve the root RelationType, “relation”.

Returns

Promise<RelationType>

Code examples
transaction.concepts().getRootRelationType()

getRootThingType

getRootThingType(): Promise<ThingType>

Retrieves the root ThingType, “thing”.

Returns

Promise<ThingType>

Code examples
transaction.concepts().getRootThingType()

getSchemaExceptions

getSchemaExceptions(): Promise<TypeDBDriverError[]>

Retrieves a list of all schema exceptions for the current transaction.

Returns

Promise<TypeDBDriverError[]>

Code examples
transaction.concepts().getSchemaException()

putAttributeType

putAttributeType(label, valueType): Promise<AttributeType>

Creates a new AttributeType if none exists with the given label, or retrieves the existing one. or retrieve. :return:

Input parameters
Name Description Type

label

The label of the AttributeType to create or retrieve

string

valueType

The value type of the AttributeType to create

ValueType

Returns

Promise<AttributeType>

Code examples
await transaction.concepts().putAttributeType(label, valueType)

putEntityType

putEntityType(label): Promise<EntityType>

Creates a new EntityType if none exists with the given label, otherwise retrieves the existing one.

Input parameters
Name Description Type

label

The label of the EntityType to create or retrieve

string

Returns

Promise<EntityType>

Code examples
transaction.concepts().putEntityType(label)

putRelationType

putRelationType(label): Promise<RelationType>

Creates a new RelationType if none exists with the given label, otherwise retrieves the existing one.

Input parameters
Name Description Type

label

The label of the RelationType to create or retrieve

string

Returns

Promise<RelationType>

Code examples
transaction.concepts().putRelationType(label)

Concept

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

Schema

Type

Supertypes:

  • Concept

Fields
Name Type Description

abstract

boolean

Whether the type is prevented from having data instances (i.e., abstract).

label

Label

The unique label of the type.

root

boolean

Whether the type is a root type.

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this type from the database.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
type.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getSubtypes

getSubtypes(transaction): Stream<Type>

Retrieves all direct and indirect (or direct only) subtypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Type>

Code examples
type.getSubtypes(transaction) type.getSubtypes(transaction, Transitivity.EXPLICIT)

getSubtypes

getSubtypes(transaction, transitivity): Stream<Type>

Retrieves all direct and indirect (or direct only) subtypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect subtypes, Transitivity.EXPLICIT for direct subtypes only

Transitivity

Returns

Stream<Type>

Code examples
type.getSubtypes(transaction) type.getSubtypes(transaction, Transitivity.EXPLICIT)

getSupertype

getSupertype(transaction): Promise<Type>

Retrieves the most immediate supertype of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<Type>

Code examples
type.getSupertype(transaction)

getSupertypes

getSupertypes(transaction): Stream<Type>

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Type>

Code examples
type.getSupertypes(transaction)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Check if the concept has been deleted

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setLabel

setLabel(transaction, label): Promise<void>

Renames the label of the type. The new label must remain unique.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

label

The new Label to be given to the type.

string

Returns

Promise<void>

Code examples
type.setLabel(transaction, label)

Label

A Label holds the uniquely identifying name of a type.

It consists of an optional 'scope', and a 'name', represented "scope:name". The scope is used only used to distinguish between role-types of the same name declared in different relation types.

name

get name(): string

Returns the name part of the label.

Returns

string

scope

get scope(): string

Returns the (possibly null) scope part of the label.

Returns

string

scopedName

get scopedName(): string

Returns the string representation of the scoped name.

Returns

string

equals

equals(that): boolean

Compares this label to that label.

Input parameters
Name Description Type

that

The label to compare to.

Label

Returns

boolean

toString

toString(): string

Printable string

Returns

string

ThingType

Supertypes:

  • Type

Namespace variables
Name

NAME

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this type from the database.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
type.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getInstances

getInstances(transaction): Stream<Thing>

Retrieves all direct and indirect Thing objects that are instances of this ThingType. Equivalent to getInstances(transaction, Transitivity.TRANSITIVE)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Thing>

Code examples
thingType.getInstances(transaction)

getInstances

getInstances(transaction, transitivity): Stream<Thing>

Retrieves all direct and indirect (or direct only) Thing objects that are instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect instances, Transitivity.EXPLICIT for direct instances only

Transitivity

Returns

Stream<Thing>

Code examples
thingType.getInstances(transaction, Transitivity.EXPLICIT)

getOwns

getOwns(transaction): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

If specified, only attribute types of this ValueType will be retrieved.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

transitivity

Transitivity.TRANSITIVE for direct and inherited ownership, Transitivity.EXPLICIT for direct ownership only

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwnsOverridden

getOwnsOverridden(transaction, attributeType): Promise<AttributeType>

Retrieves an AttributeType, ownership of which is overridden for this ThingType by a given attribute_type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType that overrides requested AttributeType

AttributeType

Returns

Promise<AttributeType>

Code examples
thingType.getOwnsOverridden(transaction, attributeType)

getPlays

getPlays(transaction): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlays

getPlays(transaction, transitivity): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect playing, Transitivity.EXPLICIT for direct playing only

Transitivity

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlaysOverridden

getPlaysOverridden(transaction, role): Promise<RoleType>

Retrieves a RoleType that is overridden by the given role_type for this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The RoleType that overrides an inherited role

RoleType

Returns

Promise<RoleType>

Code examples
thingType.getPlaysOverridden(transaction, role)

getSubtypes

getSubtypes(transaction): Stream<ThingType>

Retrieves all direct and indirect subtypes of the ThingType. Equivalent to getSubtypes(transaction, Transitivity.TRANSITIVE)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<ThingType>

Code examples
thingType.getSubtypes(transaction)

getSubtypes

getSubtypes(transaction, transitivity): Stream<ThingType>

Retrieves all direct and indirect (or direct only) subtypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect subtypes, Transitivity.EXPLICIT for direct subtypes only

Transitivity

Returns

Stream<ThingType>

Code examples
thingType.getSubtypes(transaction, Transitivity.EXPLICIT)

getSupertype

getSupertype(transaction): Promise<ThingType>

Retrieves the most immediate supertype of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<ThingType>

Code examples
thingType.getSupertype(transaction)

getSupertypes

getSupertypes(transaction): Stream<ThingType>

Retrieves all supertypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<ThingType>

Code examples
thingType.getSupertypes(transaction)

getSyntax

getSyntax(transaction): Promise<string>

Produces a pattern for creating this ThingType in a define query.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<string>

Code examples
thingType.getSyntax(transaction)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Check if the concept has been deleted

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setAbstract

setAbstract(transaction): Promise<void>

Set a ThingType to be abstract, meaning it cannot have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.setAbstract(transaction)

setLabel

setLabel(transaction, label): Promise<void>

Renames the label of the type. The new label must remain unique.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

label

The new Label to be given to the type.

string

Returns

Promise<void>

Code examples
type.setLabel(transaction, label)

setOwns

setOwns(transaction, attributeType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

annotations

The AttributeType that this attribute ownership overrides, if applicable.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

annotations

Adds annotations to the ownership.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setPlays

setPlays(transaction, role): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

setPlays

setPlays(transaction, role, overriddenType): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

overriddenType

The role type that this role overrides, if applicable

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

unsetAbstract

unsetAbstract(transaction): Promise<void>

Set a ThingType to be non-abstract, meaning it can have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.unsetAbstract(transaction)

unsetOwns

unsetOwns(transaction, attributeType): Promise<void>

Disallows the instances of this ThingType from owning the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to not be owned by the type.

AttributeType

Returns

Promise<void>

Code examples
thingType.unsetOwns(transaction, attributeType)

unsetPlays

unsetPlays(transaction, role): Promise<void>

Disallows the instances of this ThingType from playing the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to not be played by the instances of this type.

RoleType

Returns

Promise<void>

Code examples
thingType.unsetPlays(transaction, role)

EntityType

Supertypes:

  • ThingType

Namespace variables
Name

NAME

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

create

create(transaction): Promise<Entity>
Input parameters
Name Description Type

transaction

TypeDBTransaction

Returns

Promise<Entity>

delete

delete(transaction): Promise<void>

Deletes this type from the database.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
type.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getInstances

getInstances(transaction): Stream<Entity>

Retrieves all direct and indirect Thing objects that are instances of this ThingType. Equivalent to getInstances(transaction, Transitivity.TRANSITIVE)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Entity>

Code examples
thingType.getInstances(transaction)

getInstances

getInstances(transaction, transitivity): Stream<Entity>

Retrieves all direct and indirect (or direct only) Thing objects that are instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect instances, Transitivity.EXPLICIT for direct instances only

Transitivity

Returns

Stream<Entity>

Code examples
thingType.getInstances(transaction, Transitivity.EXPLICIT)

getOwns

getOwns(transaction): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

If specified, only attribute types of this ValueType will be retrieved.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

transitivity

Transitivity.TRANSITIVE for direct and inherited ownership, Transitivity.EXPLICIT for direct ownership only

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwnsOverridden

getOwnsOverridden(transaction, attributeType): Promise<AttributeType>

Retrieves an AttributeType, ownership of which is overridden for this ThingType by a given attribute_type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType that overrides requested AttributeType

AttributeType

Returns

Promise<AttributeType>

Code examples
thingType.getOwnsOverridden(transaction, attributeType)

getPlays

getPlays(transaction): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlays

getPlays(transaction, transitivity): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect playing, Transitivity.EXPLICIT for direct playing only

Transitivity

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlaysOverridden

getPlaysOverridden(transaction, role): Promise<RoleType>

Retrieves a RoleType that is overridden by the given role_type for this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The RoleType that overrides an inherited role

RoleType

Returns

Promise<RoleType>

Code examples
thingType.getPlaysOverridden(transaction, role)

getSubtypes

getSubtypes(transaction): Stream<EntityType>

Retrieves all direct and indirect subtypes of the ThingType. Equivalent to getSubtypes(transaction, Transitivity.TRANSITIVE)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<EntityType>

Code examples
thingType.getSubtypes(transaction)

getSubtypes

getSubtypes(transaction, transitivity): Stream<EntityType>

Retrieves all direct and indirect (or direct only) subtypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect subtypes, Transitivity.EXPLICIT for direct subtypes only

Transitivity

Returns

Stream<EntityType>

Code examples
thingType.getSubtypes(transaction, Transitivity.EXPLICIT)

getSupertype

getSupertype(transaction): Promise<EntityType>

Retrieves the most immediate supertype of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<EntityType>

Code examples
thingType.getSupertype(transaction)

getSupertypes

getSupertypes(transaction): Stream<EntityType>

Retrieves all supertypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<EntityType>

Code examples
thingType.getSupertypes(transaction)

getSyntax

getSyntax(transaction): Promise<string>

Produces a pattern for creating this ThingType in a define query.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<string>

Code examples
thingType.getSyntax(transaction)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Check if the concept has been deleted

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setAbstract

setAbstract(transaction): Promise<void>

Set a ThingType to be abstract, meaning it cannot have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.setAbstract(transaction)

setLabel

setLabel(transaction, label): Promise<void>

Renames the label of the type. The new label must remain unique.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

label

The new Label to be given to the type.

string

Returns

Promise<void>

Code examples
type.setLabel(transaction, label)

setOwns

setOwns(transaction, attributeType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

annotations

The AttributeType that this attribute ownership overrides, if applicable.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

annotations

Adds annotations to the ownership.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setPlays

setPlays(transaction, role): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

setPlays

setPlays(transaction, role, overriddenType): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

overriddenType

The role type that this role overrides, if applicable

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

setSupertype

setSupertype(transaction, superEntityType): Promise<void>
Input parameters
Name Description Type

transaction

TypeDBTransaction

superEntityType

EntityType

Returns

Promise<void>

unsetAbstract

unsetAbstract(transaction): Promise<void>

Set a ThingType to be non-abstract, meaning it can have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.unsetAbstract(transaction)

unsetOwns

unsetOwns(transaction, attributeType): Promise<void>

Disallows the instances of this ThingType from owning the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to not be owned by the type.

AttributeType

Returns

Promise<void>

Code examples
thingType.unsetOwns(transaction, attributeType)

unsetPlays

unsetPlays(transaction, role): Promise<void>

Disallows the instances of this ThingType from playing the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to not be played by the instances of this type.

RoleType

Returns

Promise<void>

Code examples
thingType.unsetPlays(transaction, role)

RelationType

Supertypes:

  • ThingType

Namespace variables
Name

NAME

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

create

create(transaction): Promise<Relation>

Creates and returns an instance of this RelationType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<Relation>

Code examples
relationType.create(transaction)

delete

delete(transaction): Promise<void>

Deletes this type from the database.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
type.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getInstances

getInstances(transaction): Stream<Relation>

Retrieves all direct and indirect Thing objects that are instances of this ThingType. Equivalent to getInstances(transaction, Transitivity.TRANSITIVE)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Relation>

Code examples
thingType.getInstances(transaction)

getInstances

getInstances(transaction, transitivity): Stream<Relation>

Retrieves all direct and indirect (or direct only) Thing objects that are instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect instances, Transitivity.EXPLICIT for direct instances only

Transitivity

Returns

Stream<Relation>

Code examples
thingType.getInstances(transaction, Transitivity.EXPLICIT)

getOwns

getOwns(transaction): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

If specified, only attribute types of this ValueType will be retrieved.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

transitivity

Transitivity.TRANSITIVE for direct and inherited ownership, Transitivity.EXPLICIT for direct ownership only

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwnsOverridden

getOwnsOverridden(transaction, attributeType): Promise<AttributeType>

Retrieves an AttributeType, ownership of which is overridden for this ThingType by a given attribute_type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType that overrides requested AttributeType

AttributeType

Returns

Promise<AttributeType>

Code examples
thingType.getOwnsOverridden(transaction, attributeType)

getPlays

getPlays(transaction): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlays

getPlays(transaction, transitivity): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect playing, Transitivity.EXPLICIT for direct playing only

Transitivity

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlaysOverridden

getPlaysOverridden(transaction, role): Promise<RoleType>

Retrieves a RoleType that is overridden by the given role_type for this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The RoleType that overrides an inherited role

RoleType

Returns

Promise<RoleType>

Code examples
thingType.getPlaysOverridden(transaction, role)

getRelates

getRelates(transaction): Stream<RoleType>

RelationType#getRelates:(1)

Input parameters
Name Description Type

transaction

TypeDBTransaction

Returns

Stream<RoleType>

getRelates

getRelates(transaction, transitivity): Stream<RoleType>

Retrieves roles that this RelationType relates to directly or via inheritance. If role_label is given, returns a corresponding RoleType or None.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and inherited relates, Transitivity.EXPLICIT for direct relates only

Transitivity

Returns

Stream<RoleType>

Code examples
relationType.getRelates(transaction, roleLabel, transitivity)

getRelatesForRoleLabel

getRelatesForRoleLabel(transaction, roleLabel): Promise<RoleType>
Input parameters
Name Description Type

transaction

TypeDBTransaction

roleLabel

string

Returns

Promise<RoleType>

getRelatesOverridden

getRelatesOverridden(transaction, roleLabel): Promise<RoleType>

Retrieves a RoleType that is overridden by the role with the role_label.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleLabel

Label of the role that overrides an inherited role

string

Returns

Promise<RoleType>

Code examples
relationType.getRelatesOverridden(transaction, roleLabel)

getSubtypes

getSubtypes(transaction): Stream<RelationType>

Retrieves all direct and indirect subtypes of the ThingType. Equivalent to getSubtypes(transaction, Transitivity.TRANSITIVE)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RelationType>

Code examples
thingType.getSubtypes(transaction)

getSubtypes

getSubtypes(transaction, transitivity): Stream<RelationType>

Retrieves all direct and indirect (or direct only) subtypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect subtypes, Transitivity.EXPLICIT for direct subtypes only

Transitivity

Returns

Stream<RelationType>

Code examples
thingType.getSubtypes(transaction, Transitivity.EXPLICIT)

getSupertype

getSupertype(transaction): Promise<RelationType>

Retrieves the most immediate supertype of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<RelationType>

Code examples
thingType.getSupertype(transaction)

getSupertypes

getSupertypes(transaction): Stream<RelationType>

Retrieves all supertypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RelationType>

Code examples
thingType.getSupertypes(transaction)

getSyntax

getSyntax(transaction): Promise<string>

Produces a pattern for creating this ThingType in a define query.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<string>

Code examples
thingType.getSyntax(transaction)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Check if the concept has been deleted

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setAbstract

setAbstract(transaction): Promise<void>

Set a ThingType to be abstract, meaning it cannot have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.setAbstract(transaction)

setLabel

setLabel(transaction, label): Promise<void>

Renames the label of the type. The new label must remain unique.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

label

The new Label to be given to the type.

string

Returns

Promise<void>

Code examples
type.setLabel(transaction, label)

setOwns

setOwns(transaction, attributeType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

annotations

The AttributeType that this attribute ownership overrides, if applicable.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

annotations

Adds annotations to the ownership.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setPlays

setPlays(transaction, role): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

setPlays

setPlays(transaction, role, overriddenType): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

overriddenType

The role type that this role overrides, if applicable

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

setRelates

setRelates(transaction, roleLabel, overriddenLabel?): Promise<void>

Sets the new role that this RelationType relates to. If we are setting an overriding type this way, we have to also pass the overridden type as a second argument.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleLabel

The new role for the RelationType to relate to

string

overriddenLabel

The label being overridden, if applicable

string

Returns

Promise<void>

Code examples
relationType.setRelates(transaction, roleLabel) relationType.setRelates(transaction, roleLabel, overriddenLabel)

setSupertype

setSupertype(transaction, type): Promise<void>
Input parameters
Name Description Type

transaction

TypeDBTransaction

type

RelationType

Returns

Promise<void>

unsetAbstract

unsetAbstract(transaction): Promise<void>

Set a ThingType to be non-abstract, meaning it can have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.unsetAbstract(transaction)

unsetOwns

unsetOwns(transaction, attributeType): Promise<void>

Disallows the instances of this ThingType from owning the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to not be owned by the type.

AttributeType

Returns

Promise<void>

Code examples
thingType.unsetOwns(transaction, attributeType)

unsetPlays

unsetPlays(transaction, role): Promise<void>

Disallows the instances of this ThingType from playing the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to not be played by the instances of this type.

RoleType

Returns

Promise<void>

Code examples
thingType.unsetPlays(transaction, role)

unsetRelates

unsetRelates(transaction, roleLabel): Promise<void>

Disallows this RelationType from relating to the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleLabel

The role to not relate to the relation type.

string

Returns

Promise<void>

Code examples
relationType.unsetRelates(transaction, roleLabel)

RoleType

Supertypes:

  • Type

Roles are special internal types used by relations. We can not create an instance of a role in a database. But we can set an instance of another type (role player) to play a role in a particular instance of a relation type. Roles allow a schema to enforce logical constraints on types of role players.

Namespace variables
Name

NAME

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this type from the database.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
type.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getPlayerInstances

getPlayerInstances(transaction): Stream<Thing>

Retrieves the Thing instances that play this role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Thing>

Code examples
roleType.getPlayerInstances(transaction, transitivity)

getPlayerInstances

getPlayerInstances(transaction, transitivity): Stream<Thing>

Retrieves the Thing instances that play this role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect playing, Transitivity.EXPLICIT for direct playing only

Transitivity

Returns

Stream<Thing>

Code examples
roleType.getPlayerInstances(transaction, transitivity)

getPlayerTypes

getPlayerTypes(transaction): Stream<ThingType>

Retrieves the ThingTypes whose instances play this role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<ThingType>

Code examples
roleType.getPlayerTypes(transaction, transitivity)

getPlayerTypes

getPlayerTypes(transaction, transitivity): Stream<ThingType>

Retrieves the ThingTypes whose instances play this role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect playing, Transitivity.EXPLICIT for direct playing only

Transitivity

Returns

Stream<ThingType>

Code examples
roleType.getPlayerTypes(transaction, transitivity)

getRelationInstances

getRelationInstances(transaction): Stream<Relation>

Retrieves the Relation instances that this role is related to.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Relation>

Code examples
roleType.getRelationInstances(transaction, transitivity)

getRelationInstances

getRelationInstances(transaction, transitivity): Stream<Relation>

Retrieves the Relation instances that this role is related to.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect relation, Transitivity.EXPLICIT for direct relation only

Transitivity

Returns

Stream<Relation>

Code examples
roleType.getRelationInstances(transaction, transitivity)

getRelationType

getRelationType(transaction): Promise<RelationType>

Retrieves the RelationType that this role is directly related to.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<RelationType>

Code examples
roleType.getRelationType(transaction)

getRelationTypes

getRelationTypes(transaction): Stream<RelationType>

Retrieves RelationTypes that this role is related to (directly or indirectly).

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RelationType>

Code examples
roleType.getRelationTypes(transaction)

getSubtypes

getSubtypes(transaction): Stream<RoleType>

Retrieves all direct and indirect (or direct only) subtypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
type.getSubtypes(transaction) type.getSubtypes(transaction, Transitivity.EXPLICIT)

getSupertype

getSupertype(transaction): Promise<RoleType>

Retrieves the most immediate supertype of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<RoleType>

Code examples
type.getSupertype(transaction)

getSupertypes

getSupertypes(transaction): Stream<RoleType>

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
type.getSupertypes(transaction)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Check if the concept has been deleted

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setLabel

setLabel(transaction, label): Promise<void>

Renames the label of the type. The new label must remain unique.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

label

The new Label to be given to the type.

string

Returns

Promise<void>

Code examples
type.setLabel(transaction, label)

AttributeType

Supertypes:

  • ThingType

Attribute types represent properties that other types can own. Attribute types have a value type. This value type is fixed and unique for every given instance of the attribute type. Other types can own an attribute type. That means that instances of these other types can own an instance of this attribute type. This usually means that an object in our domain has a property with the matching value. Multiple types can own the same attribute type, and different instances of the same type or different types can share ownership of the same attribute instance.

Namespace variables
Name

NAME

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this type from the database.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
type.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

get

get(transaction, value): Promise<Attribute>

Retrieves an Attribute of this AttributeType with the given value if such Attribute exists. Otherwise, returns None.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

Value

Returns

Promise<Attribute>

Code examples
attribute = attributeType.get(transaction, value)

getBoolean

getBoolean(transaction, value): Promise<Attribute>

Retrieves an Attribute of this AttributeType with the given value if such Attribute exists. Otherwise, returns None.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

boolean

Returns

Promise<Attribute>

Code examples
attribute = attributeType.get(transaction, value)

getDateTime

getDateTime(transaction, value): Promise<Attribute>

Retrieves an Attribute of this AttributeType with the given value if such Attribute exists. Otherwise, returns None.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

Date

Returns

Promise<Attribute>

Code examples
attribute = attributeType.get(transaction, value)

getDouble

getDouble(transaction, value): Promise<Attribute>

Retrieves an Attribute of this AttributeType with the given value if such Attribute exists. Otherwise, returns None.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

number

Returns

Promise<Attribute>

Code examples
attribute = attributeType.get(transaction, value)

getInstances

getInstances(transaction, transitivity): Stream<Attribute>

Retrieves all direct and indirect (or direct only) Attributes that are instances of this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect subtypes, Transitivity.EXPLICIT for direct subtypes only

Transitivity

Returns

Stream<Attribute>

Code examples
attributeType.getInstances(transaction) attributeType.getInstances(transaction, Transitivity.EXPLICIT)

getInstances

getInstances(transaction): Stream<Attribute>

Retrieves all direct and indirect (or direct only) Thing objects that are instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Attribute>

Code examples
thingType.getInstances(transaction, Transitivity.EXPLICIT)

getLong

getLong(transaction, value): Promise<Attribute>

Retrieves an Attribute of this AttributeType with the given value if such Attribute exists. Otherwise, returns None.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

number

Returns

Promise<Attribute>

Code examples
attribute = attributeType.get(transaction, value)

getOwners

getOwners(transaction, annotations, transitivity): Stream<ThingType>

Retrieve all Things that own an attribute of this AttributeType. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

Only retrieve ThingTypes that have an attribute of this AttributeType with all given Annotations

Annotation[]

transitivity

Transitivity.TRANSITIVE for direct and inherited ownership, Transitivity.EXPLICIT for direct ownership only

Transitivity

Returns

Stream<ThingType>

Code examples
attributeType.getOwners(transaction) attributeType.getOwners(transaction, [Annotation.UNIQUE]) attributeType.getOwners(transaction, Transitivity.TRANSITIVE) attributeType.getOwners(transaction, [Annotation.UNIQUE], Transitivity.TRANSITIVE)

getOwners

getOwners(transaction): Stream<ThingType>
Input parameters
Name Description Type

transaction

TypeDBTransaction

Returns

Stream<ThingType>

getOwners

getOwners(transaction, annotations): Stream<ThingType>
Input parameters
Name Description Type

transaction

TypeDBTransaction

annotations

Annotation[]

Returns

Stream<ThingType>

getOwners

getOwners(transaction, transitivity): Stream<ThingType>
Input parameters
Name Description Type

transaction

TypeDBTransaction

transitivity

Transitivity

Returns

Stream<ThingType>

getOwns

getOwns(transaction): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

If specified, only attribute types of this ValueType will be retrieved.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

If specified, only attribute types of this ValueType will be retrieved.

Annotation[]

transitivity

Only retrieve attribute types owned with annotations.

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwns

getOwns(transaction, valueType, annotations, transitivity): Stream<AttributeType>

Retrieves AttributeType that the instances of this ThingType are allowed to own directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

If specified, only attribute types of this ValueType will be retrieved.

ValueType

annotations

Only retrieve attribute types owned with annotations.

Annotation[]

transitivity

Transitivity.TRANSITIVE for direct and inherited ownership, Transitivity.EXPLICIT for direct ownership only

Transitivity

Returns

Stream<AttributeType>

Code examples
thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY])

getOwnsOverridden

getOwnsOverridden(transaction, attributeType): Promise<AttributeType>

Retrieves an AttributeType, ownership of which is overridden for this ThingType by a given attribute_type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType that overrides requested AttributeType

AttributeType

Returns

Promise<AttributeType>

Code examples
thingType.getOwnsOverridden(transaction, attributeType)

getPlays

getPlays(transaction): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlays

getPlays(transaction, transitivity): Stream<RoleType>

Retrieves all direct and inherited (or direct only) roles that are allowed to be played by the instances of this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.TRANSITIVE for direct and indirect playing, Transitivity.EXPLICIT for direct playing only

Transitivity

Returns

Stream<RoleType>

Code examples
thingType.getPlays(transaction) thingType.getPlays(transaction, Transitivity.EXPLICIT)

getPlaysOverridden

getPlaysOverridden(transaction, role): Promise<RoleType>

Retrieves a RoleType that is overridden by the given role_type for this ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The RoleType that overrides an inherited role

RoleType

Returns

Promise<RoleType>

Code examples
thingType.getPlaysOverridden(transaction, role)

getRegex

getRegex(transaction): Promise<string>

Retrieves the regular expression that is defined for this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<string>

Code examples
attributeType.getRegex(transaction)

getString

getString(transaction, value): Promise<Attribute>

Retrieves an Attribute of this AttributeType with the given value if such Attribute exists. Otherwise, returns None.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

string

Returns

Promise<Attribute>

Code examples
attribute = attributeType.get(transaction, value)

getSubtypes

getSubtypes(transaction): Stream<AttributeType>

Retrieves all direct and indirect subtypes of the ThingType. Equivalent to getSubtypes(transaction, Transitivity.TRANSITIVE)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<AttributeType>

Code examples
thingType.getSubtypes(transaction)

getSubtypes

getSubtypes(transaction, valueType): Stream<AttributeType>

Retrieves all direct and indirect (or direct only) subtypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

Transitivity.TRANSITIVE for direct and indirect subtypes, Transitivity.EXPLICIT for direct subtypes only

ValueType

Returns

Stream<AttributeType>

Code examples
thingType.getSubtypes(transaction, Transitivity.EXPLICIT)

getSubtypes

getSubtypes(transaction, transitivity): Stream<AttributeType>
Input parameters
Name Description Type

transaction

TypeDBTransaction

transitivity

Transitivity

Returns

Stream<AttributeType>

getSubtypes

getSubtypes(transaction, valueType, transitivity): Stream<AttributeType>
Input parameters
Name Description Type

transaction

TypeDBTransaction

valueType

ValueType

transitivity

Transitivity

Returns

Stream<AttributeType>

getSupertype

getSupertype(transaction): Promise<AttributeType>

Retrieves the most immediate supertype of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<AttributeType>

Code examples
thingType.getSupertype(transaction)

getSupertypes

getSupertypes(transaction): Stream<AttributeType>

Retrieves all supertypes of the ThingType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<AttributeType>

Code examples
thingType.getSupertypes(transaction)

getSyntax

getSyntax(transaction): Promise<string>

Produces a pattern for creating this ThingType in a define query.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<string>

Code examples
thingType.getSyntax(transaction)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Check if the concept has been deleted

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

put

put(transaction, value): Promise<Attribute>

Adds and returns an Attribute of this AttributeType with the given value.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

Value

Returns

Promise<Attribute>

Code examples
attribute = attributeType.put(transaction, value)

putBoolean

putBoolean(transaction, value): Promise<Attribute>

Adds and returns an Attribute of this AttributeType with the given value.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

boolean

Returns

Promise<Attribute>

Code examples
attribute = attributeType.put(transaction, value)

putDateTime

putDateTime(transaction, value): Promise<Attribute>

Adds and returns an Attribute of this AttributeType with the given value.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

Date

Returns

Promise<Attribute>

Code examples
attribute = attributeType.put(transaction, value)

putDouble

putDouble(transaction, value): Promise<Attribute>

Adds and returns an Attribute of this AttributeType with the given value.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

number

Returns

Promise<Attribute>

Code examples
attribute = attributeType.put(transaction, value)

putLong

putLong(transaction, value): Promise<Attribute>

Adds and returns an Attribute of this AttributeType with the given value.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

number

Returns

Promise<Attribute>

Code examples
attribute = attributeType.put(transaction, value)

putString

putString(transaction, value): Promise<Attribute>

Adds and returns an Attribute of this AttributeType with the given value.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

string

Returns

Promise<Attribute>

Code examples
attribute = attributeType.put(transaction, value)

setAbstract

setAbstract(transaction): Promise<void>

Set a ThingType to be abstract, meaning it cannot have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.setAbstract(transaction)

setLabel

setLabel(transaction, label): Promise<void>

Renames the label of the type. The new label must remain unique.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

label

The new Label to be given to the type.

string

Returns

Promise<void>

Code examples
type.setLabel(transaction, label)

setOwns

setOwns(transaction, attributeType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

annotations

The AttributeType that this attribute ownership overrides, if applicable.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setOwns

setOwns(transaction, attributeType, overriddenType, annotations): Promise<void>

Allows the instances of this ThingType to own the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to be owned by the instances of this type.

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

annotations

Adds annotations to the ownership.

Annotation[]

Returns

Promise<void>

Code examples
thingType.setOwns(transaction, attributeType) thingType.setOwns(transaction, attributeType, overriddenType,[Annotation.KEY])

setPlays

setPlays(transaction, role): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

setPlays

setPlays(transaction, role, overriddenType): Promise<void>

Allows the instances of this ThingType to play the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to be played by the instances of this type

RoleType

overriddenType

The role type that this role overrides, if applicable

RoleType

Returns

Promise<void>

Code examples
thingType.setPlays(transaction, role) thingType.setPlays(transaction, role, overriddenType)

setRegex

setRegex(transaction, regex): Promise<void>

Sets a regular expression as a constraint for this AttributeType. Values of all Attributes of this type (inserted earlier or later) should match this regex. Can only be applied for AttributeTypes with a string value type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

regex

Regular expression

string

Returns

Promise<void>

Code examples
attributeType.setRegex(transaction, regex)

setSupertype

setSupertype(transaction, type): Promise<void>
Input parameters
Name Description Type

transaction

TypeDBTransaction

type

AttributeType

Returns

Promise<void>

unsetAbstract

unsetAbstract(transaction): Promise<void>

Set a ThingType to be non-abstract, meaning it can have instances.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thingType.unsetAbstract(transaction)

unsetOwns

unsetOwns(transaction, attributeType): Promise<void>

Disallows the instances of this ThingType from owning the given AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to not be owned by the type.

AttributeType

Returns

Promise<void>

Code examples
thingType.unsetOwns(transaction, attributeType)

unsetPlays

unsetPlays(transaction, role): Promise<void>

Disallows the instances of this ThingType from playing the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

role

The role to not be played by the instances of this type.

RoleType

Returns

Promise<void>

Code examples
thingType.unsetPlays(transaction, role)

unsetRegex

unsetRegex(transaction): Promise<void>

Removes the regular expression that is defined for this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
attributeType.unsetRegex(transaction)

Annotation

Annotations for ownership declarations.

Fields
Name Type Description

KEY

Annotation

Annotation to specify the attribute owned is a KEY

UNIQUE

Annotation

Annotation to specify the owned is UNIQUE

parse

parse(string): Annotation

Returns the relevant Annotation given the name as a string

Input parameters
Name Description Type

string

name of the attribute as a string. e.g.: "key", "unique"

string

Returns

Annotation

toString

toString(): string

Printable string

Returns

string

Transitivity

Namespace variables
Name

EXPLICIT

TRANSITIVE

new Transitivity

new Transitivity(transitivity): Transitivity
Input parameters
Name Description Type

transitivity

TypeTransitivity

Returns

Transitivity

ValueType

TypeQL value types for attributes & value concepts.

Namespace variables
Name

BOOLEAN

DATETIME

DOUBLE

LONG

OBJECT

STRING

name

name(): string
Returns

string

new ValueType

new ValueType(type, name): ValueType
Input parameters
Name Description Type

type

ValueType

name

string

Returns

ValueType

toString

toString(): string
Returns

string

Data

Thing

Supertypes:

  • Concept

Fields
Name Type Description

iid

string

Retrieves the unique id of the Thing.

inferred

boolean

Checks if this Thing is inferred by a [Reasoning Rule].

type

ThingType

Retrieves the type which this Thing belongs to.

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thing.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getHas

getHas(transaction): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

The AttributeTypes to filter the attributes by

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeType): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeTypes to filter the attributes by

AttributeType

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

annotations

Only retrieve attributes with all given Annotations

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getPlaying

getPlaying(transaction): Stream<RoleType>

Retrieves the roles that this Thing is currently playing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thing.getPlaying(transaction)

getRelations

getRelations(transaction): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

getRelations

getRelations(transaction, roleTypes): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleTypes

The list of roles to filter the relations by.

RoleType[]

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Checks if this Thing is deleted.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

Code examples
thing.isDeleted(transaction)

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setHas

setHas(transaction, attribute): Promise<void>

Assigns an Attribute to be owned by this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be owned by this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.setHas(transaction, attribute)

unsetHas

unsetHas(transaction, attribute): Promise<void>

Unassigns an Attribute from this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be disowned from this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.unsetHas(transaction, attribute)

Entity

Supertypes:

  • Thing

Instance of data of an entity type, representing a standalone object that exists in the data model independently. Entity does not have a value. It is usually addressed by its ownership over attribute instances and/or roles played in relation instances.

Fields
Name Type Description

iid

string

Retrieves the unique id of the Thing.

inferred

boolean

Checks if this Thing is inferred by a [Reasoning Rule].

type

EntityType

The type which this Entity belongs to.

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thing.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getHas

getHas(transaction): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

The AttributeTypes to filter the attributes by

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeType): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeTypes to filter the attributes by

AttributeType

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

annotations

Only retrieve attributes with all given Annotations

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getPlaying

getPlaying(transaction): Stream<RoleType>

Retrieves the roles that this Thing is currently playing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thing.getPlaying(transaction)

getRelations

getRelations(transaction): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

getRelations

getRelations(transaction, roleTypes): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleTypes

The list of roles to filter the relations by.

RoleType[]

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Checks if this Thing is deleted.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

Code examples
thing.isDeleted(transaction)

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setHas

setHas(transaction, attribute): Promise<void>

Assigns an Attribute to be owned by this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be owned by this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.setHas(transaction, attribute)

unsetHas

unsetHas(transaction, attribute): Promise<void>

Unassigns an Attribute from this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be disowned from this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.unsetHas(transaction, attribute)

Relation

Supertypes:

  • Thing

Relation is an instance of a relation type and can be uniquely addressed by a combination of its type, owned attributes and role players.

Fields
Name Type Description

iid

string

Retrieves the unique id of the Thing.

inferred

boolean

Checks if this Thing is inferred by a [Reasoning Rule].

type

RelationType

The type which this Relation belongs to.

addRolePlayer

addRolePlayer(transaction, roleType, player): Promise<void>

Adds a new role player to play the given role in this Relation.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleType

The role to be played by the player

RoleType

player

The thing to play the role

Thing

Returns

Promise<void>

Code examples
relation.addRolePlayer(transaction, roleType, player)

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thing.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getHas

getHas(transaction): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

The AttributeTypes to filter the attributes by

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeType): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeTypes to filter the attributes by

AttributeType

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

annotations

Only retrieve attributes with all given Annotations

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getPlayersByRoleType

getPlayersByRoleType(transaction): Stream<Thing>

Retrieves all role players of this Relation, optionally filtered by given role types.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Thing>

Code examples
relation.getPlayersByRoleType(transaction) relation.getPlayersByRoleType(transaction, [roleType1, roleType2])

getPlayersByRoleType

getPlayersByRoleType(transaction, roleTypes): Stream<Thing>

Retrieves all role players of this Relation, optionally filtered by given role types.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleTypes

0 or more role types

RoleType[]

Returns

Stream<Thing>

Code examples
relation.getPlayersByRoleType(transaction) relation.getPlayersByRoleType(transaction, [roleType1, roleType2])

getPlaying

getPlaying(transaction): Stream<RoleType>

Retrieves the roles that this Thing is currently playing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thing.getPlaying(transaction)

getRelating

getRelating(transaction): Stream<RoleType>

Retrieves all role types currently played in this Relation.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
relation.getRelating(transaction)

getRelations

getRelations(transaction): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

getRelations

getRelations(transaction, roleTypes): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleTypes

The list of roles to filter the relations by.

RoleType[]

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

getRolePlayers

getRolePlayers(transaction): Promise<Map<RoleType, Thing[]>>

Retrieves a mapping of all instances involved in the Relation and the role each play.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<Map<RoleType, Thing[]>>

Code examples
relation.getRolePlayers(transaction)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Checks if this Thing is deleted.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

Code examples
thing.isDeleted(transaction)

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

removeRolePlayer

removeRolePlayer(transaction, roleType, player): Promise<void>

Removes the association of the given instance that plays the given role in this Relation.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleType

The role to no longer be played by the thing in this Relation

RoleType

player

The instance to no longer play the role in this Relation

Thing

Returns

Promise<void>

Code examples
relation.removeRolePlayer(transaction, roleType, player)

setHas

setHas(transaction, attribute): Promise<void>

Assigns an Attribute to be owned by this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be owned by this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.setHas(transaction, attribute)

unsetHas

unsetHas(transaction, attribute): Promise<void>

Unassigns an Attribute from this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be disowned from this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.unsetHas(transaction, attribute)

Attribute

Supertypes:

  • Thing

Attribute is an instance of the attribute type and has a value. This value is fixed and unique for every given instance of the attribute type. Attributes can be uniquely addressed by their type and value.

Fields
Name Type Description

iid

string

Retrieves the unique id of the Thing.

inferred

boolean

Checks if this Thing is inferred by a [Reasoning Rule].

type

AttributeType

The type which this Attribute belongs to.

value

string

The value which the Attribute instance holds.

valueType

ValueType

The type of the value which the Attribute instance holds.

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

delete

delete(transaction): Promise<void>

Deletes this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
thing.delete(transaction)

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

getHas

getHas(transaction): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

The AttributeTypes to filter the attributes by

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeType): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeTypes to filter the attributes by

AttributeType

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getHas

getHas(transaction, attributeTypes, annotations): Stream<Attribute>

Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

annotations

Only retrieve attributes with all given Annotations

Annotation[]

Returns

Stream<Attribute>

Code examples
thing.getHas(transaction) thing.getHas(transaction, attributeType, [Annotation.KEY])

getOwners

getOwners(transaction, ownerType?): Stream<Thing>

Retrieves the instances that own this Attribute.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

ownerType

If specified, filter results for only owners of the given type

ThingType

Returns

Stream<Thing>

Code examples
attribute.getOwners(transaction) attribute.getOwners(transaction, ownerType)

getPlaying

getPlaying(transaction): Stream<RoleType>

Retrieves the roles that this Thing is currently playing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<RoleType>

Code examples
thing.getPlaying(transaction)

getRelations

getRelations(transaction): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

getRelations

getRelations(transaction, roleTypes): Stream<Relation>

Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleTypes

The list of roles to filter the relations by.

RoleType[]

Returns

Stream<Relation>

Code examples
thing.getRelations(transaction, roleTypes)

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isDeleted

isDeleted(transaction): Promise<boolean>

Checks if this Thing is deleted.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<boolean>

Code examples
thing.isDeleted(transaction)

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

setHas

setHas(transaction, attribute): Promise<void>

Assigns an Attribute to be owned by this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be owned by this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.setHas(transaction, attribute)

unsetHas

unsetHas(transaction, attribute): Promise<void>

Unassigns an Attribute from this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be disowned from this Thing.

Attribute

Returns

Promise<void>

Code examples
thing.unsetHas(transaction, attribute)

Value

Supertypes:

  • Concept

Fields
Name Type Description

value

string

Retrieves the value which this value concept holds.

valueType

ValueType

The ValueType of this value concept

asAttribute

asAttribute(): Attribute

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute()

asAttributeType

asAttributeType(): AttributeType

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType()

asBoolean

asBoolean(): boolean

Returns a boolean value of this value concept. If the value has another type, raises an exception.

Returns

boolean

Code examples
value.asBoolean()

asDateTime

asDateTime(): Date

Returns a datetime value of this value concept. If the value has another type, raises an exception.

Returns

Date

Code examples
value.asDatetime()

asDouble

asDouble(): number

Returns a number value of this value concept. If the value has another type, raises an exception.

Returns

number

Code examples
value.asDouble()

asEntity

asEntity(): Entity

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity()

asEntityType

asEntityType(): EntityType

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType()

asLong

asLong(): number

Returns a number value of this value concept. If the value has another type, raises an exception.

Returns

number

Code examples
value.asLong()

asRelation

asRelation(): Relation

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation()

asRelationType

asRelationType(): RelationType

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType()

asRoleType

asRoleType(): RoleType

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType()

asString

asString(): string

Returns a string value of this value concept. If the value has another type, raises an exception.

Returns

string

Code examples
value.asString()

asThing

asThing(): Thing

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing()

asThingType

asThingType(): ThingType

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType()

asType

asType(): Type

Casts the concept to Type.

Returns

Type

Code examples
concept.asType()

asValue

asValue(): Value

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue()

equals

equals(concept): boolean

Checks if this concept is equal to the argument concept.

Input parameters
Name Description Type

concept

The concept to compare to.

Concept

Returns

boolean

isAttribute

isAttribute(): boolean

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute()

isAttributeType

isAttributeType(): boolean

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType()

isBoolean

isBoolean(): boolean

Returns True if the value which this value concept holds is of type boolean. Otherwise, returns False.

Returns

boolean

Code examples
value.isBoolean()

isDateTime

isDateTime(): boolean

Returns True if the value which this value concept holds is of type datetime. Otherwise, returns False.

Returns

boolean

Code examples
value.isDatetime()

isDouble

isDouble(): boolean

Returns True if the value which this value concept holds is of type double. Otherwise, returns False.

Returns

boolean

Code examples
value.isDouble()

isEntity

isEntity(): boolean

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity()

isEntityType

isEntityType(): boolean

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType()

isLong

isLong(): boolean

Returns True if the value which this value concept holds is of type long. Otherwise, returns False.

Returns

boolean

Code examples
value.isLong()

isRelation

isRelation(): boolean

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation()

isRelationType

isRelationType(): boolean

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType()

isRoleType

isRoleType(): boolean

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType()

isString

isString(): boolean

Returns True if the value which this value concept holds is of type string. Otherwise, returns False.

Returns

boolean

Code examples
value.isString()

isThing

isThing(): boolean

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing()

isThingType

isThingType(): boolean

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType()

isType

isType(): boolean

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType()

isValue

isValue(): boolean

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue()

Logic

LogicManager

Provides methods for manipulating rules in the database.

getRule

getRule(label): Promise<Rule>

Retrieves the Rule that has the given label.

Input parameters
Name Description Type

label

The label of the Rule to create or retrieve

string

Returns

Promise<Rule>

Code examples
transaction.logic.getRule(label)

getRules

getRules(): Stream<Rule>

Retrieves all rules.

Returns

Stream<Rule>

Code examples
transaction.logic.getRules()

putRule

putRule(label, when, then): Promise<Rule>

Creates a new Rule if none exists with the given label, or replaces the existing one.

Input parameters
Name Description Type

label

The label of the Rule to create or replace

string

when

The when body of the rule to create

string

then

The then body of the rule to create

string

Returns

Promise<Rule>

Code examples
transaction.logic.putRule(label, when, then)

Rule

Rules are a part of schema and define embedded logic. The reasoning engine uses rules as a set of logic to infer new data. A rule consists of a condition and a conclusion, and is uniquely identified by a label.

Fields
Name Type Description

label

string

The unique label of the rule.

then

string

The single statement that constitutes the ‘then’ of the rule.

when

string

The statements that constitute the ‘when’ of the rule.

delete

delete(transaction): Promise<void>

Deletes this rule.

Input parameters
Name Description Type

transaction

The current Transaction

TypeDBTransaction

Returns

Promise<void>

Code examples
rule.delete(transaction)

isDeleted

isDeleted(transaction): Promise<boolean>

Check if this rule has been deleted.

Input parameters
Name Description Type

transaction

The current Transaction

TypeDBTransaction

Returns

Promise<boolean>

Code examples
rule.isDeleted(transaction)

setLabel

setLabel(transaction, label): Promise<void>

Renames the label of the rule. The new label must remain unique.

Input parameters
Name Description Type

transaction

The current Transaction

TypeDBTransaction

label

string

Returns

Promise<void>

Code examples
rule.setLabel(transaction, newLabel)

Errors

TypeDBDriverError

Supertypes:

  • Error

Errors encountered when interacting with TypeDB

Fields
Name Type Description

message

string

name

string

prepareStackTrace

any

stack

string

stackTraceLimit

number

messageTemplate

get messageTemplate(): ErrorMessage

Returns the message template for this error.

Returns

ErrorMessage

captureStackTrace

captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Input parameters
Name Description Type

targetObject

object

constructorOpt

Function

Returns

void

new TypeDBDriverError

new TypeDBDriverError(error): TypeDBDriverError
Input parameters
Name Description Type

error

string | ErrorMessage | Error | ServiceError

Returns

TypeDBDriverError

ErrorMessage

Class defining the error-code and message template for TypeDBDriverErrors

code

code(): string

Retrieves the error-code for this ErrorMessage

Returns

string

message

message(...args): string

Generates the error message by substituting args into the messageTemplate

Input parameters
Name Description Type

args

The format arguments to the message-template.

Stringable[]

Returns

string

new ErrorMessage

new ErrorMessage(codePrefix, codeNumber, messagePrefix, messageBody): ErrorMessage
Input parameters
Name Description Type

codePrefix

string

codeNumber

number

messagePrefix

string

messageBody

((args) ⇒ string)

Returns

ErrorMessage

toString

toString(): string

Summarises the error into a string

Returns

string

Provide Feedback