Officially out now: The TypeDB 3.0 Roadmap >>

C++ driver API reference

Connection

Driver

Package: TypeDB

A connection to a TypeDB server which serves as the starting point for all interaction.

Fields
Name Type Description

databases

DatabaseManager TypeDB::Driver

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

users

UserManager TypeDB::Driver

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

close

void TypeDB::Driver::close()

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

Returns

void

Code examples
driver.close()

cloudDriver

static Driver TypeDB::Driver::cloudDriver(const std::vector< std::string >& addresses, const Credential& credential)

Open a TypeDB Driver to TypeDB Cloud server(s) available at the provided addresses, using the provided credential.

Input parameters
Name Description Type

addresses

The address(es) of the TypeDB server(s) or translation map from addresses to be used by the driver for connection to addresses received from the TypeDB server(s)

const std::vector< std::string >&

credential

The Credential to connect with

const Credential&

Returns

static Driver

Code examples
Driver::cloudDriver(addresses, credential);

coreDriver

static Driver TypeDB::Driver::coreDriver(const std::string& address)

Open a TypeDB Driver to a TypeDB Core server available at the provided address.

Input parameters
Name Description Type

address

The address of the TypeDB server

const std::string&

Returns

static Driver

Code examples
Driver::coreDriver(address);

initLogging

static void TypeDB::Driver::initLogging()

Enables logging in the TypeDB driver.

Returns

static void

Code examples
Driver::initLogging();

isOpen

bool TypeDB::Driver::isOpen()

Checks whether this connection is presently open.

Returns

bool

Code examples
driver.isOpen();

session

Session TypeDB::Driver::session(const std::string& database, SessionType sessionType, const Options& options = Options())

Opens a communication tunnel (session) to the given database on the running TypeDB server. For more information on the methods, available with sessions, see the TypeDBSession section.

Input parameters
Name Description Type

database

The name of the database with which the session connects

const std::string&

type

The type of session to be created (DATA or SCHEMA)

options

TypeDBOptions for the session

Returns

Session

Code examples
driver.session(database, sessionType, options);

user

User TypeDB::Driver::user()

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

Returns

User

Code examples
driver.user();

Credential

Package: TypeDB

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

Examples
// Creates a credential with username & password over a plain-text connection.
Credential credential(username, password, false);

// Creates a credential as above, but the connection will be made over TLS.
Credential credential(username, password, true);

// Creates a credential as above, but TLS will use the specified CA to authenticate server certificates.
Credential credential(username, password, "path/to/ca-certificate.pem");

Credential

TypeDB::Credential::Credential(const std::string& username, const std::string& password, bool withTLS, const std::string& customRootCAPath = "")
Input parameters
Name Description Type

username

The name of the user to connect as

const std::string&

password

The password for the user

const std::string&

withTLS

Specify whether the connection to TypeDB Cloud must be done over TLS

bool

customRootCAPath

Optional, Path to a custom CA certificate to use for authenticating server certificates.

Returns

TypeDB::Credential::Credential

DatabaseManager

Package: TypeDB

Provides access to all database management methods.

all

DatabaseIterable TypeDB::DatabaseManager::all() const

Retrieves all databases present on the TypeDB server

Returns

DatabaseIterable

Code examples
driver.databases.all()

contains

bool TypeDB::DatabaseManager::contains(const std::string&) const

Checks if a database with the given name exists

Input parameters
Name Description Type

name

The database name to be checked

Returns

bool

Code examples
driver.databases.contains(name)

create

void TypeDB::DatabaseManager::create(const std::string&) const

Create a database with the given name

Input parameters
Name Description Type

name

The name of the database to be created

Returns

void

Code examples
driver.databases.create(name)

get

Database TypeDB::DatabaseManager::get(const std::string&) const

Retrieve the database with the given name.

Input parameters
Name Description Type

name

The name of the database to retrieve

Returns

Database

Code examples
driver.databases.get(name)

Database

Package: TypeDB

A TypeDB database.

deleteDatabase

void TypeDB::Database::deleteDatabase()

Deletes this database.

Returns

void

Code examples
database.deleteDatabase()

name

std::string TypeDB::Database::name() const

The database name as a string.

Returns

std::string

preferredReplica

std::optional< ReplicaInfo > TypeDB::Database::preferredReplica()

Returns 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

Returns

std::optional< ReplicaInfo >

Code examples
database.preferredReplica()

primaryReplica

std::optional< ReplicaInfo > TypeDB::Database::primaryReplica()

Returns the primary replica for this database. Only works in TypeDB Cloud

Returns

std::optional< ReplicaInfo >

Code examples
database.primaryReplica()

replicas

ReplicaInfoIterable TypeDB::Database::replicas()

Set of Replica instances for this database. Only works in TypeDB Cloud

Returns

ReplicaInfoIterable

Code examples
database.replicas()

ruleSchema

std::string TypeDB::Database::ruleSchema()

The rules in the schema as a valid TypeQL define query string.

Returns

std::string

Code examples
database.ruleSchema()

schema

std::string TypeDB::Database::schema()

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

Returns

std::string

Code examples
database.schema()

typeSchema

std::string TypeDB::Database::typeSchema()

The types in the schema as a valid TypeQL define query string.

Returns

std::string

Code examples
database.typeSchema()

ReplicaInfo

Package: TypeDB

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

isPreferred

bool TypeDB::ReplicaInfo::isPreferred()

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.

Returns

bool

isPrimary

bool TypeDB::ReplicaInfo::isPrimary()

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

Returns

bool

server

std::string TypeDB::ReplicaInfo::server()

The server hosting this replica

Returns

std::string

term

int64_t TypeDB::ReplicaInfo::term()

The raft protocol ‘term’ of this replica.

Returns

int64_t

UserManager

Package: TypeDB

Provides access to all user management methods.

all

UserIterable TypeDB::UserManager::all() const

Retrieves all users which exist on the TypeDB server.

Returns

UserIterable

Code examples
driver.users.all();

contains

bool TypeDB::UserManager::contains(const std::string& username) const

Checks if a user with the given name exists.

Input parameters
Name Description Type

username

The user name to be checked

const std::string&

Returns

bool

Code examples
driver.users.contains(username);

create

void TypeDB::UserManager::create(const std::string& username, const std::string& password) const

Creates a user with the given name & password.

Input parameters
Name Description Type

username

The name of the user to be created

const std::string&

password

The password of the user to be created

const std::string&

Returns

void

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

deleteUser

void TypeDB::UserManager::deleteUser(const std::string& username) const

Deletes a user with the given name.

Input parameters
Name Description Type

username

The name of the user to be deleted

const std::string&

Returns

void

Code examples
driver.users.deleteUser(username);

get

std::unique_ptr< User > TypeDB::UserManager::get(const std::string& username) const

Retrieves a user with the given name.

Input parameters
Name Description Type

username

The name of the user to retrieve

const std::string&

Returns

std::unique_ptr< User >

Code examples
driver.users.get(username);

passwordSet

void TypeDB::UserManager::passwordSet(const std::string& username, const std::string& password) const

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

Input parameters
Name Description Type

username

The name of the user to set the password of

const std::string&

password

The new password

const std::string&

Returns

void

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

User

Package: TypeDB

TypeDB user information.

passwordExpirySeconds

std::optional< int64_t > TypeDB::User::passwordExpirySeconds()

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

Returns

std::optional< int64_t >

passwordUpdate

void TypeDB::User::passwordUpdate(const UserManager& userManager, const std::string& passwordOld, const std::string& passwordNew)

Updates the password for this user.

Input parameters
Name Description Type

passwordOld

The current password of this user

const std::string&

passwordNew

The new password

const std::string&

Returns

void

username

std::string TypeDB::User::username()

Returns the name of this user.

Returns

std::string

Session

Session

Package: TypeDB

A session with a TypeDB database.

close

void TypeDB::Session::close()

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

Returns

void

Code examples
session.close();

databaseName

std::string TypeDB::Session::databaseName() const

Returns the name of the database of the session.

Returns

std::string

Code examples
session.databaseName();

isOpen

bool TypeDB::Session::isOpen() const

Checks whether this session is open.

Returns

bool

Code examples
session.isOpen();

onClose

void TypeDB::Session::onClose(std::function< void()> callback)

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

Input parameters
Name Description Type

function

The callback function.

Returns

void

Code examples
session.onClose(function)

onReopen

void TypeDB::Session::onReopen(std::function< void()> callback)

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

function

The callback function.

Returns

void

Code examples
session.onReopen(function)

transaction

Transaction TypeDB::Session::transaction(TransactionType type, const Options& options = Options()) const

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

Input parameters
Name Description Type

type

The type of transaction to be created (READ or WRITE)

TransactionType

options

Options for the session

Returns

Transaction

Code examples
session.transaction(transactionType, options);

type

SessionType TypeDB::Session::type() const

The current session’s type (SCHEMA or DATA)

Returns

SessionType

SessionType

Package: TypeDB

Used to specify the type of the session.

Examples
driver.session(database, TypeDBSession.Type.SCHEMA);
Enum constants
Name

DATA

SCHEMA

Options

Package: TypeDB

TypeDB Session and Transaction options.

Options can be used to override the default server behaviour.

Options

TypeDB::Options::Options()

Produces a new Options object.

Returns

TypeDB::Options::Options

Code examples
TypeDBOptions options = TypeDBOptions();

explain

std::optional< bool > TypeDB::Options::explain()

Returns the value set for the explanation in this TypeDBOptions object. If set to true, explanations for queries are enabled.

Returns

std::optional< bool >

Code examples
options.explain();

explain

Options& TypeDB::Options::explain(bool explain)

Explicitly enables or disables explanations. If set to true, enables explanations for queries. Only affects read transactions.

Input parameters
Name Description Type

explain

Explicitly enable or disable explanations

bool

Returns

Options&

Code examples
options.explain(explain);

infer

std::optional< bool > TypeDB::Options::infer()

Returns the value set for the inference in this TypeDBOptions object.

Returns

std::optional< bool >

Code examples
options.infer();

infer

Options& TypeDB::Options::infer(bool infer)

Explicitly enables or disables inference. Only settable at transaction level and above. Only affects read transactions.

Input parameters
Name Description Type

infer

Explicitly enable or disable inference

bool

Returns

Options&

Code examples
options.infer(infer);

parallel

std::optional< bool > TypeDB::Options::parallel()

Returns the value set for the parallel execution in this TypeDBOptions object. If set to true, the server uses parallel instead of single-threaded execution.

Returns

std::optional< bool >

Code examples
options.parallel();

parallel

Options& TypeDB::Options::parallel(bool parallel)

Explicitly enables or disables parallel execution. If set to true, the server uses parallel instead of single-threaded execution.

Input parameters
Name Description Type

parallel

Explicitly enable or disable parallel execution

bool

Returns

Options&

Code examples
options.parallel(parallel);

prefetch

std::optional< bool > TypeDB::Options::prefetch()

Returns the value set for the prefetching in this TypeDBOptions object. If set to true, the first batch of answers is streamed to the driver even without an explicit request for it.

Returns

std::optional< bool >

Code examples
options.prefetch();

prefetch

Options& TypeDB::Options::prefetch(bool prefetch)

Explicitly enables or disables prefetching. If set to true, the first batch of answers is streamed to the driver even without an explicit request for it.

Input parameters
Name Description Type

prefetch

Explicitly enable or disable prefetching

bool

Returns

Options&

Code examples
options.prefetch(prefetch);

prefetchSize

std::optional< int32_t > TypeDB::Options::prefetchSize()

Returns the value set for the prefetch size in this TypeDBOptions object. If set, specifies a guideline number of answers that the server should send before the driver issues a fresh request.

Returns

std::optional< int32_t >

Code examples
options.prefetchSize();

prefetchSize

Options& TypeDB::Options::prefetchSize(int32_t prefetchSize)

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

Input parameters
Name Description Type

prefetchSize

Number of answers that the server should send before the driver issues a fresh request

int32_t

Returns

Options&

Code examples
options.prefetchSize(prefetchSize);

readAnyReplica

std::optional< bool > TypeDB::Options::readAnyReplica()

Returns the value set for reading data from any replica in this TypeDBOptions object. If set to True, enables reading data from any replica, potentially boosting read throughput.

Returns

std::optional< bool >

Code examples
options.readAnyReplica();

readAnyReplica

Options& TypeDB::Options::readAnyReplica(bool readAnyReplica)

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

Input parameters
Name Description Type

readAnyReplica

Explicitly enable or disable reading data from any replica

bool

Returns

Options&

Code examples
options.readAnyReplica(readAnyReplica);

schemaLockAcquireTimeoutMillis

std::optional< int64_t > TypeDB::Options::schemaLockAcquireTimeoutMillis()

Returns the value set for the schema lock acquire timeout in this TypeDBOptions object. If set, specifies how long the driver should wait if opening a session or transaction is blocked by a schema write lock.

Returns

std::optional< int64_t >

Code examples
options.schemaLockAcquireTimeoutMillis();

schemaLockAcquireTimeoutMillis

Options& TypeDB::Options::schemaLockAcquireTimeoutMillis(int64_t timeoutMillis)

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

Input parameters
Name Description Type

schemaLockAcquireTimeoutMillis

How long the driver should wait if opening a session or transaction is blocked by a schema write lock

Returns

Options&

Code examples
options.schemaLockAcquireTimeoutMillis(schemaLockAcquireTimeoutMillis);

sessionIdleTimeoutMillis

std::optional< int64_t > TypeDB::Options::sessionIdleTimeoutMillis()

Returns the value set for the session idle timeout in this TypeDBOptions object. If set, specifies a timeout that allows the server to close sessions if the driver terminates or becomes unresponsive.

Returns

std::optional< int64_t >

Code examples
options.sessionIdleTimeoutMillis();

sessionIdleTimeoutMillis

Options& TypeDB::Options::sessionIdleTimeoutMillis(int64_t timeoutMillis)

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

Input parameters
Name Description Type

sessionIdleTimeoutMillis

timeout that allows the server to close sessions if the driver terminates or becomes unresponsive

Returns

Options&

Code examples
options.sessionIdleTimeoutMillis(sessionIdleTimeoutMillis);

traceInference

std::optional< bool > TypeDB::Options::traceInference()

Returns the value set for reasoning tracing in this TypeDBOptions object. If set to true, reasoning tracing graphs are output in the logging directory.

Returns

std::optional< bool >

Code examples
options.traceInference();

traceInference

Options& TypeDB::Options::traceInference(bool traceInference)

Explicitly enables or disables reasoning tracing. If set to true, reasoning tracing graphs are output in the logging directory. Should be used with parallel = False.

Input parameters
Name Description Type

traceInference

Explicitly enable or disable reasoning tracing

bool

Returns

Options&

Code examples
options.traceInference(traceInference);

transactionTimeoutMillis

std::optional< int64_t > TypeDB::Options::transactionTimeoutMillis()

Returns the value set for the transaction timeout in this TypeDBOptions object. If set, specifies a timeout for killing transactions automatically, preventing memory leaks in unclosed transactions.

Returns

std::optional< int64_t >

Code examples
options.transactionTimeoutMillis();

transactionTimeoutMillis

Options& TypeDB::Options::transactionTimeoutMillis(int64_t timeoutMillis)

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

Input parameters
Name Description Type

transactionTimeoutMillis

Timeout for killing transactions automatically

Returns

Options&

Code examples
options.transactionTimeoutMillis(transactionTimeoutMillis);

Transaction

Transaction

Package: TypeDB

A transaction with a TypeDB database.

Fields
Name Type Description

concepts

const ConceptManager TypeDB::Transaction

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

logic

const LogicManager TypeDB::Transaction

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

query

const QueryManager TypeDB::Transaction

The`QueryManager` for this Transaction, from which any TypeQL query can be executed.

close

void TypeDB::Transaction::close()

Closes the transaction.

Returns

void

Code examples
transaction.close()

commit

void TypeDB::Transaction::commit()

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

void

Code examples
transaction.commit()

forceClose

void TypeDB::Transaction::forceClose()

Closes the transaction.

Returns

void

Code examples
transaction.close()

isOpen

bool TypeDB::Transaction::isOpen() const

Checks whether this transaction is open.

Returns

bool

Code examples
transaction.isOpen();

onClose

void TypeDB::Transaction::onClose(std::function< void(const std::optional< DriverException >&)> callback)

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

Input parameters
Name Description Type

function

The callback function.

Returns

void

Code examples
transaction.onClose(function);

rollback

void TypeDB::Transaction::rollback()

Rolls back the uncommitted changes made via this transaction.

Returns

void

Code examples
transaction.rollback()

type

TypeDB::TransactionType TypeDB::Transaction::type() const

The transaction’s type (READ or WRITE)

Returns

TypeDB::TransactionType

TransactionType

Package: TypeDB

Used to specify the type of transaction.

Examples
session.transaction(TransactionType.READ);
Enum constants
Name

READ

WRITE

QueryManager

Package: TypeDB

Provides methods for executing TypeQL queries in the transaction.

define

VoidFuture TypeDB::QueryManager::define(const std::string& query, const Options& options = Options()) const

Performs a TypeQL Define query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Define query to be executed

const std::string&

options

Specify query options

Returns

VoidFuture

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

explain

ExplanationIterable TypeDB::QueryManager::explain(const Explainable& explainable, const Options& = Options()) const

Performs a TypeQL Explain query in the transaction.

Input parameters
Name Description Type

explainable

The Explainable to be explained

const Explainable&

options

Specify query options

Returns

ExplanationIterable

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

fetch

JSONIterable TypeDB::QueryManager::fetch(const std::string& query, const Options& options = Options()) const

Performs a TypeQL Fetch query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Fetch query to be executed

const std::string&

options

Specify query options

Returns

JSONIterable

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

get

ConceptMapIterable TypeDB::QueryManager::get(const std::string& query, const Options& options = Options()) const

Performs a TypeQL Get query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get query to be executed

const std::string&

options

Specify query options

Returns

ConceptMapIterable

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

getAggregate

AggregateFuture TypeDB::QueryManager::getAggregate(const std::string& query, const Options& = Options()) const

Performs a TypeQL Get Aggregate query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get Aggregate query to be executed

const std::string&

options

Specify query options

Returns

AggregateFuture

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

getGroup

ConceptMapGroupIterable TypeDB::QueryManager::getGroup(const std::string& query, const Options& = Options()) const

Performs a TypeQL Get Group query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get Group query to be executed

const std::string&

options

Specify query options

Returns

ConceptMapGroupIterable

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

getGroupAggregate

ValueGroupIterable TypeDB::QueryManager::getGroupAggregate(const std::string& query, const Options& = Options()) const

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

const std::string&

options

Specify query options

Returns

ValueGroupIterable

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

insert

ConceptMapIterable TypeDB::QueryManager::insert(const std::string& query, const Options& options = Options()) const

Performs a TypeQL Insert query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Insert query to be executed

const std::string&

options

Specify query options

Returns

ConceptMapIterable

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

matchDelete

VoidFuture TypeDB::QueryManager::matchDelete(const std::string& query, const Options& options = Options()) const

Performs a TypeQL Delete query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Delete query to be executed

const std::string&

options

Specify query options

Returns

VoidFuture

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

undefine

VoidFuture TypeDB::QueryManager::undefine(const std::string& query, const Options& options = Options()) const

Performs a TypeQL Undefine query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Undefine query to be executed

const std::string&

options

Specify query options

Returns

VoidFuture

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

update

ConceptMapIterable TypeDB::QueryManager::update(const std::string& query, const Options& = Options()) const

Performs a TypeQL Update query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Update query to be executed

const std::string&

options

Specify query options

Returns

ConceptMapIterable

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

Answer

ConceptMapGroup

Package: TypeDB

Contains an element of the group query result.

conceptMaps

ConceptMapIterable TypeDB::ConceptMapGroup::conceptMaps()

Retrieves the ConceptMaps of the group.

Returns

ConceptMapIterable

Code examples
conceptMapGroup.conceptMaps();

owner

std::unique_ptr< Concept > TypeDB::ConceptMapGroup::owner()

Retrieves the concept that is the group owner.

Returns

std::unique_ptr< Concept >

Code examples
conceptMapGroup.owner();

toString

std::string TypeDB::ConceptMapGroup::toString()

A string representation of this ConceptMapGroup.

Returns

std::string

ConceptMap

Package: TypeDB

Contains a mapping of variables to concepts.

concepts

ConceptIterable< Concept > TypeDB::ConceptMap::concepts()

Produces an Iterator over all concepts in this ConceptMap.

Returns

ConceptIterable< Concept >

Code examples
conceptMap.concepts();

explainables

Explainables TypeDB::ConceptMap::explainables()

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

Returns

Explainables

Code examples
conceptMap.explainables();

get

std::unique_ptr< Concept > TypeDB::ConceptMap::get(const std::string& variableName)

Retrieves a concept for a given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

Returns

std::unique_ptr< Concept >

Code examples
conceptMap.get(variable);

map

std::map< std::string, std::unique_ptr< Concept > > TypeDB::ConceptMap::map()

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

Returns

std::map< std::string, std::unique_ptr< Concept > >

Code examples
conceptMap.map();

toString

std::string TypeDB::ConceptMap::toString()

A string representation of this ConceptMap.

Returns

std::string

variables

StringIterable TypeDB::ConceptMap::variables()

Produces an Iterator stream over all variables in this ConceptMap.

Returns

StringIterable

Code examples
conceptMap.variables();

ValueGroup

Package: TypeDB

Contains an element of the group aggregate query result.

owner

std::unique_ptr< Concept > TypeDB::ValueGroup::owner()

Retrieves the concept that is the group owner.

Returns

std::unique_ptr< Concept >

Code examples
conceptMapGroup.owner()

toString

std::string TypeDB::ValueGroup::toString()

A string representation of this ConceptMap.

Returns

std::string

value

AggregateResult TypeDB::ValueGroup::value()

Retrieves the Value answer of the group.

Returns

AggregateResult

Code examples
valueGroup.value();

JSON

Package: TypeDB

Simple JSON structure for results of fetch queries.

asArray

const JSONArray& TypeDB::JSON::asArray() const

if this JSON object holds an array, returns the underlying array. Else throws an exception

Returns

const JSONArray&

asBoolean

const JSONBoolean& TypeDB::JSON::asBoolean() const

if this JSON object holds a boolean value, returns the value. Else throws an exception

Returns

const JSONBoolean&

asDouble

const JSONDouble& TypeDB::JSON::asDouble() const

if this JSON object holds a double value, returns the value. Else throws an exception

Returns

const JSONDouble&

asLong

const JSONLong& TypeDB::JSON::asLong() const

if this JSON object holds a long value, returns the value. Else throws an exception

Returns

const JSONLong&

asMap

const JSONMap& TypeDB::JSON::asMap() const

if this JSON object holds a map, returns the underlying map. Else throws an exception

Returns

const JSONMap&

asString

const JSONString& TypeDB::JSON::asString() const

if this JSON object holds a string value, returns the value. Else throws an exception

Returns

const JSONString&

isArray

bool TypeDB::JSON::isArray() const

true if this JSON object holds an array, else false

Returns

bool

isBoolean

bool TypeDB::JSON::isBoolean() const

true if this JSON object holds a boolean value, else false

Returns

bool

isDouble

bool TypeDB::JSON::isDouble() const

true if this JSON object holds a double value, else false

Returns

bool

isLong

bool TypeDB::JSON::isLong() const

true if this JSON object holds a long value, else false

Returns

bool

isMap

bool TypeDB::JSON::isMap() const

true if this JSON object holds a map, else false

Returns

bool

isString

bool TypeDB::JSON::isString() const

true if this JSON object holds a string value, else false

Returns

bool

parse

static JSON TypeDB::JSON::parse(const std::string& string)

Parses a JSON string into a JSON object.

Returns

static JSON

toString

const std::string TypeDB::JSON::toString() const

Convert a JSON object to a string

Returns

const std::string

type

JSONType TypeDB::JSON::type() const

The JSONType of this JSON object

Returns

JSONType

Code examples
switch(json.type() { ... }

JSONType

Package: TypeDB

Specifies the exact type of this JSON object

Enum constants
Name

ARRAY

BOOLEAN

DOUBLE

INVALID

LONG

MAP

NULL_VALUE

STRING

OwnerAttributePair

Package: TypeDB

Simple class holding the owner concept & owned attribute identifying an explainable ownership.

Fields
Name Type Description

attribute

std::string TypeDB::OwnerAttributePair

The owned attribute.

owner

std::string TypeDB::OwnerAttributePair

The owner concept.

Explainables

Package: TypeDB

Contains explainable objects.

attribute

Explainable TypeDB::Explainables::attribute(std::string& variable)

Retrieves the explainable attribute with the given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

std::string&

Returns

Explainable

Code examples
conceptMap.explainables().attribute(variable);

attributes

StringIterable TypeDB::Explainables::attributes()

Retrieves all of this ConceptMap’s explainable attributes.

Returns

StringIterable

Code examples
conceptMap.explainables().attributes();

ownership

Explainable TypeDB::Explainables::ownership(std::string& owner, std::string& attribute)

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

std::string&

attribute

The string representation of the attribute variable

std::string&

Returns

Explainable

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

ownerships

OwnerAttributePairIterable TypeDB::Explainables::ownerships()

Retrieves all of this ConceptMap’s explainable ownerships.

Returns

OwnerAttributePairIterable

Code examples
conceptMap.explainables().ownerships();

relation

Explainable TypeDB::Explainables::relation(std::string& variable)

Retrieves the explainable relation with the given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

std::string&

Returns

Explainable

Code examples
conceptMap.explainables().relation(variable);

relations

StringIterable TypeDB::Explainables::relations()

Retrieves all of this ConceptMap’s explainable relations.

Returns

StringIterable

Code examples
conceptMap.explainables().relations();

toString

std::string TypeDB::Explainables::toString()

A string representation of this object.

Returns

std::string

Explainable

Package: TypeDB

Contains an explainable object.

conjunction

std::string TypeDB::Explainable::conjunction()

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

Returns

std::string

Code examples
explainable.conjunction();

explainableId

int64_t TypeDB::Explainable::explainableId()

Retrieves the unique ID that identifies this Explainable.

Returns

int64_t

Code examples
explainable.id();

Explanation

Package: TypeDB

An explanation of which rule was used to infer the concept and the satisfying ConceptMaps.

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.

conclusion

ConceptMap TypeDB::Explanation::conclusion()

Retrieves the Conclusion for this Explanation.

Returns

ConceptMap

Code examples
explanation.conclusion()

condition

ConceptMap TypeDB::Explanation::condition()

Retrieves the Condition for this Explanation.

Returns

ConceptMap

Code examples
explanation.condition()

queryVariableMapping

std::vector< std::string > TypeDB::Explanation::queryVariableMapping(const std::string& var)

Retrieves the rule variables corresponding to the query variable var for this Explanation.

Input parameters
Name Description Type

var

The query variable to map to rule variables.

const std::string&

Returns

std::vector< std::string >

Code examples
explanation.variableMapping(var)

queryVariables

std::vector< std::string > TypeDB::Explanation::queryVariables()

Retrieves the query variables for this Explanation.

Returns

std::vector< std::string >

Code examples
explanation.queryVariables()

rule

Rule TypeDB::Explanation::rule()

Retrieves the Rule for this Explanation.

Returns

Rule

Code examples
explanation.rule()

toString

std::string TypeDB::Explanation::toString()

A string representation of this Explanation.

Returns

std::string

Future

Package: TypeDB

A structure emulating std::future, used as result of an asynchronous call to the server.

Note that a future must be evaluated for any server-side exceptions to be raised.

get

RETURN TypeDB::Future< RETURN, NATIVE_PROMISE, HELPER >::get()

Waits for the call to complete and returns the result.

Returns

RETURN

wait

void TypeDB::Future< RETURN, NATIVE_PROMISE, HELPER >::wait()

Waits for the call to complete and ignores the result. Any exceptions will still be thrown.

Returns

void

Iterable

Package: TypeDB

Result representing a stream of query results.

Exposes begin() to get an iterator over the results and end() to check if the end has been reached. Note: begin() must be called for any server-side exceptions encountered while evaluating the query to be thrown

Examples
for (auto& element : iterable) { ... }
for (auto it = iterable.begin(); it != iterable.end(); ++it ) { ... } // Note: it++ is deleted.

begin

ITERATOR TypeDB::Iterable< NATIVE_ITER, NATIVE_T, T, HELPER >::begin()

Returns an iterator pointing to the first element.

Returns

ITERATOR

end

ITERATOR TypeDB::Iterable< NATIVE_ITER, NATIVE_T, T, HELPER >::end()

Returns an iterator equivalent to the result of advancing past the last element.

Returns

ITERATOR

Iterator

Package: TypeDB

A structure emulating std::iterator, used for streaming of query results from the server.

It is an input_iterator, meaning it can only be consumed once. Valid operations are ++it and *it

Note that it++ is deleted, and *it can only be called once per iterator position, owing to the move semantics of the returned data.

Also see Iterable

Aliases

ConceptMapIterator

Alias for Iterator<_native::ConceptMapIterator, _native::ConceptMap, TypeDB::ConceptMap>

ConceptMapIterable

Alias for Iterable<_native::ConceptMapIterator, _native::ConceptMap, TypeDB::ConceptMap>

ConceptMapGroupIterable

Alias for Iterable<_native::ConceptMapGroupIterator, _native::ConceptMapGroup, TypeDB::ConceptMapGroup>

ConceptMapGroupIterator

Alias for Iterator<_native::ConceptMapGroupIterator, _native::ConceptMapGroup, TypeDB::ConceptMapGroup>

OwnerAttributePairIterator

Alias for Iterator<_native::StringPairIterator, _native::StringPair, OwnerAttributePair>

OwnerAttributePairIterable

Alias for Iterable<_native::StringPairIterator, _native::StringPair, OwnerAttributePair>

JSONMap

Alias for std::map<std::string, JSON>

JSONArray

Alias for std::vector<JSON>

JSONBoolean

Alias for bool

JSONLong

Alias for long

JSONDouble

Alias for double

JSONString

Alias for std::string

AggregateResult

Alias for std::optional<std::unique_ptr<Value>>

AggregateFuture

Alias for Future<AggregateResult, _native::ConceptPromise>

ValueGroupIterable

Alias for Iterable<_native::ValueGroupIterator, _native::ValueGroup, TypeDB::ValueGroup>

ValueGroupIterator

Alias for Iterator<_native::ValueGroupIterator, _native::ValueGroup, TypeDB::ValueGroup>

VoidFuture

Alias for Future<void, _native::VoidPromise>

BoolFuture

Alias for Future<bool, _native::BoolPromise>

StringFuture

Alias for Future<std::string, _native::StringPromise>

OptionalStringFuture

Alias for Future<std::optional<std::string>, _native::StringPromise>

StringIterable

Alias for Iterable<_native::StringIterator, char, std::string>

StringIterator

Alias for Iterator<_native::StringIterator, char, std::string>

DateTime

Alias for std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>

DatabaseIterator

Alias for Iterator<_native::DatabaseIterator, _native::Database, TypeDB::Database>

DatabaseIterable

Alias for Iterable<_native::DatabaseIterator, _native::Database, TypeDB::Database>

ReplicaInfoIterable

Alias for Iterable<_native::ReplicaInfoIterator, _native::ReplicaInfo, ReplicaInfo>

ReplicaInfoIterator

Alias for Iterator<_native::ReplicaInfoIterator, _native::ReplicaInfo, ReplicaInfo>

ExplanationIterator

Alias for Iterator<_native::ExplanationIterator, _native::Explanation, Explanation>

ExplanationIterable

Alias for Iterable<_native::ExplanationIterator, _native::Explanation, Explanation>

RuleFuture

Alias for Future<Rule, _native::RulePromise>

OptionalRuleFuture

Alias for Future<std::optional<Rule>, _native::RulePromise>

RuleIterable

Alias for Iterable<_native::RuleIterator, _native::Rule, Rule>

RuleIterator

Alias for Iterator<_native::RuleIterator, _native::Rule, Rule>

JSONIterable

Alias for Iterable<_native::StringIterator, char, JSON>

UserIterator

Alias for Iterator<_native::UserIterator, _native::User, User>

UserIterable

Alias for Iterable<_native::UserIterator, _native::User, User>

Concept

ConceptManager

Package: TypeDB

Provides access for all Concept API methods.

getAttribute

ConceptPtrFuture< Attribute > TypeDB::ConceptManager::getAttribute(const std::string& iid) const

Retrieves an Attribute by its iid.

Input parameters
Name Description Type

iid

The iid of the Attribute to retrieve

const std::string&

Returns

ConceptPtrFuture< Attribute >

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

getAttributeType

ConceptPtrFuture< AttributeType > TypeDB::ConceptManager::getAttributeType(const std::string& label) const

Retrieves an AttributeType by its label.

Input parameters
Name Description Type

label

The label of the AttributeType to retrieve

const std::string&

Returns

ConceptPtrFuture< AttributeType >

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

getEntity

ConceptPtrFuture< Entity > TypeDB::ConceptManager::getEntity(const std::string& iid) const

Retrieves an Entity by its iid.

Input parameters
Name Description Type

iid

The iid of the Entity to retrieve

const std::string&

Returns

ConceptPtrFuture< Entity >

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

getEntityType

ConceptPtrFuture< EntityType > TypeDB::ConceptManager::getEntityType(const std::string& label) const

Retrieves an EntityType by its label.

Input parameters
Name Description Type

label

The label of the EntityType to retrieve

const std::string&

Returns

ConceptPtrFuture< EntityType >

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

getRelation

ConceptPtrFuture< Relation > TypeDB::ConceptManager::getRelation(const std::string& iid) const

Retrieves a Relation by its iid.

Input parameters
Name Description Type

iid

The iid of the Relation to retrieve

const std::string&

Returns

ConceptPtrFuture< Relation >

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

getRelationType

ConceptPtrFuture< RelationType > TypeDB::ConceptManager::getRelationType(const std::string& label) const

Retrieves a RelationType by its label.

Input parameters
Name Description Type

label

The label of the RelationType to retrieve

const std::string&

Returns

ConceptPtrFuture< RelationType >

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

getRootAttributeType

std::unique_ptr< AttributeType > TypeDB::ConceptManager::getRootAttributeType() const

Retrieve the root AttributeType, “attribute”.

Returns

std::unique_ptr< AttributeType >

Code examples
transaction.concepts.getRootAttributeType();

getRootEntityType

std::unique_ptr< EntityType > TypeDB::ConceptManager::getRootEntityType() const

Retrieves the root EntityType, “entity”.

Returns

std::unique_ptr< EntityType >

Code examples
transaction.concepts.getRootEntityType();

getRootRelationType

std::unique_ptr< RelationType > TypeDB::ConceptManager::getRootRelationType() const

Retrieve the root RelationType, “relation”.

Returns

std::unique_ptr< RelationType >

Code examples
transaction.concepts.getRootRelationType();

getSchemaExceptions

std::vector< DriverException > TypeDB::ConceptManager::getSchemaExceptions()

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

Returns

std::vector< DriverException >

Code examples
transaction.concepts.getSchemaExceptions();

putAttributeType

ConceptPtrFuture< AttributeType > TypeDB::ConceptManager::putAttributeType(const std::string& label, ValueType valueType) const

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

Input parameters
Name Description Type

label

The label of the AttributeType to create or retrieve

const std::string&

valueType

The value type of the AttributeType to create

ValueType

Returns

ConceptPtrFuture< AttributeType >

Code examples
transaction.concepts.putAttributeType(label, valueType).get();

putEntityType

ConceptPtrFuture< EntityType > TypeDB::ConceptManager::putEntityType(const std::string& label) const

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

const std::string&

Returns

ConceptPtrFuture< EntityType >

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

putRelationType

ConceptPtrFuture< RelationType > TypeDB::ConceptManager::putRelationType(const std::string& label) const

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

const std::string&

Returns

ConceptPtrFuture< RelationType >

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

Concept

Package: TypeDB

The fundamental TypeQL object. A Concept is either a Type, Thing, or Value.

asAttribute

Attribute* TypeDB::Concept::asAttribute()

Casts the concept to Attribute.

Returns

Attribute*

Code examples
concept.asAttribute();

asAttributeType

AttributeType* TypeDB::Concept::asAttributeType()

Casts the concept to EntityType.

Returns

AttributeType*

Code examples
concept.asEntityType();

asEntity

Entity* TypeDB::Concept::asEntity()

Casts the concept to Entity.

Returns

Entity*

Code examples
concept.asEntity();

asEntityType

EntityType* TypeDB::Concept::asEntityType()

Casts the concept to EntityType.

Returns

EntityType*

Code examples
concept.asEntityType();

asRelation

Relation* TypeDB::Concept::asRelation()

Casts the concept to Relation.

Returns

Relation*

Code examples
concept.asRelation();

asRelationType

RelationType* TypeDB::Concept::asRelationType()

Casts the concept to RelationType.

Returns

RelationType*

Code examples
concept.asRelationType();

asRoleType

RoleType* TypeDB::Concept::asRoleType()

Casts the concept to RoleType.

Returns

RoleType*

Code examples
concept.asRoleType();

asThing

Thing* TypeDB::Concept::asThing()

Casts the concept to Thing.

Returns

Thing*

Code examples
concept.asThing();

asThingType

ThingType* TypeDB::Concept::asThingType()

Casts the concept to ThingType.

Returns

ThingType*

Code examples
concept.asThingType();

asValue

Value* TypeDB::Concept::asValue()

Casts the concept to Value.

Returns

Value*

Code examples
concept.asValue();

equals

static bool TypeDB::Concept::equals(Concept* first, Concept* second)

Checks equality of two concepts.

Returns

static bool

getConceptType

ConceptType TypeDB::Concept::getConceptType()

Returns the ConceptType of this concept.

Returns

ConceptType

Code examples
switch(concept.getConceptType()) { ... }

isAttribute

bool TypeDB::Concept::isAttribute()

Checks if the concept is a Relation.

Returns

bool

Code examples
concept.isRelation();

isAttributeType

bool TypeDB::Concept::isAttributeType()

Checks if the concept is an AttributeType.

Returns

bool

Code examples
concept.isAttributeType();

isEntity

bool TypeDB::Concept::isEntity()

Checks if the concept is an Entity.

Returns

bool

Code examples
concept.isEntity();

isEntityType

bool TypeDB::Concept::isEntityType()

Checks if the concept is an EntityType.

Returns

bool

Code examples
concept.isEntityType();

isRelation

bool TypeDB::Concept::isRelation()

Checks if the concept is a Value.

Returns

bool

Code examples
concept.isValue();

isRelationType

bool TypeDB::Concept::isRelationType()

Checks if the concept is a RelationType.

Returns

bool

Code examples
concept.isRelationType();

isRoleType

bool TypeDB::Concept::isRoleType()

Checks if the concept is a RoleType.

Returns

bool

Code examples
concept.isRoleType();

isThing

bool TypeDB::Concept::isThing()

Checks if the concept is a Thing.

Returns

bool

Code examples
concept.isThing();

isThingType

bool TypeDB::Concept::isThingType()

Checks if the concept is a ThingType.

Returns

bool

Code examples
concept.isThingType();

isValue

bool TypeDB::Concept::isValue()

Checks if the concept is a Value.

Returns

bool

Code examples
concept.isValue();

operator==

bool TypeDB::Concept::operator==(const Concept& other)

Checks equality with the other concept.

Returns

bool

toString

std::string TypeDB::Concept::toString()

A string representation of this Concept.

Returns

std::string

ConceptType

Package: TypeDB

The exact type of a Concept object. Use for downcasting to the appropriate type.

Enum constants
Name

ATTRIBUTE

ATTRIBUTE_TYPE

ENTITY

ENTITY_TYPE

RELATION

RELATION_TYPE

ROLE_TYPE

ROOT_THING_TYPE

VALUE

Transitivity

Package: TypeDB

Used in ConceptAPI to specify whether to query only explicit schema constraints or also include transitive ones

Enum constants
Name

EXPLICIT

TRANSITIVE

Schema

Type

Package: TypeDB

Supertypes:

  • TypeDB::Concept

Common super-type of RoleType & ThingType.

deleteType

virtual VoidFuture TypeDB::Type::deleteType(Transaction& transaction)

Deletes this type from the database.

Implemented in TypeDB::RoleType, and TypeDB::ThingType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

virtual VoidFuture

Code examples
type.deleteType(transaction).get();

getLabel

virtual std::string TypeDB::Type::getLabel()

Retrieves the unique label of the type.

Implemented in TypeDB::RoleType, and TypeDB::ThingType.

Returns

virtual std::string

Code examples
type.getLabel();

getSubtypes

ConceptIterable< Type > TypeDB::Type::getSubtypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< Type >

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

getSupertype

ConceptPtrFuture< Type > TypeDB::Type::getSupertype(Transaction& transaction)

Retrieves the most immediate supertype of the type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptPtrFuture< Type >

Code examples
type.getSupertype(transaction).get();

getSupertypes

ConceptIterable< Type > TypeDB::Type::getSupertypes(Transaction& transaction)

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptIterable< Type >

Code examples
type.getSupertypes(transaction);

isAbstract

virtual bool TypeDB::Type::isAbstract()

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

Implemented in TypeDB::RoleType, and TypeDB::ThingType.

Returns

virtual bool

Code examples
type.isAbstract();

isDeleted

virtual BoolFuture TypeDB::Type::isDeleted(Transaction& transaction)

Check if the type has been deleted

Implemented in TypeDB::RoleType, and TypeDB::ThingType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

virtual BoolFuture

Code examples
type.isDeleted(transaction).get();

setLabel

virtual VoidFuture TypeDB::Type::setLabel(Transaction& transaction, const std::string& newLabel)

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

Implemented in TypeDB::RoleType, and TypeDB::ThingType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

label

The new Label to be given to the type.

Returns

virtual VoidFuture

Code examples
type.setLabel(transaction, newLabel).get();

ThingType

Package: TypeDB

Supertypes:

  • TypeDB::Type

  • TypeDB::Concept

Common super-type of EntityType, RelationType, and AttributeType.

deleteType

virtual VoidFuture TypeDB::ThingType::deleteType(Transaction& transaction)

Deletes this type from the database.

Implements TypeDB::Type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

virtual VoidFuture

Code examples
type.deleteType(transaction).get();

getLabel

virtual std::string TypeDB::ThingType::getLabel()

Retrieves the unique label of the type.

Implements TypeDB::Type.

Returns

virtual std::string

Code examples
type.getLabel();

getOwns

ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Variant of getOwns(Transaction&, ValueType, const std::vector<Annotation>&, Transitivity) without filtering on ValueType or Annotations

Returns

ConceptIterable< AttributeType >

getOwns

ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, const std::initializer_list< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)
Returns

ConceptIterable< AttributeType >

getOwns

ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, const std::vector< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)
Returns

ConceptIterable< AttributeType >

getOwns

ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, ValueType valueType, Transitivity transitivity = Transitivity::TRANSITIVE)
Returns

ConceptIterable< AttributeType >

getOwns

ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, ValueType valueType, const std::initializer_list< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)
Returns

ConceptIterable< AttributeType >

getOwns

ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, ValueType valueType, const std::vector< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)

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

Transaction&

valueType

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

ValueType

transitivity

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

annotations

Only retrieve attribute types owned with annotations.

const std::vector< Annotation >&

Returns

ConceptIterable< AttributeType >

Code examples
thingType.getOwns(transaction);
thingType.getOwns(transaction, valueType, Transitivity::EXPLICIT, Collections.singleton(Annotation.key()));

getOwnsOverridden

ConceptPtrFuture< AttributeType > TypeDB::ThingType::getOwnsOverridden(Transaction& transaction, AttributeType* attributeType)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

attributeType

The AttributeType that overrides requested AttributeType

AttributeType*

Returns

ConceptPtrFuture< AttributeType >

Code examples
thingType.getOwnsOverridden(transaction, attributeType).get();

getPlays

ConceptIterable< RoleType > TypeDB::ThingType::getPlays(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

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

Transaction&

transitivity

transitivity: Transitivity::TRANSITIVE for direct and indirect playing, Transitivity::EXPLICIT for direct playing only

Returns

ConceptIterable< RoleType >

Code examples
thingType.getPlays(transaction).get();
thingType.getPlays(transaction, Transitivity::EXPLICIT).get();

getPlaysOverridden

ConceptPtrFuture< RoleType > TypeDB::ThingType::getPlaysOverridden(Transaction& transaction, RoleType* roleType)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleType

The RoleType that overrides an inherited role

RoleType*

Returns

ConceptPtrFuture< RoleType >

Code examples
thingType.getPlaysOverridden(transaction, roleType).get();

getSubtypes

ConceptIterable< ThingType > TypeDB::ThingType::getSubtypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< ThingType >

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

getSupertype

ConceptPtrFuture< ThingType > TypeDB::ThingType::getSupertype(Transaction& transaction)

Retrieves the most immediate supertype of the type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptPtrFuture< ThingType >

Code examples
type.getSupertype(transaction).get();

getSupertypes

ConceptIterable< ThingType > TypeDB::ThingType::getSupertypes(Transaction& transaction)

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptIterable< ThingType >

Code examples
type.getSupertypes(transaction);

getSyntax

StringFuture TypeDB::ThingType::getSyntax(Transaction& transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

StringFuture

Code examples
thingType.getSyntax(transaction).get();

isAbstract

virtual bool TypeDB::ThingType::isAbstract()

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

Implements TypeDB::Type.

Returns

virtual bool

Code examples
type.isAbstract();

isDeleted

virtual BoolFuture TypeDB::ThingType::isDeleted(Transaction& transaction)

Check if the type has been deleted

Implements TypeDB::Type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

virtual BoolFuture

Code examples
type.isDeleted(transaction).get();

isRoot

bool TypeDB::ThingType::isRoot()

Checks if the type is a root type.

Returns

bool

Code examples
type.isRoot();

setAbstract

VoidFuture TypeDB::ThingType::setAbstract(Transaction& transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

VoidFuture

Code examples
thingType.setAbstract(transaction).get();

setLabel

virtual VoidFuture TypeDB::ThingType::setLabel(Transaction& transaction, const std::string& newLabel)

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

Implements TypeDB::Type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

label

The new Label to be given to the type.

Returns

virtual VoidFuture

Code examples
type.setLabel(transaction, newLabel).get();

setOwns

VoidFuture TypeDB::ThingType::setOwns(Transaction& transaction, AttributeType* attributeType, const std::initializer_list< Annotation >& annotations = {})
Returns

VoidFuture

setOwns

VoidFuture TypeDB::ThingType::setOwns(Transaction& transaction, AttributeType* attributeType, const std::vector< Annotation >& annotations)
Returns

VoidFuture

setOwns

VoidFuture TypeDB::ThingType::setOwns(Transaction& transaction, AttributeType* attributeType, AttributeType* overriddenType, const std::initializer_list< Annotation >& annotations = {})
Returns

VoidFuture

setOwns

VoidFuture TypeDB::ThingType::setOwns(Transaction& transaction, AttributeType* attributeType, AttributeType* overriddenType, const std::vector< Annotation >& annotations)

Allows the instances of this ThingType to own the given AttributeType. Optionally, overriding a previously declared ownership. Optionally, adds annotations to the ownership.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

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.

const std::vector< Annotation >&

Returns

VoidFuture

Code examples
thingType.setOwns(transaction, attributeType).get();
thingType.setOwns(transaction, attributeType, overriddenType, Collections.singleton(Annotation.key())).get();

setPlays

VoidFuture TypeDB::ThingType::setPlays(Transaction& transaction, RoleType* roleType)

Variant of setPlays(Transaction&, RoleType*, RoleType*) with no overridden role type.

Returns

VoidFuture

setPlays

VoidFuture TypeDB::ThingType::setPlays(Transaction& transaction, RoleType* roleType, RoleType* overriddenRoleType)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleType

The role to be played by the instances of this type

RoleType*

overriddenType

The role type that this role overrides, if applicable

Returns

VoidFuture

Code examples
thingType.setPlays(transaction, roleType).get();
thingType.setPlays(transaction, roleType, overriddenType).get();

unsetAbstract

VoidFuture TypeDB::ThingType::unsetAbstract(Transaction& transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

VoidFuture

Code examples
thingType.unsetAbstract(transaction).get();

unsetOwns

VoidFuture TypeDB::ThingType::unsetOwns(Transaction& transaction, AttributeType* attributeType)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

attributeType

The AttributeType to not be owned by the type.

AttributeType*

Returns

VoidFuture

Code examples
thingType.unsetOwns(transaction, attributeType).get();

unsetPlays

VoidFuture TypeDB::ThingType::unsetPlays(Transaction& transaction, RoleType* roleType)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleType

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

RoleType*

Returns

VoidFuture

Code examples
thingType.unsetPlays(transaction, roleType).get();

EntityType

Package: TypeDB

Supertypes:

  • TypeDB::ThingType

  • TypeDB::Type

  • TypeDB::Concept

Entity types represent the classification of independent objects in the data model of the business domain.

create

ConceptPtrFuture< Entity > TypeDB::EntityType::create(Transaction& transaction)

Creates and returns a new instance of this EntityType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptPtrFuture< Entity >

Code examples
entityType.create(transaction).get();

getInstances

ConceptIterable< Entity > TypeDB::EntityType::getInstances(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves Entity objects that are instances of this exact EntityType OR this EntityType and any of its subtypes.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

Transitivity::EXPLICIT for direct instances only, Transitivity::TRANSITIVE to include subtypes

Returns

ConceptIterable< Entity >

Code examples
entityType.getInstances(transaction, transitivity);

getSubtypes

ConceptIterable< EntityType > TypeDB::EntityType::getSubtypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< EntityType >

Code examples
entityType.getSubtypes(transaction, transitivity);

setSupertype

VoidFuture TypeDB::EntityType::setSupertype(Transaction& transaction, EntityType* superEntityType)

Sets the supplied EntityType as the supertype of the current EntityType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

superEntityType

The EntityType to set as the supertype of this EntityType

EntityType*

Returns

VoidFuture

Code examples
entityType.setSupertype(transaction, entityType).get();

RelationType

Package: TypeDB

Supertypes:

  • TypeDB::ThingType

  • TypeDB::Type

  • TypeDB::Concept

Relation types (or subtypes of the relation root type) represent relationships between types.

Relation types have roles. Other types can play roles in relations if it’s mentioned in their definition. A relation type must specify at least one role.

create

ConceptPtrFuture< Relation > TypeDB::RelationType::create(Transaction& transaction)

Creates and returns an instance of this RelationType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptPtrFuture< Relation >

Code examples
relationType.create(transaction).get();

getInstances

ConceptIterable< Relation > TypeDB::RelationType::getInstances(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves Relations that are instances of this exact RelationType, OR this RelationType and any of its subtypes.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

Transitivity::TRANSITIVE for direct and indirect instances, Transitivity::EXPLICIT for direct relates only

Returns

ConceptIterable< Relation >

Code examples
relationType.getInstances(transaction, transitivity)

getRelates

ConceptIterable< RoleType > TypeDB::RelationType::getRelates(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves roles that this RelationType relates to directly or via inheritance.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< RoleType >

Code examples
relationType.getRelates(transaction, transitivity);

getRelates

ConceptPtrFuture< RoleType > TypeDB::RelationType::getRelates(Transaction& transaction, const std::string& roleLabel)

Retrieves the role with the specified label that this RelationType relates to, directly or via inheritance. Returns the corresponding RoleType or nullptr.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleLabel

Label of the role we wish to retrieve

const std::string&

Returns

ConceptPtrFuture< RoleType >

Code examples
relationType.getRelates(transaction, roleLabel).get();

getRelatesOverridden

ConceptPtrFuture< RoleType > TypeDB::RelationType::getRelatesOverridden(Transaction& transaction, RoleType* roleType)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleLabel

Label of the role that overrides an inherited role

Returns

ConceptPtrFuture< RoleType >

Code examples
relationType.getRelatesOverridden(transaction, roleLabel).get();

getRelatesOverridden

ConceptPtrFuture< RoleType > TypeDB::RelationType::getRelatesOverridden(Transaction& transaction, const std::string& roleLabel)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleLabel

Label of the role that overrides an inherited role

const std::string&

Returns

ConceptPtrFuture< RoleType >

Code examples
relationType.getRelatesOverridden(transaction, roleLabel).get();

getSubtypes

ConceptIterable< RelationType > TypeDB::RelationType::getSubtypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< RelationType >

Code examples
relationType.getSubtypes(transaction, transitivity);

setRelates

VoidFuture TypeDB::RelationType::setRelates(Transaction& transaction, const std::string& roleLabel)

Variant of setRelates(Transaction& transaction, const std::string& roleLabel, const std::string& overriddenLabel) where the RoleType does not override an existing role.

Returns

VoidFuture

setRelates

VoidFuture TypeDB::RelationType::setRelates(Transaction& transaction, const std::string& roleLabel, RoleType* overriddenType)

Variant of setRelates(Transaction& transaction, const std::string& roleLabel, const std::string& overriddenLabel) where the RoleType is specified directly rather than the label.

Returns

VoidFuture

setRelates

VoidFuture TypeDB::RelationType::setRelates(Transaction& transaction, const std::string& roleLabel, const std::string& overriddenLabel)

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

Transaction&

roleLabel

The new role for the RelationType to relate to

const std::string&

overriddenLabel

The label being overridden, if applicable

const std::string&

Returns

VoidFuture

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

setSupertype

VoidFuture TypeDB::RelationType::setSupertype(Transaction& transaction, RelationType* superRelationType)

Sets the supplied RelationType as the supertype of the current RelationType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

superRelationType

The RelationType to set as the supertype of this RelationType

RelationType*

Returns

VoidFuture

Code examples
relationType.setSupertype(transaction, superRelationType).get();

unsetRelates

VoidFuture TypeDB::RelationType::unsetRelates(Transaction& transaction, RoleType* roleType)

Variant of unsetRelates(Transaction& transaction, const std::string& roleLabel) where the RoleType is specified directly rather than the label.

Returns

VoidFuture

unsetRelates

VoidFuture TypeDB::RelationType::unsetRelates(Transaction& transaction, const std::string& roleLabel)

Disallows this RelationType from relating to the given role.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleLabel

The role to not relate to the relation type.

const std::string&

Returns

VoidFuture

Code examples
relationType.unsetRelates(transaction, roleLabel).get();

RoleType

Package: TypeDB

Supertypes:

  • TypeDB::Type

  • TypeDB::Concept

Defines a role an instance can play in a Relation.

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.

deleteType

virtual VoidFuture TypeDB::RoleType::deleteType(Transaction& transaction)

Deletes this type from the database.

Implements TypeDB::Type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

virtual VoidFuture

Code examples
type.deleteType(transaction).get();

getLabel

virtual std::string TypeDB::RoleType::getLabel()

Retrieves the unique label of the type.

Implements TypeDB::Type.

Returns

virtual std::string

Code examples
type.getLabel();

getName

std::string TypeDB::RoleType::getName()

Returns the name of this role type’s label.

Returns

std::string

Code examples
label.getName();

getPlayerInstances

ConceptIterable< Thing > TypeDB::RoleType::getPlayerInstances(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves the Thing instances that play this role.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< Thing >

Code examples
roleType.getPlayerInstances(transaction, transitivity);

getPlayerTypes

ConceptIterable< ThingType > TypeDB::RoleType::getPlayerTypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves the ThingTypes whose instances play this role.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< ThingType >

Code examples
roleType.getPlayerTypes(transaction, transitivity)

getRelationInstances

ConceptIterable< Relation > TypeDB::RoleType::getRelationInstances(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves the Relation instances that this role is related to.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< Relation >

Code examples
roleType.getRelationInstances(transaction, transitivity)

getRelationType

ConceptPtrFuture< RelationType > TypeDB::RoleType::getRelationType(Transaction& transaction)

Retrieves the RelationType that this role is directly related to.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptPtrFuture< RelationType >

Code examples
roleType.getRelationType(transaction).get();

getRelationTypes

ConceptIterable< RelationType > TypeDB::RoleType::getRelationTypes(Transaction& transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptIterable< RelationType >

Code examples
roleType.getRelationTypes(transaction);

getScope

std::string TypeDB::RoleType::getScope()

Returns the scope part of this role type’s label.

Returns

std::string

Code examples
label.getScope();

getSubtypes

ConceptIterable< RoleType > TypeDB::RoleType::getSubtypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< RoleType >

Code examples
roleType.getSubtypes(transaction, transitivity);

getSupertype

ConceptPtrFuture< RoleType > TypeDB::RoleType::getSupertype(Transaction& transaction)

Retrieves the most immediate supertype of the RoleType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptPtrFuture< RoleType >

Code examples
roleType.getSupertype(transaction).get();

getSupertypes

ConceptIterable< RoleType > TypeDB::RoleType::getSupertypes(Transaction& transaction)

Retrieves all supertypes of the RoleType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptIterable< RoleType >

Code examples
roleType.getSupertypes(transaction);

isAbstract

virtual bool TypeDB::RoleType::isAbstract()

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

Implements TypeDB::Type.

Returns

virtual bool

Code examples
type.isAbstract();

isDeleted

virtual BoolFuture TypeDB::RoleType::isDeleted(Transaction& transaction)

Check if the type has been deleted

Implements TypeDB::Type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

virtual BoolFuture

Code examples
type.isDeleted(transaction).get();

isRoot

bool TypeDB::RoleType::isRoot()

Checks if the type is a root type.

Returns

bool

Code examples
type.isRoot();

setLabel

virtual VoidFuture TypeDB::RoleType::setLabel(Transaction& transaction, const std::string& newLabel)

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

Implements TypeDB::Type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

label

The new Label to be given to the type.

Returns

virtual VoidFuture

Code examples
type.setLabel(transaction, newLabel).get();

AttributeType

Package: TypeDB

Supertypes:

  • TypeDB::ThingType

  • TypeDB::Type

  • TypeDB::Concept

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.

get

ConceptPtrFuture< Attribute > TypeDB::AttributeType::get(Transaction& transaction, Value* value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

Attribute’s value

Value*

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.get(transaction, value).get();

get

ConceptPtrFuture< Attribute > TypeDB::AttributeType::get(Transaction& transaction, const std::string& value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

Attribute’s value

const std::string&

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.get(transaction, value).get();

get

ConceptPtrFuture< Attribute > TypeDB::AttributeType::get(Transaction& transaction, int64_t value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

Attribute’s value

int64_t

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.get(transaction, value).get();

get

ConceptPtrFuture< Attribute > TypeDB::AttributeType::get(Transaction& transaction, double value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

Attribute’s value

double

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.get(transaction, value).get();

get

ConceptPtrFuture< Attribute > TypeDB::AttributeType::get(Transaction& transaction, bool value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

Attribute’s value

bool

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.get(transaction, value).get();

get

ConceptPtrFuture< Attribute > TypeDB::AttributeType::get(Transaction& transaction, DateTime value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

Attribute’s value

DateTime

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.get(transaction, value).get();

getInstances

ConceptIterable< Attribute > TypeDB::AttributeType::getInstances(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves all direct and indirect Attributes that are instances of this AttributeType.

Input parameters
Name Description Type

transitivity

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

transaction

The current transaction

Transaction&

Returns

ConceptIterable< Attribute >

Code examples
attributeType.getInstances(transaction);
attributeType.getInstances(transaction, transitivity);
 Parameters

    transitivity Transitivity::TRANSITIVE for direct and indirect subtypes, Transitivity::EXPLICIT for direct subtypes only
    transaction The current transaction

getOwners

ConceptIterable< ThingType > TypeDB::AttributeType::getOwners(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieve all Things that own an attribute of this AttributeType directly or through inheritance.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< ThingType >

Code examples
attributeType.getOwners(transaction);

getOwners

ConceptIterable< ThingType > TypeDB::AttributeType::getOwners(Transaction& transaction, const std::vector< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)

Variant of getOwners(Transaction& transaction, const std::vector<Annotation>& annotations, Transitivity transitivity = Transitivity::TRANSITIVE) for convenience

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

annotations

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

const std::vector< Annotation >&

transitivity

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

Returns

ConceptIterable< ThingType >

Code examples
attributeType.getOwners(transaction, {Annotation::key()}, transitivity);
 */
ConceptIterable<ThingType> getOwners(Transaction& transaction, const std::initializer_list<Annotation>& annotations, Transitivity transitivity = Transitivity::TRANSITIVE);

/**
   Retrieve all Things that own an attribute of this AttributeType,
   filtered by Annotations, directly or through inheritance.

   Examples
attributeType.getOwners(transaction, annotations);
Parameters

    transaction The current transaction
    annotations Only retrieve ThingTypes that have an attribute of this AttributeType with all given Annotations
    transitivity Transitivity::TRANSITIVE for direct and indirect subtypes, Transitivity::EXPLICIT for direct subtypes only

getRegex

OptionalStringFuture TypeDB::AttributeType::getRegex(Transaction& transaction)

Retrieves the regular expression that is defined for this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

OptionalStringFuture

Code examples
attributeType.getRegex(transaction).get();

getSubtypes

ConceptIterable< AttributeType > TypeDB::AttributeType::getSubtypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves all direct and indirect subtypes of this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

transitivity

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

Returns

ConceptIterable< AttributeType >

Code examples
attributeType.getSubtypes(transaction);
attributeType.getSubtypes(transaction, transitivity);

getSubtypes

ConceptIterable< AttributeType > TypeDB::AttributeType::getSubtypes(Transaction& transaction, ValueType valueType, Transitivity transitivity = Transitivity::TRANSITIVE)

Retrieves all direct and indirect (or direct only) subtypes of this AttributeType with given Value.Type.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

valueType

Value.Type for retrieving subtypes

ValueType

transitivity

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

Returns

ConceptIterable< AttributeType >

Code examples
attributeType.getSubtypes(transaction, valueType, transitivity);

getValueType

ValueType TypeDB::AttributeType::getValueType()

Retrieves the Value.Type of this AttributeType.

Returns

ValueType

Code examples
attributeType.getValueType();

put

ConceptPtrFuture< Attribute > TypeDB::AttributeType::put(Transaction& transaction, Value* value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

New Attribute’s value

Value*

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.put(transaction, value).get();

put

ConceptPtrFuture< Attribute > TypeDB::AttributeType::put(Transaction& transaction, const std::string& value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

New Attribute’s value

const std::string&

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.put(transaction, value).get();

put

ConceptPtrFuture< Attribute > TypeDB::AttributeType::put(Transaction& transaction, int64_t value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

New Attribute’s value

int64_t

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.put(transaction, value).get();

put

ConceptPtrFuture< Attribute > TypeDB::AttributeType::put(Transaction& transaction, double value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

New Attribute’s value

double

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.put(transaction, value).get();

put

ConceptPtrFuture< Attribute > TypeDB::AttributeType::put(Transaction& transaction, bool value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

New Attribute’s value

bool

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.put(transaction, value).get();

put

ConceptPtrFuture< Attribute > TypeDB::AttributeType::put(Transaction& transaction, DateTime value)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

value

New Attribute’s value

DateTime

Returns

ConceptPtrFuture< Attribute >

Code examples
attributeType.put(transaction, value).get();

setRegex

VoidFuture TypeDB::AttributeType::setRegex(Transaction& transaction, const std::string& regex)

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

Transaction&

regex

Regular expression

const std::string&

Returns

VoidFuture

Code examples
attributeType.setRegex(transaction, regex).get();

setSupertype

VoidFuture TypeDB::AttributeType::setSupertype(Transaction& transaction, AttributeType* attributeType)

Sets the supplied AttributeType as the supertype of the current AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

attributeType

The AttributeType to set as the supertype of this AttributeType

AttributeType*

Returns

VoidFuture

Code examples
attributeType.setSupertype(transaction, superType).get();

unsetRegex

VoidFuture TypeDB::AttributeType::unsetRegex(Transaction& transaction)

Removes the regular expression that is defined for this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

VoidFuture

Code examples
attributeType.unsetRegex(transaction).get();

Annotation

Package: TypeDB

Annotations are used to specify extra schema constraints.

isKey

bool TypeDB::Annotation::isKey()

Checks if this Annotation is a @key annotation.

Returns

bool

Code examples
annotation.isKey();

isUnique

bool TypeDB::Annotation::isUnique()

Checks if this Annotation is a @unique annotation.

Returns

bool

Code examples
annotation.isUnique();

key

static Annotation TypeDB::Annotation::key()

Produces a @key annotation.

Returns

static Annotation

Code examples
ThingType.Annotation.key();

toString

std::string TypeDB::Annotation::toString()

A string representation of this Annotation.

Returns

std::string

unique

static Annotation TypeDB::Annotation::unique()

Produces a @unique annotation.

Returns

static Annotation

Code examples
Annotation.unique();

ValueType

Package: TypeDB

Represents the type of primitive value is held by a Value or Attribute.

Enum constants
Name

BOOLEAN

DATETIME

DOUBLE

LONG

OBJECT

STRING

Data

Thing

Package: TypeDB

Supertypes:

  • TypeDB::Concept

Common super-type of Entity, Relation, and Attribute.

deleteThing

VoidFuture TypeDB::Thing::deleteThing(Transaction& transaction)

Deletes this Thing.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

VoidFuture

Code examples
thing.deleteThing(transaction).get();

getHas

ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::initializer_list< Annotation >& annotations = {})

Retrieves the Attributes that this Thing owns, filtered by Annotations.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

annotations

Only retrieve attributes with all given Annotations

Returns

ConceptIterable< Attribute >

Code examples
thing.getHas(transaction);
thing.getHas(transaction, {Annotation.key()}));

getHas

ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const AttributeType* attribute)
Returns

ConceptIterable< Attribute >

getHas

ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::vector< std::unique_ptr< AttributeType > >& attributeTypes)

Retrieves the Attributes of the specified AttributeTypes that this Thing owns.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

attributeTypes

The AttributeTypes to filter the attributes by

const std::vector< std::unique_ptr< AttributeType > >&

Returns

ConceptIterable< Attribute >

Code examples
thing.getHas(transaction, attributeTypes);

getHas

ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::vector< const AttributeType* >& attributeTypes)
Returns

ConceptIterable< Attribute >

getHas

ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::vector< Annotation >& annotations)
Returns

ConceptIterable< Attribute >

getIID

std::string TypeDB::Thing::getIID()

Retrieves the unique id of the Thing.

Returns

std::string

Code examples
thing.getIID();

getPlaying

ConceptIterable< RoleType > TypeDB::Thing::getPlaying(Transaction& transaction)

Retrieves the roles that this Thing is currently playing.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptIterable< RoleType >

Code examples
thing.getPlaying(transaction);

getRelations

ConceptIterable< Relation > TypeDB::Thing::getRelations(Transaction& transaction, const std::vector< std::unique_ptr< RoleType > >& roleTypes = {})

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

Transaction&

roleTypes

The array of roles to filter the relations by.

Returns

ConceptIterable< Relation >

Code examples
thing.getRelations(transaction);
thing.getRelations(transaction, roleTypes);

getRelations

ConceptIterable< Relation > TypeDB::Thing::getRelations(Transaction& transaction, const std::vector< RoleType* >& roleTypes)
Returns

ConceptIterable< Relation >

getType

std::unique_ptr< ThingType > TypeDB::Thing::getType()

Retrieves the type which this Thing belongs to.

Returns

std::unique_ptr< ThingType >

Code examples
thing.getType();

isDeleted

BoolFuture TypeDB::Thing::isDeleted(Transaction& transaction)

Checks if this Thing is deleted.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

BoolFuture

Code examples
thing.isDeleted(transaction).get();

isInferred

bool TypeDB::Thing::isInferred()

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

Returns

bool

Code examples
thing.isInferred();

setHas

VoidFuture TypeDB::Thing::setHas(Transaction& transaction, Attribute* attribute)

Assigns an Attribute to be owned by this Thing.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

attribute

The Attribute to be owned by this Thing.

Attribute*

Returns

VoidFuture

Code examples
thing.setHas(transaction, attribute).get();

unsetHas

VoidFuture TypeDB::Thing::unsetHas(Transaction& transaction, Attribute* attribute)

Unassigns an Attribute from this Thing.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

attribute

The Attribute to be disowned from this Thing.

Attribute*

Returns

VoidFuture

Code examples
thing.unsetHas(transaction, attribute).get();

Entity

Package: TypeDB

Supertypes:

  • TypeDB::Thing

  • TypeDB::Concept

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.

getType

std::unique_ptr< EntityType > TypeDB::Entity::getType()

Retrieves the type which this Entity belongs to.

Returns

std::unique_ptr< EntityType >

Code examples
entity.getType();

Relation

Package: TypeDB

Supertypes:

  • TypeDB::Thing

  • TypeDB::Concept

Relation is an instance of a relation type.

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

addPlayer

VoidFuture TypeDB::Relation::addPlayer(Transaction& transaction, RoleType* roleType, Thing* player)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleType

The role to be played by the player

RoleType*

player

The thing to play the role

Thing*

Returns

VoidFuture

Code examples
relation.addPlayer(transaction, roleType, player).get();

getPlayers

std::map< std::unique_ptr< RoleType >, std::unique_ptr< Thing > > TypeDB::Relation::getPlayers(Transaction& transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

std::map< std::unique_ptr< RoleType >, std::unique_ptr< Thing > >

Code examples
relation.getPlayers(transaction)

getPlayersByRoleType

ConceptIterable< Thing > TypeDB::Relation::getPlayersByRoleType(Transaction& transaction, const std::vector< std::unique_ptr< RoleType > >& roleTypes)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

roleTypes

0 or more role types

const std::vector< std::unique_ptr< RoleType > >&

Returns

ConceptIterable< Thing >

Code examples
relation.getPlayersByRoleType(transaction, roleTypes);

getPlayersByRoleType

ConceptIterable< Thing > TypeDB::Relation::getPlayersByRoleType(Transaction& transaction, const std::vector< RoleType* >& roleTypes)
Returns

ConceptIterable< Thing >

getRelating

ConceptIterable< RoleType > TypeDB::Relation::getRelating(Transaction& transaction)

Retrieves all role types currently played in this Relation.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptIterable< RoleType >

Code examples
relation.getRelating(transaction);

getType

std::unique_ptr< RelationType > TypeDB::Relation::getType()

Retrieves the type which this Relation belongs to.

Returns

std::unique_ptr< RelationType >

Code examples
relation.getType();

removePlayer

VoidFuture TypeDB::Relation::removePlayer(Transaction& transaction, RoleType* roleType, Thing* player)

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

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

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

VoidFuture

Code examples
relation.removePlayer(transaction, roleType, player).get();

Attribute

Package: TypeDB

Supertypes:

  • TypeDB::Thing

  • TypeDB::Concept

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.

getOwners

ConceptIterable< Thing > TypeDB::Attribute::getOwners(Transaction& transaction)

Retrieves the instances that own this Attribute.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

Returns

ConceptIterable< Thing >

Code examples
attribute.getOwners(transaction);

getOwners

ConceptIterable< Thing > TypeDB::Attribute::getOwners(Transaction& transaction, const ThingType* ownerType)

Retrieves the instances that own this Attribute.

Input parameters
Name Description Type

transaction

The current transaction

Transaction&

ownerType

Filter results for only owners of the given type

const ThingType*

Returns

ConceptIterable< Thing >

Code examples
attribute.getOwners(transaction, ownerType);

getType

std::unique_ptr< AttributeType > TypeDB::Attribute::getType()

Retrieves the type which this Attribute belongs to.

Returns

std::unique_ptr< AttributeType >

Code examples
attribute.getType();

getValue

std::unique_ptr< Value > TypeDB::Attribute::getValue()

Retrieves the value which the Attribute instance holds.

Returns

std::unique_ptr< Value >

Code examples
attribute.getValue();

Value

Package: TypeDB

Supertypes:

  • TypeDB::Concept

A primitive value. Holds the value of an attribute, or the result of an expression in a query.

asBoolean

bool TypeDB::Value::asBoolean()

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

Returns

bool

Code examples
value.asBoolean();

asDateTime

DateTime TypeDB::Value::asDateTime()

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

Returns

DateTime

Code examples
value.asDatetime();

asDouble

double TypeDB::Value::asDouble()

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

Returns

double

Code examples
value.asDouble();

asLong

int64_t TypeDB::Value::asLong()

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

Returns

int64_t

Code examples
value.asLong();

asString

std::string TypeDB::Value::asString()

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

Returns

std::string

Code examples
value.asString();

formatDateTime

static std::string TypeDB::Value::formatDateTime(DateTime t)

Returns a string in the TypeQL DateTime format corresponding to the specified DateTime (yyyy-mm-dd’T’HH:MM:SS)

Returns

static std::string

Code examples
Value::formatDateTime(datetime);

isBoolean

bool TypeDB::Value::isBoolean()

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

Returns

bool

Code examples
value.isBoolean()

isDateTime

bool TypeDB::Value::isDateTime()

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

Returns

bool

Code examples
value.isDatetime();

isDouble

bool TypeDB::Value::isDouble()

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

Returns

bool

Code examples
value.isDouble();

isLong

bool TypeDB::Value::isLong()

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

Returns

bool

Code examples
value.isLong()

isString

bool TypeDB::Value::isString()

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

Returns

bool

Code examples
value.isString();

of

static std::unique_ptr< Value > TypeDB::Value::of(bool value)

Creates a new Value object of the specified boolean value.

Returns

static std::unique_ptr< Value >

Code examples
Value::of(value);

of

static std::unique_ptr< Value > TypeDB::Value::of(int64_t value)

Creates a new Value object of the specified long value.

Returns

static std::unique_ptr< Value >

Code examples
Value::of(value);

of

static std::unique_ptr< Value > TypeDB::Value::of(double value)

Creates a new Value object of the specified double value.

Returns

static std::unique_ptr< Value >

Code examples
Value::of(value);

of

static std::unique_ptr< Value > TypeDB::Value::of(const std::string& value)

Creates a new Value object of the specified string value.

Returns

static std::unique_ptr< Value >

Code examples
Value::of(value);

of

static std::unique_ptr< Value > TypeDB::Value::of(DateTime value)

Creates a new Value object of the specified DateTime value.

Returns

static std::unique_ptr< Value >

Code examples
Value::of(value);

parseDateTime

static DateTime TypeDB::Value::parseDateTime(const std::string& s)

Parses a DateTime from a string in the TypeQL DateTime format (yyyy-mm-dd’T’HH:MM:SS)

Returns

static DateTime

Code examples
Value::parseDateTime(str);

valueType

ValueType TypeDB::Value::valueType()

Retrieves the ValueType of this value concept.

Returns

ValueType

Code examples
value.getType()

Logic

LogicManager

Package: TypeDB

Provides methods for manipulating Rules in the database.

getRule

OptionalRuleFuture TypeDB::LogicManager::getRule(const std::string& label) const

Retrieves the Rule that has the given label.

Input parameters
Name Description Type

label

The label of the Rule to create or retrieve

const std::string&

Returns

OptionalRuleFuture

Code examples
transaction.logic.getRule(label).get();

getRules

RuleIterable TypeDB::LogicManager::getRules() const

Retrieves all rules.

Returns

RuleIterable

Code examples
transaction.logic.getRules()

putRule

RuleFuture TypeDB::LogicManager::putRule(const std::string& label, const std::string& when, const std::string& then) const

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

const std::string&

when

The when body of the rule to create

const std::string&

then

The then body of the rule to create

const std::string&

Returns

RuleFuture

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

Rule

Package: TypeDB

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.

deleteRule

VoidFuture TypeDB::Rule::deleteRule(Transaction& transaction)

Deletes this rule.

Input parameters
Name Description Type

transaction

The current Transaction

Transaction&

Returns

VoidFuture

Code examples
rule.deleteRule(transaction).get();

isDeleted

BoolFuture TypeDB::Rule::isDeleted(Transaction& transaction)

Check if this rule has been deleted.

Input parameters
Name Description Type

transaction

The current Transaction

Transaction&

Returns

BoolFuture

Code examples
rule.isDeleted(transaction).get();

label

std::string TypeDB::Rule::label()

Retrieves the unique label of the rule.

Returns

std::string

setLabel

VoidFuture TypeDB::Rule::setLabel(Transaction& transaction, const std::string& label)

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

Input parameters
Name Description Type

transaction

The current Transaction

Transaction&

label

The new label to be given to the rule

const std::string&

Returns

VoidFuture

Code examples
rule.setLabel(transaction, newLabel).get();

then

std::string TypeDB::Rule::then()

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

Returns

std::string

toString

std::string TypeDB::Rule::toString()

A string representation of this Rule.

Returns

std::string

when

std::string TypeDB::Rule::when()

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

Returns

std::string

Errors

DriverException

Package: TypeDB

Exceptions raised by the driver.

code

const std::string_view TypeDB::DriverException::code()

Retrieves the error code.

Returns

const std::string_view

Code examples
try { ... }
catch (TypeDB::DriverException& e){
    if ("[CXN11]" == e.code()) { ... }
}

message

const std::string_view TypeDB::DriverException::message()

Retrieves the descriptive error message.

Returns

const std::string_view

Code examples
try { ... }
catch (TypeDB::DriverException& e){
    logError(e.message());
    throw e;
}