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

cloudDriver

static Driver TypeDB::Driver::cloudDriver(const std::vector< std::string >& cloudAddresses, 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)

credential

The Credential to connect with

Returns

static Driver

coreDriver

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

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

Returns

static Driver

initLogging

static void TypeDB::Driver::initLogging()

Enables logging in the TypeDB driver.

Returns

static void

isOpen

bool TypeDB::Driver::isOpen()

Checks whether this connection is presently open.

Returns

bool

session

Session TypeDB::Driver::session(const std::string& database, SessionType sessionType, const 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

type

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

options

TypeDBOptions for the session

Returns

Session

user

User TypeDB::Driver::user()

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

Returns

User

Credential

Package: TypeDB

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

Examples
// 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 = "")
Parameters
username
The name of the user to connect as
password
The password for the user
withTLS
Specify whether the connection to TypeDB Cloud must be done over TLS
customRootCAPath
Optional, Path to a custom CA certificate to use for authenticating server certificates.
Input parameters
Name Description Type

username

The name of the user to connect as

password

The password for the user

withTLS

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

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

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

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

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

Database

Package: TypeDB

A TypeDB database.

deleteDatabase

void TypeDB::Database::deleteDatabase()

Deletes this database.

Returns

void

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 >

primaryReplica

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

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

Returns

std::optional< ReplicaInfo >

replicas

ReplicaInfoIterable TypeDB::Database::replicas()

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

Returns

ReplicaInfoIterable

ruleSchema

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

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

Returns

std::string

schema

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

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

Returns

std::string

typeSchema

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

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

Returns

std::string

ReplicaInfo

Package: TypeDB

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

address

std::string TypeDB::ReplicaInfo::address()

Retrieves the address of the server hosting this replica

Returns

std::string

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

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

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

Returns

bool

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

password

The password of the user to be created

Returns

void

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

Returns

void

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

Returns

std::unique_ptr< User >

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

password

The new password

Returns

void

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.

Parameters
passwordOld
The current password of this user
passwordNew
The new password
Input parameters
Name Description Type

passwordOld

The current password of this user

passwordNew

The new password

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

databaseName

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

Returns the name of the database of the session.

Returns

std::string

isOpen

bool TypeDB::Session::isOpen() const

Checks whether this session is open.

Returns

bool

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

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

transaction

Transaction TypeDB::Session::transaction(TransactionType type, const 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)

options

Options for the session

Returns

Transaction

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

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 >

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

Returns

Options&

infer

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

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

Returns

std::optional< bool >

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

Returns

Options&

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 >

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

Returns

Options&

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 >

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

Returns

Options&

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 >

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

Returns

Options&

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 >

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

Returns

Options&

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 >

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&

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 >

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&

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 >

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

Returns

Options&

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 >

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&

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

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

forceClose

void TypeDB::Transaction::forceClose()

Closes the transaction.

Returns

void

isOpen

bool TypeDB::Transaction::isOpen() const

Checks whether this transaction is open.

Returns

bool

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

rollback

void TypeDB::Transaction::rollback()

Rolls back the uncommitted changes made via this transaction.

Returns

void

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

options

Specify query options

Returns

VoidFuture

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

options

Specify query options

Returns

ExplanationIterable

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

options

Specify query options

Returns

JSONIterable

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

options

Specify query options

Returns

ConceptMapIterable

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

options

Specify query options

Returns

AggregateFuture

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

options

Specify query options

Returns

ConceptMapGroupIterable

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

options

Specify query options

Returns

ValueGroupIterable

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

options

Specify query options

Returns

ConceptMapIterable

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

options

Specify query options

Returns

VoidFuture

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

options

Specify query options

Returns

VoidFuture

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

options

Specify query options

Returns

ConceptMapIterable

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

owner

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

Retrieves the concept that is the group owner.

Returns

std::unique_ptr< Concept >

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 >

explainables

Explainables TypeDB::ConceptMap::explainables()

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

Returns

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 >

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 > >

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

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 >

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

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

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

Returns

Explainable

attributes

StringIterable TypeDB::Explainables::attributes()

Retrieves all of this ConceptMap’s explainable attributes.

Returns

StringIterable

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

attribute

The string representation of the attribute variable

Returns

Explainable

ownerships

OwnerAttributePairIterable TypeDB::Explainables::ownerships()

Retrieves all of this ConceptMap’s explainable ownerships.

Returns

OwnerAttributePairIterable

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

Returns

Explainable

relations

StringIterable TypeDB::Explainables::relations()

Retrieves all of this ConceptMap’s explainable relations.

Returns

StringIterable

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

explainableId

int64_t TypeDB::Explainable::explainableId()

Retrieves the unique ID that identifies this Explainable.

Returns

int64_t

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

condition

ConceptMap TypeDB::Explanation::condition()

Retrieves the Condition for this Explanation.

Returns

ConceptMap

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.

Returns

std::vector< std::string >

queryVariables

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

Retrieves the query variables for this Explanation.

Returns

std::vector< std::string >

rule

Rule TypeDB::Explanation::rule()

Retrieves the Rule for this Explanation.

Returns

Rule

toString

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

A string representation of this Explanation.

Returns

std::string

Future

Package: TypeDB

template<typename RETURN, typename NATIVE_PROMISE, typename HELPER = FutureHelper<RETURN, NATIVE_PROMISE>>
class TypeDB::Future< RETURN, NATIVE_PROMISE, HELPER >

A structure emulating std::future, used as a 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

template<typename NATIVE_ITER, typename NATIVE_T, typename T, typename HELPER = IteratorHelper<NATIVE_ITER, NATIVE_T, T>>
class TypeDB::Iterable< NATIVE_ITER, NATIVE_T, T, HELPER >

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

template<typename NATIVE_ITER, typename NATIVE_T, typename T, typename HELPER = IteratorHelper<NATIVE_ITER, NATIVE_T, T>>
class TypeDB::Iterator< NATIVE_ITER, NATIVE_T, T, HELPER >

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

Returns

ConceptPtrFuture< Attribute >

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

Returns

ConceptPtrFuture< AttributeType >

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

Returns

ConceptPtrFuture< Entity >

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

Returns

ConceptPtrFuture< EntityType >

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

Returns

ConceptPtrFuture< Relation >

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

Returns

ConceptPtrFuture< RelationType >

getRootAttributeType

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

Retrieve the root AttributeType, “attribute”.

Returns

std::unique_ptr< AttributeType >

getRootEntityType

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

Retrieves the root EntityType, “entity”.

Returns

std::unique_ptr< EntityType >

getRootRelationType

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

Retrieve the root RelationType, “relation”.

Returns

std::unique_ptr< RelationType >

getSchemaExceptions

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

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

Returns

std::vector< DriverException >

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

valueType

The value type of the AttributeType to create

Returns

ConceptPtrFuture< AttributeType >

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

Returns

ConceptPtrFuture< EntityType >

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

Returns

ConceptPtrFuture< RelationType >

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*

asAttributeType

AttributeType* TypeDB::Concept::asAttributeType()

Casts the concept to EntityType.

Returns

AttributeType*

asEntity

Entity* TypeDB::Concept::asEntity()

Casts the concept to Entity.

Returns

Entity*

asEntityType

EntityType* TypeDB::Concept::asEntityType()

Casts the concept to EntityType.

Returns

EntityType*

asRelation

Relation* TypeDB::Concept::asRelation()

Casts the concept to Relation.

Returns

Relation*

asRelationType

RelationType* TypeDB::Concept::asRelationType()

Casts the concept to RelationType.

Returns

RelationType*

asRoleType

RoleType* TypeDB::Concept::asRoleType()

Casts the concept to RoleType.

Returns

RoleType*

asThing

Thing* TypeDB::Concept::asThing()

Casts the concept to Thing.

Returns

Thing*

asThingType

ThingType* TypeDB::Concept::asThingType()

Casts the concept to ThingType.

Returns

ThingType*

asValue

Value* TypeDB::Concept::asValue()

Casts the concept to Value.

Returns

Value*

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

isAttribute

bool TypeDB::Concept::isAttribute()

Checks if the concept is a Relation.

Returns

bool

isAttributeType

bool TypeDB::Concept::isAttributeType()

Checks if the concept is an AttributeType.

Returns

bool

isEntity

bool TypeDB::Concept::isEntity()

Checks if the concept is an Entity.

Returns

bool

isEntityType

bool TypeDB::Concept::isEntityType()

Checks if the concept is an EntityType.

Returns

bool

isRelation

bool TypeDB::Concept::isRelation()

Checks if the concept is a Value.

Returns

bool

isRelationType

bool TypeDB::Concept::isRelationType()

Checks if the concept is a RelationType.

Returns

bool

isRoleType

bool TypeDB::Concept::isRoleType()

Checks if the concept is a RoleType.

Returns

bool

isThing

bool TypeDB::Concept::isThing()

Checks if the concept is a Thing.

Returns

bool

isThingType

bool TypeDB::Concept::isThingType()

Checks if the concept is a ThingType.

Returns

bool

isValue

bool TypeDB::Concept::isValue()

Checks if the concept is a Value.

Returns

bool

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

Returns

virtual VoidFuture

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

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

transitivity

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

Returns

ConceptIterable< Type >

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

Returns

ConceptPtrFuture< Type >

getSupertypes

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

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

Returns

ConceptIterable< Type >

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

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

Returns

virtual BoolFuture

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

label

The new Label to be given to the type.

Returns

virtual VoidFuture

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

Returns

virtual VoidFuture

getLabel

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

Retrieves the unique label of the type.

Implements TypeDB::Type.

Returns

virtual std::string

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

valueType

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

transitivity

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

annotations

Only retrieve attribute types owned with annotations.

Returns

ConceptIterable< AttributeType >

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

attributeType

The AttributeType that overrides requested AttributeType

Returns

ConceptPtrFuture< AttributeType >

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

transitivity

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

Returns

ConceptIterable< RoleType >

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

roleType

The RoleType that overrides an inherited role

Returns

ConceptPtrFuture< RoleType >

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

transitivity

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

Returns

ConceptIterable< ThingType >

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

Returns

ConceptPtrFuture< ThingType >

getSupertypes

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

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

Returns

ConceptIterable< ThingType >

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

Returns

StringFuture

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

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

Returns

virtual BoolFuture

isRoot

bool TypeDB::ThingType::isRoot()

Checks if the type is a root type.

Returns

bool

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

Returns

VoidFuture

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

label

The new Label to be given to the type.

Returns

virtual VoidFuture

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

attributeType

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

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

annotations

Adds annotations to the ownership.

Returns

VoidFuture

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

roleType

The role to be played by the instances of this type

overriddenType

The role type that this role overrides, if applicable

Returns

VoidFuture

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

Returns

VoidFuture

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

attributeType

The AttributeType to not be owned by the type.

Returns

VoidFuture

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

roleType

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

Returns

VoidFuture

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

Returns

ConceptPtrFuture< Entity >

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

transitivity

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

Returns

ConceptIterable< Entity >

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

transitivity

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

Returns

ConceptIterable< EntityType >

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

superEntityType

The EntityType to set as the supertype of this EntityType

Returns

VoidFuture

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

Returns

ConceptPtrFuture< Relation >

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

transitivity

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

Returns

ConceptIterable< Relation >

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

transitivity

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

Returns

ConceptIterable< RoleType >

getRelates

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

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

Input parameters
Name Description Type

transaction

The current transaction

roleLabel

Label of the role we wish to retrieve

Returns

ConceptPtrFuture< RoleType >

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

roleLabel

Label of the role that overrides an inherited role

Returns

ConceptPtrFuture< RoleType >

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

roleLabel

Label of the role that overrides an inherited role

Returns

ConceptPtrFuture< RoleType >

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

transitivity

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

Returns

ConceptIterable< RelationType >

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 supplied RelationType as the supertype of the current RelationType.

Input parameters
Name Description Type

transaction

The current transaction

superRelationType

The RelationType to set as the supertype of this RelationType

Returns

VoidFuture

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

superRelationType

The RelationType to set as the supertype of this RelationType

Returns

VoidFuture

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

roleLabel

The role to not relate to the relation type.

Returns

VoidFuture

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

Returns

virtual VoidFuture

getLabel

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

Retrieves the unique label of the type.

Implements TypeDB::Type.

Returns

virtual std::string

getName

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

Returns the name of this role type’s label.

Returns

std::string

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

transitivity

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

Returns

ConceptIterable< Thing >

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

transitivity

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

Returns

ConceptIterable< ThingType >

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

transitivity

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

Returns

ConceptIterable< Relation >

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

Returns

ConceptPtrFuture< RelationType >

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

Returns

ConceptIterable< RelationType >

getScope

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

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

Returns

std::string

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

transitivity

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

Returns

ConceptIterable< RoleType >

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

Returns

ConceptPtrFuture< RoleType >

getSupertypes

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

Retrieves all supertypes of the RoleType.

Input parameters
Name Description Type

transaction

The current transaction

Returns

ConceptIterable< RoleType >

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

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

Returns

virtual BoolFuture

isRoot

bool TypeDB::RoleType::isRoot()

Checks if the type is a root type.

Returns

bool

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

label

The new Label to be given to the type.

Returns

virtual VoidFuture

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

value

Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

Returns

ConceptIterable< Attribute >

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

transitivity

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

Returns

ConceptIterable< ThingType >

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

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

Returns

ConceptIterable< ThingType >

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

Returns

OptionalStringFuture

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

transitivity

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

Returns

ConceptIterable< AttributeType >

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

valueType

Value.Type for retrieving subtypes

transitivity

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

Returns

ConceptIterable< AttributeType >

getValueType

ValueType TypeDB::AttributeType::getValueType()

Retrieves the Value.Type of this AttributeType.

Returns

ValueType

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

value

New Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

New Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

New Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

New Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

New Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

value

New Attribute’s value

Returns

ConceptPtrFuture< Attribute >

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

regex

Regular expression

Returns

VoidFuture

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

attributeType

The AttributeType to set as the supertype of this AttributeType

Returns

VoidFuture

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

Returns

VoidFuture

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

isUnique

bool TypeDB::Annotation::isUnique()

Checks if this Annotation is a @unique annotation.

Returns

bool

key

static Annotation TypeDB::Annotation::key()

Produces a @key annotation.

Returns

static Annotation

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

ValueType

Package: TypeDB

What 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

Returns

VoidFuture

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

annotations

Only retrieve attributes with all given Annotations

Returns

ConceptIterable< Attribute >

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

attributeTypes

The AttributeTypes to filter the attributes by

Returns

ConceptIterable< Attribute >

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

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

Returns

ConceptIterable< RoleType >

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

roleTypes

The array of roles to filter the relations by.

Returns

ConceptIterable< Relation >

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 >

isDeleted

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

Checks if this Thing is deleted.

Input parameters
Name Description Type

transaction

The current transaction

Returns

BoolFuture

isInferred

bool TypeDB::Thing::isInferred()

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

Returns

bool

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

attribute

The Attribute to be owned by this Thing.

Returns

VoidFuture

unsetHas

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

Unassigns an Attribute from this Thing.

Input parameters
Name Description Type

transaction

The current transaction

attribute

The Attribute to be disowned from this Thing.

Returns

VoidFuture

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 >

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

roleType

The role to be played by the player

player

The thing to play the role

Returns

VoidFuture

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

Returns

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

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

roleTypes

0 or more role types

Returns

ConceptIterable< Thing >

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

Returns

ConceptIterable< RoleType >

getType

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

Retrieves the type which this Relation belongs to.

Returns

std::unique_ptr< RelationType >

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

roleType

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

player

The instance to no longer play the role in this Relation

Returns

VoidFuture

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

Returns

ConceptIterable< Thing >

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

ownerType

Filter results for only owners of the given type

Returns

ConceptIterable< Thing >

getType

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

Retrieves the type which this Attribute belongs to.

Returns

std::unique_ptr< AttributeType >

getValue

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

Retrieves the value which the Attribute instance holds.

Returns

std::unique_ptr< Value >

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

asDateTime

DateTime TypeDB::Value::asDateTime()

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

Returns

DateTime

asDouble

double TypeDB::Value::asDouble()

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

Returns

double

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

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

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

isBoolean

bool TypeDB::Value::isBoolean()

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

Returns

bool

isDateTime

bool TypeDB::Value::isDateTime()

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

Returns

bool

isDouble

bool TypeDB::Value::isDouble()

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

Returns

bool

isLong

bool TypeDB::Value::isLong()

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

Returns

bool

isString

bool TypeDB::Value::isString()

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

Returns

bool

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 >

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 >

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 >

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 >

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 >

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

valueType

ValueType TypeDB::Value::valueType()

Retrieves the ValueType of this value concept.

Returns

ValueType

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

Returns

OptionalRuleFuture

getRules

RuleIterable TypeDB::LogicManager::getRules() const

Retrieves all rules.

Returns

RuleIterable

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

when

The when body of the rule to create

then

The then body of the rule to create

Returns

RuleFuture

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

Returns

VoidFuture

isDeleted

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

Check if this rule has been deleted.

Input parameters
Name Description Type

transaction

The current Transaction

Returns

BoolFuture

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

label

The new label to be given to the rule

Returns

VoidFuture

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

message

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

Retrieves the descriptive error message.

Returns

const std::string_view

Provide Feedback