C++ driver API reference
Connection
Driver
Package: TypeDB
A connection to a TypeDB server which serves as the starting point for all interaction.
Name | Type | Description |
---|---|---|
|
|
The |
|
|
The |
close
void TypeDB::Driver::close()
Closes the driver. Before instantiating a new driver, the driver that’s currently open should first be closed.
void
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.
Name | Description | Type |
---|---|---|
|
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) |
|
|
The Credential to connect with |
|
static Driver
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.
Name | Description | Type |
---|---|---|
|
The address of the TypeDB server |
|
static Driver
Driver::coreDriver(address);
initLogging
static void TypeDB::Driver::initLogging()
Enables logging in the TypeDB driver.
static void
Driver::initLogging();
isOpen
bool TypeDB::Driver::isOpen()
Checks whether this connection is presently open.
bool
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.
Name | Description | Type |
---|---|---|
|
The name of the database with which the session connects |
|
|
The type of session to be created (DATA or SCHEMA) |
|
|
|
Session
driver.session(database, sessionType, options);
Credential
Package: TypeDB
User credentials and TLS encryption settings for connecting to TypeDB Cloud.
// 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 = "")
Name | Description | Type |
---|---|---|
|
The name of the user to connect as |
|
|
The password for the user |
|
|
Specify whether the connection to TypeDB Cloud must be done over TLS |
|
|
Optional, Path to a custom CA certificate to use for authenticating server certificates. |
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
DatabaseIterable
driver.databases.all()
contains
bool TypeDB::DatabaseManager::contains(const std::string&) const
Checks if a database with the given name exists
Name | Description | Type |
---|---|---|
|
The database name to be checked |
bool
driver.databases.contains(name)
Database
Package: TypeDB
A TypeDB database.
deleteDatabase
void TypeDB::Database::deleteDatabase()
Deletes this database.
void
database.deleteDatabase()
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
std::optional< ReplicaInfo >
database.preferredReplica()
primaryReplica
std::optional< ReplicaInfo > TypeDB::Database::primaryReplica()
Returns the primary replica for this database. Only works in TypeDB Cloud
std::optional< ReplicaInfo >
database.primaryReplica()
replicas
ReplicaInfoIterable TypeDB::Database::replicas()
Set of Replica
instances for this database. Only works in TypeDB Cloud
ReplicaInfoIterable
database.replicas()
ruleSchema
std::string TypeDB::Database::ruleSchema()
The rules in the schema as a valid TypeQL define query string.
std::string
database.ruleSchema()
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.
bool
isPrimary
bool TypeDB::ReplicaInfo::isPrimary()
Checks whether this is the primary replica of the raft cluster.
bool
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.
UserIterable
driver.users.all();
contains
bool TypeDB::UserManager::contains(const std::string& username) const
Checks if a user with the given name exists.
Name | Description | Type |
---|---|---|
|
The user name to be checked |
|
bool
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.
Name | Description | Type |
---|---|---|
|
The name of the user to be created |
|
|
The password of the user to be created |
|
void
driver.users.create(username, password);
deleteUser
void TypeDB::UserManager::deleteUser(const std::string& username) const
Deletes a user with the given name.
Name | Description | Type |
---|---|---|
|
The name of the user to be deleted |
|
void
driver.users.deleteUser(username);
get
std::unique_ptr< User > TypeDB::UserManager::get(const std::string& username) const
Retrieves a user with the given name.
Name | Description | Type |
---|---|---|
|
The name of the user to retrieve |
|
std::unique_ptr< User >
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.
Name | Description | Type |
---|---|---|
|
The name of the user to set the password of |
|
|
The new password |
|
void
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.
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.
Name | Description | Type |
---|---|---|
|
The current password of this user |
|
|
The new password |
|
void
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.
void
session.close();
databaseName
std::string TypeDB::Session::databaseName() const
Returns the name of the database of the session.
std::string
session.databaseName();
isOpen
bool TypeDB::Session::isOpen() const
Checks whether this session is open.
bool
session.isOpen();
onClose
void TypeDB::Session::onClose(std::function< void()> callback)
Registers a callback function which will be executed when this session is closed.
Name | Description | Type |
---|---|---|
|
The callback function. |
void
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.
Name | Description | Type |
---|---|---|
|
The callback function. |
void
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.
Name | Description | Type |
---|---|---|
|
The type of transaction to be created (READ or WRITE) |
|
|
Options for the session |
Transaction
session.transaction(transactionType, options);
SessionType
Package: TypeDB
Used to specify the type of the session.
driver.session(database, TypeDBSession.Type.SCHEMA);
Name |
---|
|
|
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.
TypeDB::Options::Options
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.
std::optional< bool >
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable explanations |
|
Options&
options.explain(explain);
infer
std::optional< bool > TypeDB::Options::infer()
Returns the value set for the inference in this TypeDBOptions
object.
std::optional< bool >
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable inference |
|
Options&
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.
std::optional< bool >
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable parallel execution |
|
Options&
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.
std::optional< bool >
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable prefetching |
|
Options&
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.
std::optional< int32_t >
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.
Name | Description | Type |
---|---|---|
|
Number of answers that the server should send before the driver issues a fresh request |
|
Options&
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.
std::optional< bool >
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable reading data from any replica |
|
Options&
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.
std::optional< int64_t >
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.
Name | Description | Type |
---|---|---|
|
How long the driver should wait if opening a session or transaction is blocked by a schema write lock |
Options&
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.
std::optional< int64_t >
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.
Name | Description | Type |
---|---|---|
|
timeout that allows the server to close sessions if the driver terminates or becomes unresponsive |
Options&
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.
std::optional< bool >
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
.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable reasoning tracing |
|
Options&
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.
std::optional< int64_t >
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.
Name | Description | Type |
---|---|---|
|
Timeout for killing transactions automatically |
Options&
options.transactionTimeoutMillis(transactionTimeoutMillis);
Transaction
Transaction
Package: TypeDB
A transaction with a TypeDB database.
Name | Type | Description |
---|---|---|
|
|
The |
|
|
The |
|
|
The |
close
void TypeDB::Transaction::close()
Closes the transaction.
void
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.
void
transaction.commit()
forceClose
void TypeDB::Transaction::forceClose()
Closes the transaction.
void
transaction.close()
isOpen
bool TypeDB::Transaction::isOpen() const
Checks whether this transaction is open.
bool
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.
Name | Description | Type |
---|---|---|
|
The callback function. |
void
transaction.onClose(function);
TransactionType
Package: TypeDB
Used to specify the type of transaction.
session.transaction(TransactionType.READ);
Name |
---|
|
|
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Define query to be executed |
|
|
Specify query options |
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The Explainable to be explained |
|
|
Specify query options |
ExplanationIterable
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Fetch query to be executed |
|
|
Specify query options |
JSONIterable
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get query to be executed |
|
|
Specify query options |
ConceptMapIterable
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get Aggregate query to be executed |
|
|
Specify query options |
AggregateFuture
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get Group query to be executed |
|
|
Specify query options |
ConceptMapGroupIterable
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get Group Aggregate query to be executed |
|
|
Specify query options |
ValueGroupIterable
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Insert query to be executed |
|
|
Specify query options |
ConceptMapIterable
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Delete query to be executed |
|
|
Specify query options |
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Undefine query to be executed |
|
|
Specify query options |
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Update query to be executed |
|
|
Specify query options |
ConceptMapIterable
transaction.query.update(query, options)
Answer
ConceptMapGroup
Package: TypeDB
Contains an element of the group query result.
conceptMaps
ConceptMapIterable TypeDB::ConceptMapGroup::conceptMaps()
Retrieves the ConceptMap
s of the group.
ConceptMapIterable
conceptMapGroup.conceptMaps();
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
.
ConceptIterable< Concept >
conceptMap.concepts();
explainables
Explainables TypeDB::ConceptMap::explainables()
Gets the Explainables
object for this ConceptMap
, exposing which of the concepts in this ConceptMap
are explainable.
Explainables
conceptMap.explainables();
get
std::unique_ptr< Concept > TypeDB::ConceptMap::get(const std::string& variableName)
Retrieves a concept for a given variable name.
Name | Description | Type |
---|---|---|
|
The string representation of a variable |
std::unique_ptr< Concept >
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.
std::map< std::string, std::unique_ptr< Concept > >
conceptMap.map();
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.
std::unique_ptr< Concept >
conceptMapGroup.owner()
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
const JSONArray&
asBoolean
const JSONBoolean& TypeDB::JSON::asBoolean() const
if this JSON object holds a boolean value, returns the value. Else throws an exception
const JSONBoolean&
asDouble
const JSONDouble& TypeDB::JSON::asDouble() const
if this JSON object holds a double value, returns the value. Else throws an exception
const JSONDouble&
asLong
const JSONLong& TypeDB::JSON::asLong() const
if this JSON object holds a long value, returns the value. Else throws an exception
const JSONLong&
asMap
const JSONMap& TypeDB::JSON::asMap() const
if this JSON object holds a map, returns the underlying map. Else throws an exception
const JSONMap&
asString
const JSONString& TypeDB::JSON::asString() const
if this JSON object holds a string value, returns the value. Else throws an exception
const JSONString&
isArray
bool TypeDB::JSON::isArray() const
true if this JSON object holds an array, else false
bool
isBoolean
bool TypeDB::JSON::isBoolean() const
true if this JSON object holds a boolean value, else false
bool
isDouble
bool TypeDB::JSON::isDouble() const
true if this JSON object holds a double value, else false
bool
isLong
bool TypeDB::JSON::isLong() const
true if this JSON object holds a long value, else false
bool
isMap
bool TypeDB::JSON::isMap() const
true if this JSON object holds a map, else false
bool
isString
bool TypeDB::JSON::isString() const
true if this JSON object holds a string value, else false
bool
parse
static JSON TypeDB::JSON::parse(const std::string& string)
Parses a JSON string into a JSON
object.
static JSON
JSONType
Package: TypeDB
Specifies the exact type of this JSON object
Name |
---|
|
|
|
|
|
|
|
|
OwnerAttributePair
Package: TypeDB
Simple class holding the owner concept & owned attribute identifying an explainable ownership.
Name | Type | Description |
---|---|---|
|
|
The owned attribute. |
|
|
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.
Name | Description | Type |
---|---|---|
|
The string representation of a variable |
|
Explainable
conceptMap.explainables().attribute(variable);
attributes
StringIterable TypeDB::Explainables::attributes()
Retrieves all of this ConceptMap
’s explainable attributes.
StringIterable
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.
Name | Description | Type |
---|---|---|
|
The string representation of the owner variable |
|
|
The string representation of the attribute variable |
|
Explainable
conceptMap.explainables().ownership(owner, attribute);
ownerships
OwnerAttributePairIterable TypeDB::Explainables::ownerships()
Retrieves all of this ConceptMap
’s explainable ownerships.
OwnerAttributePairIterable
conceptMap.explainables().ownerships();
relation
Explainable TypeDB::Explainables::relation(std::string& variable)
Retrieves the explainable relation with the given variable name.
Name | Description | Type |
---|---|---|
|
The string representation of a variable |
|
Explainable
conceptMap.explainables().relation(variable);
Explainable
Package: TypeDB
Contains an explainable object.
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.
ConceptMap
explanation.conclusion()
condition
ConceptMap TypeDB::Explanation::condition()
Retrieves the Condition for this Explanation.
ConceptMap
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
.
Name | Description | Type |
---|---|---|
|
The query variable to map to rule variables. |
|
std::vector< std::string >
explanation.variableMapping(var)
queryVariables
std::vector< std::string > TypeDB::Explanation::queryVariables()
Retrieves the query variables for this Explanation
.
std::vector< std::string >
explanation.queryVariables()
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.
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
for (auto& element : iterable) { ... }
for (auto it = iterable.begin(); it != iterable.end(); ++it ) { ... } // Note: it++ is deleted.
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>
ValueGroupIterable
Alias for Iterable<_native::ValueGroupIterator, _native::ValueGroup, TypeDB::ValueGroup>
ValueGroupIterator
Alias for Iterator<_native::ValueGroupIterator, _native::ValueGroup, TypeDB::ValueGroup>
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>
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.
Name | Description | Type |
---|---|---|
|
The iid of the |
|
ConceptPtrFuture< Attribute >
transaction.concepts.getAttribute(iid).get();
getAttributeType
ConceptPtrFuture< AttributeType > TypeDB::ConceptManager::getAttributeType(const std::string& label) const
Retrieves an AttributeType
by its label.
Name | Description | Type |
---|---|---|
|
The label of the |
|
ConceptPtrFuture< AttributeType >
transaction.concepts.getAttributeType(label).get();
getEntity
ConceptPtrFuture< Entity > TypeDB::ConceptManager::getEntity(const std::string& iid) const
Retrieves an Entity
by its iid.
Name | Description | Type |
---|---|---|
|
The iid of the |
|
ConceptPtrFuture< Entity >
transaction.concepts.getEntity(iid).get();
getEntityType
ConceptPtrFuture< EntityType > TypeDB::ConceptManager::getEntityType(const std::string& label) const
Retrieves an EntityType
by its label.
Name | Description | Type |
---|---|---|
|
The label of the |
|
ConceptPtrFuture< EntityType >
transaction.concepts.getEntityType(label).get();
getRelation
ConceptPtrFuture< Relation > TypeDB::ConceptManager::getRelation(const std::string& iid) const
Retrieves a Relation
by its iid.
Name | Description | Type |
---|---|---|
|
The iid of the |
|
ConceptPtrFuture< Relation >
transaction.concepts.getRelation(iid).get();
getRelationType
ConceptPtrFuture< RelationType > TypeDB::ConceptManager::getRelationType(const std::string& label) const
Retrieves a RelationType
by its label.
Name | Description | Type |
---|---|---|
|
The label of the |
|
ConceptPtrFuture< RelationType >
transaction.concepts.getRelationType(label).get();
getRootAttributeType
std::unique_ptr< AttributeType > TypeDB::ConceptManager::getRootAttributeType() const
Retrieve the root AttributeType
, “attribute”.
std::unique_ptr< AttributeType >
transaction.concepts.getRootAttributeType();
getRootEntityType
std::unique_ptr< EntityType > TypeDB::ConceptManager::getRootEntityType() const
Retrieves the root EntityType
, “entity”.
std::unique_ptr< EntityType >
transaction.concepts.getRootEntityType();
getRootRelationType
std::unique_ptr< RelationType > TypeDB::ConceptManager::getRootRelationType() const
Retrieve the root RelationType
, “relation”.
std::unique_ptr< RelationType >
transaction.concepts.getRootRelationType();
getSchemaExceptions
std::vector< DriverException > TypeDB::ConceptManager::getSchemaExceptions()
Retrieves a list of all schema exceptions for the current transaction.
std::vector< DriverException >
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.
Name | Description | Type |
---|---|---|
|
The label of the |
|
|
The value type of the |
|
ConceptPtrFuture< AttributeType >
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.
Name | Description | Type |
---|---|---|
|
The label of the |
|
ConceptPtrFuture< EntityType >
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.
Name | Description | Type |
---|---|---|
|
The label of the |
|
ConceptPtrFuture< RelationType >
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
.
Attribute*
concept.asAttribute();
asAttributeType
AttributeType* TypeDB::Concept::asAttributeType()
Casts the concept to EntityType
.
AttributeType*
concept.asEntityType();
asEntity
Entity* TypeDB::Concept::asEntity()
Casts the concept to Entity
.
Entity*
concept.asEntity();
asEntityType
EntityType* TypeDB::Concept::asEntityType()
Casts the concept to EntityType
.
EntityType*
concept.asEntityType();
asRelation
Relation* TypeDB::Concept::asRelation()
Casts the concept to Relation
.
Relation*
concept.asRelation();
asRelationType
RelationType* TypeDB::Concept::asRelationType()
Casts the concept to RelationType
.
RelationType*
concept.asRelationType();
asRoleType
RoleType* TypeDB::Concept::asRoleType()
Casts the concept to RoleType
.
RoleType*
concept.asRoleType();
asThing
Thing* TypeDB::Concept::asThing()
Casts the concept to Thing
.
Thing*
concept.asThing();
asThingType
ThingType* TypeDB::Concept::asThingType()
Casts the concept to ThingType
.
ThingType*
concept.asThingType();
asValue
Value* TypeDB::Concept::asValue()
Casts the concept to Value
.
Value*
concept.asValue();
equals
static bool TypeDB::Concept::equals(Concept* first, Concept* second)
Checks equality of two concepts.
static bool
getConceptType
ConceptType TypeDB::Concept::getConceptType()
Returns the ConceptType of this concept.
ConceptType
switch(concept.getConceptType()) { ... }
isAttribute
bool TypeDB::Concept::isAttribute()
Checks if the concept is a Relation
.
bool
concept.isRelation();
isAttributeType
bool TypeDB::Concept::isAttributeType()
Checks if the concept is an AttributeType
.
bool
concept.isAttributeType();
isEntity
bool TypeDB::Concept::isEntity()
Checks if the concept is an Entity
.
bool
concept.isEntity();
isEntityType
bool TypeDB::Concept::isEntityType()
Checks if the concept is an EntityType
.
bool
concept.isEntityType();
isRelation
bool TypeDB::Concept::isRelation()
Checks if the concept is a Value
.
bool
concept.isValue();
isRelationType
bool TypeDB::Concept::isRelationType()
Checks if the concept is a RelationType
.
bool
concept.isRelationType();
isRoleType
bool TypeDB::Concept::isRoleType()
Checks if the concept is a RoleType
.
bool
concept.isRoleType();
isThing
bool TypeDB::Concept::isThing()
Checks if the concept is a Thing
.
bool
concept.isThing();
isThingType
bool TypeDB::Concept::isThingType()
Checks if the concept is a ThingType
.
bool
concept.isThingType();
isValue
bool TypeDB::Concept::isValue()
Checks if the concept is a Value
.
bool
concept.isValue();
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
virtual VoidFuture
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.
virtual std::string
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< Type >
type.getSubtypes(transaction);
type.getSubtypes(transaction, Transitivity.EXPLICIT);
getSupertype
ConceptPtrFuture< Type > TypeDB::Type::getSupertype(Transaction& transaction)
Retrieves the most immediate supertype of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptPtrFuture< Type >
type.getSupertype(transaction).get();
getSupertypes
ConceptIterable< Type > TypeDB::Type::getSupertypes(Transaction& transaction)
Retrieves all supertypes of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptIterable< Type >
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.
virtual bool
type.isAbstract();
isDeleted
virtual BoolFuture TypeDB::Type::isDeleted(Transaction& transaction)
Check if the type has been deleted
Implemented in TypeDB::RoleType, and TypeDB::ThingType.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
virtual BoolFuture
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The new |
virtual VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
virtual VoidFuture
type.deleteType(transaction).get();
getLabel
virtual std::string TypeDB::ThingType::getLabel()
Retrieves the unique label of the type.
Implements TypeDB::Type.
virtual std::string
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 Annotation
s
ConceptIterable< AttributeType >
getOwns
ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, const std::initializer_list< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)
Variant of getOwns(Transaction&, ValueType, const std::vector<Annotation>&, Transitivity) without filtering on ValueType
ConceptIterable< AttributeType >
getOwns
ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, const std::vector< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)
Variant of getOwns(Transaction&, ValueType, const std::vector<Annotation>&, Transitivity) without filtering on ValueType
ConceptIterable< AttributeType >
getOwns
ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, ValueType valueType, Transitivity transitivity = Transitivity::TRANSITIVE)
Variant of getOwns(Transaction&, ValueType, const std::vector<Annotation>&, Transitivity) without filtering on Annotation
s
ConceptIterable< AttributeType >
getOwns
ConceptIterable< AttributeType > TypeDB::ThingType::getOwns(Transaction& transaction, ValueType valueType, const std::initializer_list< Annotation >& annotations, Transitivity transitivity = Transitivity::TRANSITIVE)
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
If specified, only attribute types of this |
|
|
|
|
|
Only retrieve attribute types owned with annotations. |
|
ConceptIterable< AttributeType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
ConceptPtrFuture< AttributeType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
transitivity: |
ConceptIterable< RoleType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
ConceptPtrFuture< RoleType >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< ThingType >
type.getSubtypes(transaction);
type.getSubtypes(transaction, Transitivity.EXPLICIT);
getSupertype
ConceptPtrFuture< ThingType > TypeDB::ThingType::getSupertype(Transaction& transaction)
Retrieves the most immediate supertype of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptPtrFuture< ThingType >
type.getSupertype(transaction).get();
getSupertypes
ConceptIterable< ThingType > TypeDB::ThingType::getSupertypes(Transaction& transaction)
Retrieves all supertypes of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptIterable< ThingType >
type.getSupertypes(transaction);
getSyntax
StringFuture TypeDB::ThingType::getSyntax(Transaction& transaction)
Produces a pattern for creating this ThingType
in a define
query.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
StringFuture
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.
virtual bool
type.isAbstract();
isDeleted
virtual BoolFuture TypeDB::ThingType::isDeleted(Transaction& transaction)
Check if the type has been deleted
Implements TypeDB::Type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
virtual BoolFuture
type.isDeleted(transaction).get();
isRoot
bool TypeDB::ThingType::isRoot()
Checks if the type is a root type.
bool
type.isRoot();
setAbstract
VoidFuture TypeDB::ThingType::setAbstract(Transaction& transaction)
Set a ThingType
to be abstract, meaning it cannot have instances.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The new |
virtual VoidFuture
type.setLabel(transaction, newLabel).get();
setOwns
VoidFuture TypeDB::ThingType::setOwns(Transaction& transaction, AttributeType* attributeType, const std::initializer_list< Annotation >& annotations = {})
Variant of setOwns(Transaction&, AttributeType*, AttributeType*, const std::vector<Annotation>&) with no overridden attribute type
VoidFuture
setOwns
VoidFuture TypeDB::ThingType::setOwns(Transaction& transaction, AttributeType* attributeType, const std::vector< Annotation >& annotations)
Variant of setOwns(Transaction&, AttributeType*, AttributeType*, const std::vector<Annotation>&) with no overridden attribute type
VoidFuture
setOwns
VoidFuture TypeDB::ThingType::setOwns(Transaction& transaction, AttributeType* attributeType, AttributeType* overriddenType, const std::initializer_list< Annotation >& annotations = {})
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
|
The |
|
|
Adds annotations to the ownership. |
|
VoidFuture
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.
VoidFuture
setPlays
VoidFuture TypeDB::ThingType::setPlays(Transaction& transaction, RoleType* roleType, RoleType* overriddenRoleType)
Allows the instances of this ThingType
to play the given role.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to be played by the instances of this type |
|
|
The role type that this role overrides, if applicable |
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
VoidFuture
thingType.unsetAbstract(transaction).get();
unsetOwns
VoidFuture TypeDB::ThingType::unsetOwns(Transaction& transaction, AttributeType* attributeType)
Disallows the instances of this ThingType
from owning the given AttributeType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to not be played by the instances of this type. |
|
VoidFuture
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptPtrFuture< Entity >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< Entity >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< EntityType >
entityType.getSubtypes(transaction, transitivity);
setSupertype
VoidFuture TypeDB::EntityType::setSupertype(Transaction& transaction, EntityType* superEntityType)
Sets the supplied EntityType
as the supertype of the current EntityType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
VoidFuture
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptPtrFuture< Relation >
relationType.create(transaction).get();
getInstances
ConceptIterable< Relation > TypeDB::RelationType::getInstances(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)
Retrieves Relation
s that are instances of this exact RelationType
, OR this RelationType
and any of its subtypes.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< Relation >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< RoleType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Label of the role we wish to retrieve |
|
ConceptPtrFuture< RoleType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Label of the role that overrides an inherited role |
ConceptPtrFuture< RoleType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Label of the role that overrides an inherited role |
|
ConceptPtrFuture< RoleType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< RelationType >
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.
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.
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The new role for the |
|
|
The label being overridden, if applicable |
|
VoidFuture
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
VoidFuture
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.
VoidFuture
unsetRelates
VoidFuture TypeDB::RelationType::unsetRelates(Transaction& transaction, const std::string& roleLabel)
Disallows this RelationType
from relating to the given role.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to not relate to the relation type. |
|
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
virtual VoidFuture
type.deleteType(transaction).get();
getLabel
virtual std::string TypeDB::RoleType::getLabel()
Retrieves the unique label of the type.
Implements TypeDB::Type.
virtual std::string
type.getLabel();
getName
std::string TypeDB::RoleType::getName()
Returns the name of this role type’s label.
std::string
label.getName();
getPlayerInstances
ConceptIterable< Thing > TypeDB::RoleType::getPlayerInstances(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)
Retrieves the Thing
instances that play this role.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< Thing >
roleType.getPlayerInstances(transaction, transitivity);
getPlayerTypes
ConceptIterable< ThingType > TypeDB::RoleType::getPlayerTypes(Transaction& transaction, Transitivity transitivity = Transitivity::TRANSITIVE)
Retrieves the ThingType
s whose instances play this role.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< ThingType >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< Relation >
roleType.getRelationInstances(transaction, transitivity)
getRelationType
ConceptPtrFuture< RelationType > TypeDB::RoleType::getRelationType(Transaction& transaction)
Retrieves the RelationType
that this role is directly related to.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptPtrFuture< RelationType >
roleType.getRelationType(transaction).get();
getRelationTypes
ConceptIterable< RelationType > TypeDB::RoleType::getRelationTypes(Transaction& transaction)
Retrieves RelationType
s that this role is related to (directly or indirectly).
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptIterable< RelationType >
roleType.getRelationTypes(transaction);
getScope
std::string TypeDB::RoleType::getScope()
Returns the scope part of this role type’s label.
std::string
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< RoleType >
roleType.getSubtypes(transaction, transitivity);
getSupertype
ConceptPtrFuture< RoleType > TypeDB::RoleType::getSupertype(Transaction& transaction)
Retrieves the most immediate supertype of the RoleType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptPtrFuture< RoleType >
roleType.getSupertype(transaction).get();
getSupertypes
ConceptIterable< RoleType > TypeDB::RoleType::getSupertypes(Transaction& transaction)
Retrieves all supertypes of the RoleType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptIterable< RoleType >
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.
virtual bool
type.isAbstract();
isDeleted
virtual BoolFuture TypeDB::RoleType::isDeleted(Transaction& transaction)
Check if the type has been deleted
Implements TypeDB::Type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
virtual BoolFuture
type.isDeleted(transaction).get();
isRoot
bool TypeDB::RoleType::isRoot()
Checks if the type is a root type.
bool
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The new |
virtual VoidFuture
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
ConceptPtrFuture< Attribute >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
ConceptPtrFuture< Attribute >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
ConceptPtrFuture< Attribute >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
ConceptPtrFuture< Attribute >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
ConceptPtrFuture< Attribute >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
ConceptPtrFuture< Attribute >
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
.
Name | Description | Type |
---|---|---|
|
|
|
|
The current transaction |
|
ConceptIterable< Attribute >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< ThingType >
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
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Only retrieve |
|
|
|
ConceptIterable< ThingType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
OptionalStringFuture
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
ConceptIterable< AttributeType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
|
|
ConceptIterable< AttributeType >
attributeType.getSubtypes(transaction, valueType, transitivity);
getValueType
ValueType TypeDB::AttributeType::getValueType()
Retrieves the Value.Type
of this AttributeType
.
ValueType
attributeType.getValueType();
put
ConceptPtrFuture< Attribute > TypeDB::AttributeType::put(Transaction& transaction, Value* value)
Adds and returns an Attribute
of this AttributeType
with the given value.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
ConceptPtrFuture< Attribute >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
ConceptPtrFuture< Attribute >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
ConceptPtrFuture< Attribute >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
ConceptPtrFuture< Attribute >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
ConceptPtrFuture< Attribute >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
ConceptPtrFuture< Attribute >
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 Attribute
s of this type (inserted earlier or later) should match this regex.
Can only be applied for AttributeType
s with a string
value type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Regular expression |
|
VoidFuture
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
VoidFuture
attributeType.setSupertype(transaction, superType).get();
unsetRegex
VoidFuture TypeDB::AttributeType::unsetRegex(Transaction& transaction)
Removes the regular expression that is defined for this AttributeType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
VoidFuture
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.
bool
annotation.isKey();
isUnique
bool TypeDB::Annotation::isUnique()
Checks if this Annotation
is a @unique
annotation.
bool
annotation.isUnique();
key
static Annotation TypeDB::Annotation::key()
Produces a @key
annotation.
static Annotation
ThingType.Annotation.key();
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
VoidFuture
thing.deleteThing(transaction).get();
getHas
ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::initializer_list< Annotation >& annotations = {})
Retrieves the Attribute
s that this Thing
owns, filtered by Annotation
s.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Only retrieve attributes with all given |
ConceptIterable< Attribute >
thing.getHas(transaction);
thing.getHas(transaction, {Annotation.key()}));
getHas
ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const AttributeType* attribute)
ConceptIterable< Attribute >
getHas
ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::vector< std::unique_ptr< AttributeType > >& attributeTypes)
Retrieves the Attribute
s of the specified AttributeType
s that this Thing
owns.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
ConceptIterable< Attribute >
thing.getHas(transaction, attributeTypes);
getHas
ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::vector< const AttributeType* >& attributeTypes)
See getHas(Transaction& transaction, const std::vector<std::unique_ptr<AttributeType& attributeTypes)>>
ConceptIterable< Attribute >
getHas
ConceptIterable< Attribute > TypeDB::Thing::getHas(Transaction& transaction, const std::vector< Annotation >& annotations)
ConceptIterable< Attribute >
getIID
std::string TypeDB::Thing::getIID()
Retrieves the unique id of the Thing
.
std::string
thing.getIID();
getPlaying
ConceptIterable< RoleType > TypeDB::Thing::getPlaying(Transaction& transaction)
Retrieves the roles that this Thing
is currently playing.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptIterable< RoleType >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The array of roles to filter the relations by. |
ConceptIterable< Relation >
thing.getRelations(transaction);
thing.getRelations(transaction, roleTypes);
getRelations
ConceptIterable< Relation > TypeDB::Thing::getRelations(Transaction& transaction, const std::vector< RoleType* >& roleTypes)
ConceptIterable< Relation >
getType
std::unique_ptr< ThingType > TypeDB::Thing::getType()
Retrieves the type which this Thing
belongs to.
std::unique_ptr< ThingType >
thing.getType();
isDeleted
BoolFuture TypeDB::Thing::isDeleted(Transaction& transaction)
Checks if this Thing
is deleted.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
BoolFuture
thing.isDeleted(transaction).get();
isInferred
bool TypeDB::Thing::isInferred()
Checks if this Thing
is inferred by a [Reasoning Rule].
bool
thing.isInferred();
setHas
VoidFuture TypeDB::Thing::setHas(Transaction& transaction, Attribute* attribute)
Assigns an Attribute
to be owned by this Thing
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
VoidFuture
thing.setHas(transaction, attribute).get();
unsetHas
VoidFuture TypeDB::Thing::unsetHas(Transaction& transaction, Attribute* attribute)
Unassigns an Attribute
from this Thing
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
VoidFuture
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.
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to be played by the |
|
|
The thing to play the role |
|
VoidFuture
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
std::map< std::unique_ptr< RoleType >, std::unique_ptr< Thing > >
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
0 or more role types |
|
ConceptIterable< Thing >
relation.getPlayersByRoleType(transaction, roleTypes);
getPlayersByRoleType
ConceptIterable< Thing > TypeDB::Relation::getPlayersByRoleType(Transaction& transaction, const std::vector< RoleType* >& roleTypes)
ConceptIterable< Thing >
getRelating
ConceptIterable< RoleType > TypeDB::Relation::getRelating(Transaction& transaction)
Retrieves all role types currently played in this Relation
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptIterable< RoleType >
relation.getRelating(transaction);
getType
std::unique_ptr< RelationType > TypeDB::Relation::getType()
Retrieves the type which this Relation
belongs to.
std::unique_ptr< RelationType >
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to no longer be played by the thing in this |
|
|
The instance to no longer play the role in this |
|
VoidFuture
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
ConceptIterable< Thing >
attribute.getOwners(transaction);
getOwners
ConceptIterable< Thing > TypeDB::Attribute::getOwners(Transaction& transaction, const ThingType* ownerType)
Retrieves the instances that own this Attribute
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Filter results for only owners of the given type |
|
ConceptIterable< Thing >
attribute.getOwners(transaction, ownerType);
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.
bool
value.asBoolean();
asDateTime
DateTime TypeDB::Value::asDateTime()
Returns a DateTime
value of this value concept. If the value has another type, raises an exception.
DateTime
value.asDatetime();
asDouble
double TypeDB::Value::asDouble()
Returns a double
value of this value concept. If the value has another type, raises an exception.
double
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.
int64_t
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.
std::string
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)
static std::string
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
.
bool
value.isBoolean()
isDateTime
bool TypeDB::Value::isDateTime()
Returns True
if the value which this value concept holds is of type DateTime
. Otherwise, returns false
.
bool
value.isDatetime();
isDouble
bool TypeDB::Value::isDouble()
Returns true
if the value which this value concept holds is of type double
. Otherwise, returns false
.
bool
value.isDouble();
isLong
bool TypeDB::Value::isLong()
Returns true
if the value which this value concept holds is of type long
. Otherwise, returns false
.
bool
value.isLong()
isString
bool TypeDB::Value::isString()
Returns true
if the value which this value concept holds is of type string
. Otherwise, returns false
.
bool
value.isString();
of
static std::unique_ptr< Value > TypeDB::Value::of(bool value)
Creates a new Value object of the specified boolean value.
static std::unique_ptr< Value >
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.
static std::unique_ptr< Value >
Value::of(value);
of
static std::unique_ptr< Value > TypeDB::Value::of(double value)
Creates a new Value object of the specified double value.
static std::unique_ptr< Value >
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.
static std::unique_ptr< Value >
Value::of(value);
of
static std::unique_ptr< Value > TypeDB::Value::of(DateTime value)
Creates a new Value object of the specified DateTime value.
static std::unique_ptr< Value >
Value::of(value);
Logic
LogicManager
Package: TypeDB
Provides methods for manipulating Rule
s in the database.
getRule
OptionalRuleFuture TypeDB::LogicManager::getRule(const std::string& label) const
Retrieves the Rule that has the given label.
Name | Description | Type |
---|---|---|
|
The label of the Rule to create or retrieve |
|
OptionalRuleFuture
transaction.logic.getRule(label).get();
getRules
RuleIterable TypeDB::LogicManager::getRules() const
Retrieves all rules.
RuleIterable
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.
Name | Description | Type |
---|---|---|
|
The label of the Rule to create or replace |
|
|
The when body of the rule to create |
|
|
The then body of the rule to create |
|
RuleFuture
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.
Name | Description | Type |
---|---|---|
|
The current |
|
VoidFuture
rule.deleteRule(transaction).get();
isDeleted
BoolFuture TypeDB::Rule::isDeleted(Transaction& transaction)
Check if this rule has been deleted.
Name | Description | Type |
---|---|---|
|
The current |
|
BoolFuture
rule.isDeleted(transaction).get();
setLabel
VoidFuture TypeDB::Rule::setLabel(Transaction& transaction, const std::string& label)
Renames the label of the rule. The new label must remain unique.
Name | Description | Type |
---|---|---|
|
The current |
|
|
The new label to be given to the rule |
|
VoidFuture
rule.setLabel(transaction, newLabel).get();
then
std::string TypeDB::Rule::then()
The single statement that constitutes the ‘then’ of the rule.
std::string