New ACM paper, free-tier cloud, and open-source license

Java driver API reference

Connection

TypeDB

Package: com.vaticle.typedb.driver

Fields
Name Type Description

DEFAULT_ADDRESS

static java.lang.String

TypeDB

public TypeDB()
Returns

public

cloudDriver

public static TypeDBDriver cloudDriver​(java.lang.String address,
                                       TypeDBCredential credential)

Open a TypeDB Driver to a TypeDB Cloud server available at the provided address, using the provided credential.

Input parameters
Name Description Type

address

The address of the TypeDB server

java.lang.String

credential

The credential to connect with

TypeDBCredential

Returns

public static TypeDBDriver

Code examples
TypeDB.cloudDriver(address, credential);

cloudDriver

public static TypeDBDriver cloudDriver​(java.util.Set<java.lang.String> addresses,
                                       TypeDBCredential 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)

java.util.Set<java.lang.String>

credential

The credential to connect with

TypeDBCredential

Returns

public static TypeDBDriver

Code examples
TypeDB.cloudDriver(addresses, credential);

cloudDriver

public static TypeDBDriver cloudDriver​(java.util.Map<java.lang.String,​java.lang.String> addressTranslation,
                                       TypeDBCredential credential)

Open a TypeDB Driver to TypeDB Cloud server(s), using provided address translation, with the provided credential.

Input parameters
Name Description Type

addressTranslation

Translation map from addresses received from the TypeDB server(s) to addresses to be used by the driver for connection

java.util.Map<java.lang.String,​java.lang.String>

credential

The credential to connect with

TypeDBCredential

Returns

public static TypeDBDriver

Code examples
TypeDB.cloudDriver(addressTranslation, credential);

coreDriver

public static TypeDBDriver coreDriver​(java.lang.String address)

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

Input parameters
Name Description Type

address

The address of the TypeDB server

java.lang.String

Returns

public static TypeDBDriver

Code examples
TypeDB.coreDriver(address);

TypeDBDriver

Package: com.vaticle.typedb.driver.api

Superinterfaces:

  • java.lang.AutoCloseable

close

void close()

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

Returns

void

Code examples
driver.close()

databases

@CheckReturnValue
DatabaseManager databases()

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

Returns

DatabaseManager

isOpen

@CheckReturnValue
boolean isOpen()

Checks whether this connection is presently open.

Returns

boolean

Code examples
driver.isOpen();

session

@CheckReturnValue
TypeDBSession session​(java.lang.String database,
                      TypeDBSession.Type type)

Opens a session to the given database with default options.

Returns

TypeDBSession

session

@CheckReturnValue
TypeDBSession session​(java.lang.String database,
                      TypeDBSession.Type type,
                      TypeDBOptions 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

java.lang.String

type

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

TypeDBSession.Type

options

TypeDBOptions for the session

TypeDBOptions

Returns

TypeDBSession

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

user

@CheckReturnValue
User user()

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

Returns

User

Code examples
driver.user();

users

@CheckReturnValue
UserManager users()

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

Returns

UserManager

Code examples
driver.users();

TypeDBCredential

Package: com.vaticle.typedb.driver.api

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.
 TypeDBCredential credential = new TypeDBCredential(username, password, true);

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

TypeDBCredential

public TypeDBCredential​(java.lang.String username,
                        java.lang.String password,
                        boolean tlsEnabled)
Input parameters
Name Description Type

username

The name of the user to connect as

java.lang.String

password

The password for the user

java.lang.String

tlsEnabled

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

boolean

Returns

public

TypeDBCredential

public TypeDBCredential​(java.lang.String username,
                        java.lang.String password,
                        java.nio.file.Path tlsRootCAPath)
Input parameters
Name Description Type

username

The name of the user to connect as

java.lang.String

password

The password for the user

java.lang.String

tlsRootCAPath

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

java.nio.file.Path

Returns

public

DatabaseManager

Package: com.vaticle.typedb.driver.api.database

Provides access to all database management methods.

all

@CheckReturnValue
java.util.List<Database> all()

Retrieves all databases present on the TypeDB server

Returns

java.util.List<Database>

Code examples
driver.databases().all()

contains

@CheckReturnValue
boolean contains​(java.lang.String name)

Checks if a database with the given name exists

Input parameters
Name Description Type

name

The database name to be checked

java.lang.String

Returns

boolean

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

create

void create​(java.lang.String name)

Create a database with the given name

Input parameters
Name Description Type

name

The name of the database to be created

java.lang.String

Returns

void

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

get

@CheckReturnValue
Database get​(java.lang.String name)

Retrieve the database with the given name.

Input parameters
Name Description Type

name

The name of the database to retrieve

java.lang.String

Returns

Database

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

Database

Package: com.vaticle.typedb.driver.api.database

delete

void delete()

Deletes this database.

Returns

void

Code examples
database.delete()

name

@CheckReturnValue
java.lang.String name()

The database name as a string.

Returns

java.lang.String

preferredReplica

@CheckReturnValue
java.util.Optional<? extends Database.Replica> 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

java.util.Optional<? extends Database.Replica>

Code examples
database.preferredReplica()

primaryReplica

@CheckReturnValue
java.util.Optional<? extends Database.Replica> primaryReplica()

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

Returns

java.util.Optional<? extends Database.Replica>

Code examples
database.primaryReplica()

replicas

@CheckReturnValue
java.util.Set<? extends Database.Replica> replicas()

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

Returns

java.util.Set<? extends Database.Replica>

Code examples
database.replicas()

ruleSchema

@CheckReturnValue
java.lang.String ruleSchema()

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

Returns

java.lang.String

Code examples
database.ruleSchema()

schema

@CheckReturnValue
java.lang.String schema()

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

Returns

java.lang.String

Code examples
database.schema()

typeSchema

@CheckReturnValue
java.lang.String typeSchema()

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

Returns

java.lang.String

Code examples
database.typeSchema()

Database.Replica

Package: com.vaticle.typedb.driver.api.database

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

isPreferred

@CheckReturnValue
boolean 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

boolean

isPrimary

@CheckReturnValue
boolean isPrimary()

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

Returns

boolean

server

@CheckReturnValue
java.lang.String server()

The server hosting this replica

Returns

java.lang.String

term

@CheckReturnValue
long term()

The raft protocol ‘term’ of this replica.

Returns

long

UserManager

Package: com.vaticle.typedb.driver.api.user

Provides access to all user management methods.

all

java.util.Set<User> all()

Retrieves all users which exist on the TypeDB server.

Returns

java.util.Set<User>

Code examples
driver.users().all();

contains

@CheckReturnValue
boolean contains​(java.lang.String username)

Checks if a user with the given name exists.

Input parameters
Name Description Type

username

The user name to be checked

java.lang.String

Returns

boolean

Code examples
driver.users().contains(username);

create

void create​(java.lang.String username,
            java.lang.String password)

Creates a user with the given name & password.

Input parameters
Name Description Type

username

The name of the user to be created

java.lang.String

password

The password of the user to be created

java.lang.String

Returns

void

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

delete

void delete​(java.lang.String username)

Deletes a user with the given name.

Input parameters
Name Description Type

username

The name of the user to be deleted

java.lang.String

Returns

void

Code examples
driver.users().delete(username);

get

@CheckReturnValue
User get​(java.lang.String username)

Retrieves a user with the given name.

Input parameters
Name Description Type

username

The name of the user to retrieve

java.lang.String

Returns

User

Code examples
driver.users().get(username);

passwordSet

void passwordSet​(java.lang.String username,
                 java.lang.String password)

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

java.lang.String

password

The new password

java.lang.String

Returns

void

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

User

Package: com.vaticle.typedb.driver.api.user

TypeDB user information

passwordExpirySeconds

java.util.Optional<java.lang.Long> passwordExpirySeconds()

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

Returns

java.util.Optional<java.lang.Long>

passwordUpdate

void passwordUpdate​(java.lang.String passwordOld,
                    java.lang.String passwordNew)

Updates the password for this user.

Input parameters
Name Description Type

passwordOld

The current password of this user

java.lang.String

passwordNew

The new password

java.lang.String

Returns

void

username

@CheckReturnValue
java.lang.String username()

Returns the name of this user.

Returns

java.lang.String

Session

TypeDBSession

Package: com.vaticle.typedb.driver.api

Superinterfaces:

  • java.lang.AutoCloseable

close

void close()

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

Returns

void

Code examples
session.close();

databaseName

@CheckReturnValue
java.lang.String databaseName()

Returns the name of the database of the session.

Returns

java.lang.String

Code examples
session.databaseName();

isOpen

@CheckReturnValue
boolean isOpen()

Checks whether this session is open.

Returns

boolean

Code examples
session.isOpen();

onClose

void onClose​(java.lang.Runnable function)

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

Input parameters
Name Description Type

function

The callback function.

java.lang.Runnable

Returns

void

Code examples
session.onClose(function)

onReopen

void onReopen​(java.lang.Runnable function)

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.

java.lang.Runnable

Returns

void

Code examples
session.onReopen(function)

options

@CheckReturnValue
TypeDBOptions options()

Gets the options for the session

Returns

TypeDBOptions

transaction

@CheckReturnValue
TypeDBTransaction transaction​(TypeDBTransaction.Type type)

Opens a transaction on the database connected to the session with default options.

Returns

TypeDBTransaction

transaction

@CheckReturnValue
TypeDBTransaction transaction​(TypeDBTransaction.Type type,
                              TypeDBOptions options)

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)

TypeDBTransaction.Type

options

Options for the session

TypeDBOptions

Returns

TypeDBTransaction

Code examples
session.transaction(transactionType, options);

type

@CheckReturnValue
TypeDBSession.Type type()

The current session’s type (SCHEMA or DATA)

Returns

TypeDBSession.Type

TypeDBSession.Type

Package: com.vaticle.typedb.driver.api

Used to specify the type of the session.

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

DATA

SCHEMA

id

public int id()
Returns

public int

isData

public boolean isData()
Returns

public boolean

isSchema

public boolean isSchema()
Returns

public boolean

valueOf

public static TypeDBSession.Type valueOf​(java.lang.String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Input parameters
Name Description Type

name

the name of the enum constant to be returned.

java.lang.String

Returns

public static TypeDBSession.Type

values

public static TypeDBSession.Type[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

for (TypeDBSession.Type c : TypeDBSession.Type.values())
    System.out.println(c);
Returns

public static TypeDBSession.Type[]

Code examples
for (TypeDBSession.Type c : TypeDBSession.Type.values())
    System.out.println(c);

TypeDBOptions

Package: com.vaticle.typedb.driver.api

TypeDB session and transaction options. TypeDBOptions object can be used to override the default server behaviour.

TypeDBOptions

public TypeDBOptions()

Produces a new TypeDBOptions object.

Returns

public

Code examples
TypeDBOptions options = TypeDBOptions();

explain

@CheckReturnValue
public java.util.Optional<java.lang.Boolean> explain()

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

Returns

public java.util.Optional<java.lang.Boolean>

Code examples
options.explain();

explain

public TypeDBOptions explain​(boolean 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

boolean

Returns

public TypeDBOptions

Code examples
options.explain(explain);

infer

@CheckReturnValue
public java.util.Optional<java.lang.Boolean> infer()

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

Returns

public java.util.Optional<java.lang.Boolean>

Code examples
options.infer();

infer

public TypeDBOptions infer​(boolean 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

boolean

Returns

public TypeDBOptions

Code examples
options.infer(infer);

parallel

@CheckReturnValue
public java.util.Optional<java.lang.Boolean> 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

public java.util.Optional<java.lang.Boolean>

Code examples
options.parallel();

parallel

public TypeDBOptions parallel​(boolean 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

boolean

Returns

public TypeDBOptions

Code examples
options.parallel(parallel);

prefetch

@CheckReturnValue
public java.util.Optional<java.lang.Boolean> 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

public java.util.Optional<java.lang.Boolean>

Code examples
options.prefetch();

prefetch

public TypeDBOptions prefetch​(boolean 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

boolean

Returns

public TypeDBOptions

Code examples
options.prefetch(prefetch);

prefetchSize

@CheckReturnValue
public java.util.Optional<java.lang.Integer> 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

public java.util.Optional<java.lang.Integer>

Code examples
options.prefetchSize();

prefetchSize

public TypeDBOptions prefetchSize​(int 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

int

Returns

public TypeDBOptions

Code examples
options.prefetchSize(prefetchSize);

readAnyReplica

@CheckReturnValue
public java.util.Optional<java.lang.Boolean> 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

public java.util.Optional<java.lang.Boolean>

Code examples
options.readAnyReplica();

readAnyReplica

public TypeDBOptions readAnyReplica​(boolean 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

boolean

Returns

public TypeDBOptions

Code examples
options.readAnyReplica(readAnyReplica);

schemaLockAcquireTimeoutMillis

public java.util.Optional<java.lang.Integer> 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

public java.util.Optional<java.lang.Integer>

Code examples
options.schemaLockAcquireTimeoutMillis();

schemaLockAcquireTimeoutMillis

public TypeDBOptions schemaLockAcquireTimeoutMillis​(int schemaLockAcquireTimeoutMillis)

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

int

Returns

public TypeDBOptions

Code examples
options.schemaLockAcquireTimeoutMillis(schemaLockAcquireTimeoutMillis);

sessionIdleTimeoutMillis

@CheckReturnValue
public java.util.Optional<java.lang.Integer> 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

public java.util.Optional<java.lang.Integer>

Code examples
options.sessionIdleTimeoutMillis();

sessionIdleTimeoutMillis

public TypeDBOptions sessionIdleTimeoutMillis​(int sessionIdleTimeoutMillis)

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

int

Returns

public TypeDBOptions

Code examples
options.sessionIdleTimeoutMillis(sessionIdleTimeoutMillis);

traceInference

@CheckReturnValue
public java.util.Optional<java.lang.Boolean> 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

public java.util.Optional<java.lang.Boolean>

Code examples
options.traceInference();

traceInference

public TypeDBOptions traceInference​(boolean 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

boolean

Returns

public TypeDBOptions

Code examples
options.traceInference(traceInference);

transactionTimeoutMillis

@CheckReturnValue
public java.util.Optional<java.lang.Integer> 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

public java.util.Optional<java.lang.Integer>

Code examples
options.transactionTimeoutMillis();

transactionTimeoutMillis

public TypeDBOptions transactionTimeoutMillis​(int transactionTimeoutMillis)

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

int

Returns

public TypeDBOptions

Code examples
options.transactionTimeoutMillis(transactionTimeoutMillis);

Transaction

TypeDBTransaction

Package: com.vaticle.typedb.driver.api

Superinterfaces:

  • java.lang.AutoCloseable

close

void close()

Closes the transaction.

Returns

void

Code examples
transaction.close()

commit

void commit()

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

Returns

void

Code examples
transaction.commit()

concepts

@CheckReturnValue
ConceptManager concepts()

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

Returns

ConceptManager

isOpen

@CheckReturnValue
boolean isOpen()

Checks whether this transaction is open.

Returns

boolean

Code examples
transaction.isOpen();

logic

@CheckReturnValue
LogicManager logic()

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

Returns

LogicManager

onClose

void onClose​(java.util.function.Consumer<java.lang.Throwable> function)

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

Input parameters
Name Description Type

function

The callback function.

java.util.function.Consumer<java.lang.Throwable>

Returns

void

Code examples
transaction.onClose(function);

options

@CheckReturnValue
TypeDBOptions options()

The options for the transaction

Returns

TypeDBOptions

query

@CheckReturnValue
QueryManager query()

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

Returns

QueryManager

rollback

void rollback()

Rolls back the uncommitted changes made via this transaction.

Returns

void

Code examples
transaction.rollback()

type

@CheckReturnValue
TypeDBTransaction.Type type()

The transaction’s type (READ or WRITE)

Returns

TypeDBTransaction.Type

TypeDBTransaction.Type

Package: com.vaticle.typedb.driver.api

Used to specify the type of transaction.

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

READ

WRITE

id

public int id()
Returns

public int

isRead

public boolean isRead()
Returns

public boolean

isWrite

public boolean isWrite()
Returns

public boolean

valueOf

public static TypeDBTransaction.Type valueOf​(java.lang.String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Input parameters
Name Description Type

name

the name of the enum constant to be returned.

java.lang.String

Returns

public static TypeDBTransaction.Type

values

public static TypeDBTransaction.Type[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

for (TypeDBTransaction.Type c : TypeDBTransaction.Type.values())
    System.out.println(c);
Returns

public static TypeDBTransaction.Type[]

Code examples
for (TypeDBTransaction.Type c : TypeDBTransaction.Type.values())
    System.out.println(c);

QueryManager

Package: com.vaticle.typedb.driver.api.query

Provides methods for executing TypeQL queries in the transaction.

define

@CheckReturnValue
Promise<java.lang.Void> define​(com.vaticle.typeql.lang.query.TypeQLDefine query)

Performs a TypeQL Define query with default options.

Returns

Promise<java.lang.Void>

define

@CheckReturnValue
Promise<java.lang.Void> define​(com.vaticle.typeql.lang.query.TypeQLDefine query,
                               TypeDBOptions options)

Performs a TypeQL Define query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Define query to be executed

com.vaticle.typeql.lang.query.TypeQLDefine

options

Specify query options

TypeDBOptions

Returns

Promise<java.lang.Void>

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

define

@CheckReturnValue
Promise<java.lang.Void> define​(java.lang.String query)

Performs a TypeQL Define query with default options.

Returns

Promise<java.lang.Void>

define

@CheckReturnValue
Promise<java.lang.Void> define​(java.lang.String query,
                               TypeDBOptions options)
Returns

Promise<java.lang.Void>

delete

@CheckReturnValue
Promise<java.lang.Void> delete​(com.vaticle.typeql.lang.query.TypeQLDelete query)

Performs a TypeQL Delete query with default options.

Returns

Promise<java.lang.Void>

delete

@CheckReturnValue
Promise<java.lang.Void> delete​(com.vaticle.typeql.lang.query.TypeQLDelete query,
                               TypeDBOptions options)

Performs a TypeQL Delete query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Delete query to be executed

com.vaticle.typeql.lang.query.TypeQLDelete

options

Specify query options

TypeDBOptions

Returns

Promise<java.lang.Void>

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

delete

@CheckReturnValue
Promise<java.lang.Void> delete​(java.lang.String query)

Performs a TypeQL Delete query with default options.

Returns

Promise<java.lang.Void>

delete

@CheckReturnValue
Promise<java.lang.Void> delete​(java.lang.String query,
                               TypeDBOptions options)
Returns

Promise<java.lang.Void>

explain

@CheckReturnValue
java.util.stream.Stream<Explanation> explain​(ConceptMap.Explainable explainable)

Performs a TypeQL Explain query with default options.

Returns

java.util.stream.Stream<Explanation>

explain

@CheckReturnValue
java.util.stream.Stream<Explanation> explain​(ConceptMap.Explainable explainable,
                                             TypeDBOptions options)

Performs a TypeQL Explain query in the transaction.

Input parameters
Name Description Type

explainable

The Explainable to be explained

ConceptMap.Explainable

options

Specify query options

TypeDBOptions

Returns

java.util.stream.Stream<Explanation>

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

fetch

@CheckReturnValue
java.util.stream.Stream<JSON> fetch​(com.vaticle.typeql.lang.query.TypeQLFetch query)

Performs a TypeQL Fetch (Fetch) with default options.

Returns

java.util.stream.Stream<JSON>

fetch

@CheckReturnValue
java.util.stream.Stream<JSON> fetch​(com.vaticle.typeql.lang.query.TypeQLFetch query,
                                    TypeDBOptions options)

Performs a TypeQL Fetch (Fetch) query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Fetch (Fetch) query to be executed

com.vaticle.typeql.lang.query.TypeQLFetch

options

Specify query options

TypeDBOptions

Returns

java.util.stream.Stream<JSON>

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

fetch

@CheckReturnValue
java.util.stream.Stream<JSON> fetch​(java.lang.String query)

Performs a TypeQL Fetch (Fetch) with default options.

Returns

java.util.stream.Stream<JSON>

fetch

@CheckReturnValue
java.util.stream.Stream<JSON> fetch​(java.lang.String query,
                                    TypeDBOptions options)
Returns

java.util.stream.Stream<JSON>

get

@CheckReturnValue
java.util.stream.Stream<ConceptMap> get​(com.vaticle.typeql.lang.query.TypeQLGet query)

Performs a TypeQL Get (Get) with default options.

Returns

java.util.stream.Stream<ConceptMap>

get

@CheckReturnValue
java.util.stream.Stream<ConceptMap> get​(com.vaticle.typeql.lang.query.TypeQLGet query,
                                        TypeDBOptions options)

Performs a TypeQL Get (Get) query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get (Get) query to be executed

com.vaticle.typeql.lang.query.TypeQLGet

options

Specify query options

TypeDBOptions

Returns

java.util.stream.Stream<ConceptMap>

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

get

@CheckReturnValue
java.util.stream.Stream<ConceptMap> get​(java.lang.String query)

Performs a TypeQL Get (Get) with default options.

Returns

java.util.stream.Stream<ConceptMap>

get

@CheckReturnValue
java.util.stream.Stream<ConceptMap> get​(java.lang.String query,
                                        TypeDBOptions options)
Returns

java.util.stream.Stream<ConceptMap>

get

@CheckReturnValue
Promise<java.util.Optional<Value>> get​(com.vaticle.typeql.lang.query.TypeQLGet.Aggregate query)

Performs a TypeQL Get Aggregate query with default options.

Returns

Promise<java.util.Optional<Value>>

get

@CheckReturnValue
Promise<java.util.Optional<Value>> get​(com.vaticle.typeql.lang.query.TypeQLGet.Aggregate query,
                                       TypeDBOptions options)

Performs a TypeQL Get Aggregate query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get Aggregate query to be executed

com.vaticle.typeql.lang.query.TypeQLGet.Aggregate

options

Specify query options

TypeDBOptions

Returns

Promise<java.util.Optional<Value>>

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

get

@CheckReturnValue
java.util.stream.Stream<ConceptMapGroup> get​(com.vaticle.typeql.lang.query.TypeQLGet.Group query)

Performs a TypeQL Get Group query with default options.

Returns

java.util.stream.Stream<ConceptMapGroup>

get

@CheckReturnValue
java.util.stream.Stream<ConceptMapGroup> get​(com.vaticle.typeql.lang.query.TypeQLGet.Group query,
                                             TypeDBOptions options)

Performs a TypeQL Get Group query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Get Group query to be executed

com.vaticle.typeql.lang.query.TypeQLGet.Group

options

Specify query options

TypeDBOptions

Returns

java.util.stream.Stream<ConceptMapGroup>

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

get

@CheckReturnValue
java.util.stream.Stream<ValueGroup> get​(com.vaticle.typeql.lang.query.TypeQLGet.Group.Aggregate query)

Performs a TypeQL Get Group Aggregate query with default options.

Returns

java.util.stream.Stream<ValueGroup>

get

@CheckReturnValue
java.util.stream.Stream<ValueGroup> get​(com.vaticle.typeql.lang.query.TypeQLGet.Group.Aggregate query,
                                        TypeDBOptions options)

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

com.vaticle.typeql.lang.query.TypeQLGet.Group.Aggregate

options

Specify query options

TypeDBOptions

Returns

java.util.stream.Stream<ValueGroup>

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

getAggregate

@CheckReturnValue
Promise<java.util.Optional<Value>> getAggregate​(java.lang.String query)

Performs a TypeQL Get Aggregate query with default options.

Returns

Promise<java.util.Optional<Value>>

getAggregate

@CheckReturnValue
Promise<java.util.Optional<Value>> getAggregate​(java.lang.String query,
                                                TypeDBOptions options)
Returns

Promise<java.util.Optional<Value>>

getGroup

@CheckReturnValue
java.util.stream.Stream<ConceptMapGroup> getGroup​(java.lang.String query)

Performs a TypeQL Get Group query with default options.

Returns

java.util.stream.Stream<ConceptMapGroup>

getGroup

@CheckReturnValue
java.util.stream.Stream<ConceptMapGroup> getGroup​(java.lang.String query,
                                                  TypeDBOptions options)
Returns

java.util.stream.Stream<ConceptMapGroup>

getGroupAggregate

@CheckReturnValue
java.util.stream.Stream<ValueGroup> getGroupAggregate​(java.lang.String query)

Performs a TypeQL Get Group Aggregate query with default options.

Returns

java.util.stream.Stream<ValueGroup>

getGroupAggregate

@CheckReturnValue
java.util.stream.Stream<ValueGroup> getGroupAggregate​(java.lang.String query,
                                                      TypeDBOptions options)
Returns

java.util.stream.Stream<ValueGroup>

insert

java.util.stream.Stream<ConceptMap> insert​(com.vaticle.typeql.lang.query.TypeQLInsert query)

Performs a TypeQL Insert query with default options.

Returns

java.util.stream.Stream<ConceptMap>

insert

java.util.stream.Stream<ConceptMap> insert​(com.vaticle.typeql.lang.query.TypeQLInsert query,
                                           TypeDBOptions options)

Performs a TypeQL Insert query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Insert query to be executed

com.vaticle.typeql.lang.query.TypeQLInsert

options

Specify query options

TypeDBOptions

Returns

java.util.stream.Stream<ConceptMap>

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

insert

java.util.stream.Stream<ConceptMap> insert​(java.lang.String query)

Performs a TypeQL Insert query with default options.

Returns

java.util.stream.Stream<ConceptMap>

insert

java.util.stream.Stream<ConceptMap> insert​(java.lang.String query,
                                           TypeDBOptions options)
Returns

java.util.stream.Stream<ConceptMap>

undefine

@CheckReturnValue
Promise<java.lang.Void> undefine​(com.vaticle.typeql.lang.query.TypeQLUndefine query)

Performs a TypeQL Undefine query with default options.

Returns

Promise<java.lang.Void>

undefine

@CheckReturnValue
Promise<java.lang.Void> undefine​(com.vaticle.typeql.lang.query.TypeQLUndefine query,
                                 TypeDBOptions options)

Performs a TypeQL Undefine query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Undefine query to be executed

com.vaticle.typeql.lang.query.TypeQLUndefine

options

Specify query options

TypeDBOptions

Returns

Promise<java.lang.Void>

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

undefine

@CheckReturnValue
Promise<java.lang.Void> undefine​(java.lang.String query)

Performs a TypeQL Undefine query with default options.

Returns

Promise<java.lang.Void>

undefine

@CheckReturnValue
Promise<java.lang.Void> undefine​(java.lang.String query,
                                 TypeDBOptions options)
Returns

Promise<java.lang.Void>

update

java.util.stream.Stream<ConceptMap> update​(com.vaticle.typeql.lang.query.TypeQLUpdate query)

Performs a TypeQL Update query with default options.

Returns

java.util.stream.Stream<ConceptMap>

update

java.util.stream.Stream<ConceptMap> update​(com.vaticle.typeql.lang.query.TypeQLUpdate query,
                                           TypeDBOptions options)

Performs a TypeQL Update query in the transaction.

Input parameters
Name Description Type

query

The TypeQL Update query to be executed

com.vaticle.typeql.lang.query.TypeQLUpdate

options

Specify query options

TypeDBOptions

Returns

java.util.stream.Stream<ConceptMap>

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

update

java.util.stream.Stream<ConceptMap> update​(java.lang.String query)

Performs a TypeQL Update query with default options.

Returns

java.util.stream.Stream<ConceptMap>

update

java.util.stream.Stream<ConceptMap> update​(java.lang.String query,
                                           TypeDBOptions options)
Returns

java.util.stream.Stream<ConceptMap>

Answer

ConceptMapGroup

Package: com.vaticle.typedb.driver.api.answer

Contains an element of the group query result.

conceptMaps

@CheckReturnValue
java.util.stream.Stream<ConceptMap> conceptMaps()

Retrieves the ConceptMaps of the group.

Returns

java.util.stream.Stream<ConceptMap>

Code examples
conceptMapGroup.conceptMaps();

owner

@CheckReturnValue
Concept owner()

Retrieves the concept that is the group owner.

Returns

Concept

Code examples
conceptMapGroup.owner();

ConceptMap

Package: com.vaticle.typedb.driver.api.answer

Contains a mapping of variables to concepts.

concepts

@CheckReturnValue
java.util.stream.Stream<Concept> concepts()

Produces a stream over all concepts in this ConceptMap.

Returns

java.util.stream.Stream<Concept>

Code examples
conceptMap.concepts();

explainables

ConceptMap.Explainables explainables()

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

Returns

ConceptMap.Explainables

Code examples
conceptMap.explainables();

get

@CheckReturnValue
Concept get​(java.lang.String variable)

Retrieves a concept for a given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

java.lang.String

Returns

Concept

Code examples
conceptMap.get(variable);

map

@CheckReturnValue
java.util.Map<java.lang.String,​Concept> map()

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

Returns

java.util.Map<java.lang.String,​Concept>

Code examples
conceptMap.map();

variables

@CheckReturnValue
java.util.stream.Stream<java.lang.String> variables()

Produces a stream over all variables in this ConceptMap.

Returns

java.util.stream.Stream<java.lang.String>

Code examples
conceptMap.variables();

ValueGroup

Package: com.vaticle.typedb.driver.api.answer

Contains an element of the group aggregate query result.

owner

@CheckReturnValue
Concept owner()

Retrieves the concept that is the group owner.

Returns

Concept

Code examples
conceptMapGroup.owner()

value

@CheckReturnValue
java.util.Optional<Value> value()

Retrieves the Value answer of the group.

Returns

java.util.Optional<Value>

Code examples
valueGroup.value();

JSON

Package: com.vaticle.typedb.driver.api.answer

JSON

public JSON()
Returns

public

asArray

public java.util.List<JSON> asArray()
Returns

public java.util.List<JSON>

asBoolean

public boolean asBoolean()
Returns

public boolean

asNumber

public double asNumber()
Returns

public double

asObject

public java.util.Map<java.lang.String,​JSON> asObject()
Returns

public java.util.Map<java.lang.String,​JSON>

asString

public java.lang.String asString()
Returns

public java.lang.String

isArray

public boolean isArray()
Returns

public boolean

isBoolean

public boolean isBoolean()
Returns

public boolean

isNumber

public boolean isNumber()
Returns

public boolean

isObject

public boolean isObject()
Returns

public boolean

isString

public boolean isString()
Returns

public boolean

parse

public static JSON parse​(java.lang.String string)
Returns

public static JSON

Promise<T>

Package: com.vaticle.typedb.driver.common

A Promise represents an asynchronous network operation.

The request it represents is performed immediately. The response is only retrieved once the Promise is resolved.

Promise

public Promise​(java.util.function.Supplier<T> inner)

Promise constructor

Input parameters
Name Description Type

inner

The supplier to function to wrap into the promise

java.util.function.Supplier<T>

Returns

public

Code examples
new Promise(supplier)

map

public static <T,​U> Promise<U> map​(java.util.function.Supplier<T> promise,
                                         java.util.function.Function<T,​U> fn)

Helper function to map promises.

Input parameters
Name Description Type

promise

The supplier function to wrap into the promise

java.util.function.Supplier<T>

fn

The mapping function

java.util.function.Function<T,​U>

Returns

public static <T,​U> Promise<U>

Code examples
Promise.map(supplier, mapper);

resolve

public T resolve()

Retrieves the result of the Promise.

Returns

public T

Code examples
promise.resolve()

ConceptMap.Explainables

Package: com.vaticle.typedb.driver.api.answer

Contains explainable objects.

attribute

ConceptMap.Explainable attribute​(java.lang.String variable)

Retrieves the explainable attribute with the given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

java.lang.String

Returns

ConceptMap.Explainable

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

attributes

java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<java.lang.String,​ConceptMap.Explainable>> attributes()

Retrieves all of this ConceptMap’s explainable attributes.

Returns

java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<java.lang.String,​ConceptMap.Explainable>>

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

ownership

ConceptMap.Explainable ownership​(java.lang.String owner,
                                 java.lang.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

java.lang.String

attribute

The string representation of the attribute variable

java.lang.String

Returns

ConceptMap.Explainable

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

ownerships

java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<com.vaticle.typedb.common.collection.Pair<java.lang.String,​java.lang.String>,​ConceptMap.Explainable>> ownerships()

Retrieves all of this ConceptMap’s explainable ownerships.

Returns

java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<com.vaticle.typedb.common.collection.Pair<java.lang.String,​java.lang.String>,​ConceptMap.Explainable>>

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

relation

ConceptMap.Explainable relation​(java.lang.String variable)

Retrieves the explainable relation with the given variable name.

Input parameters
Name Description Type

variable

The string representation of a variable

java.lang.String

Returns

ConceptMap.Explainable

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

relations

java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<java.lang.String,​ConceptMap.Explainable>> relations()

Retrieves all of this ConceptMap’s explainable relations.

Returns

java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<java.lang.String,​ConceptMap.Explainable>>

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

ConceptMap.Explainable

Package: com.vaticle.typedb.driver.api.answer

Contains an explainable object.

conjunction

java.lang.String conjunction()

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

Returns

java.lang.String

Code examples
explainable.conjunction();

id

long id()

Retrieves the unique ID that identifies this Explainable.

Returns

long

Code examples
explainable.id();

Explanation

Package: com.vaticle.typedb.driver.api.logic

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 conclusion()

Retrieves the Conclusion for this Explanation.

Returns

ConceptMap

Code examples
explanation.conclusion()

condition

ConceptMap condition()

Retrieves the Condition for this Explanation.

Returns

ConceptMap

Code examples
explanation.condition()

queryVariableMapping

java.util.Set<java.lang.String> queryVariableMapping​(java.lang.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.

java.lang.String

Returns

java.util.Set<java.lang.String>

Code examples
explanation.variableMapping(var)

queryVariables

java.util.Set<java.lang.String> queryVariables()

Retrieves the query variables for this Explanation.

Returns

java.util.Set<java.lang.String>

Code examples
explanation.queryVariables()

rule

Rule rule()

Retrieves the Rule for this Explanation.

Returns

Rule

Code examples
explanation.rule()

Concept

ConceptManager

Package: com.vaticle.typedb.driver.api.concept

Provides access for all Concept API methods.

getAttribute

@CheckReturnValue
Promise<? extends Attribute> getAttribute​(java.lang.String iid)

Retrieves an Attribute by its iid.

Input parameters
Name Description Type

iid

The iid of the Attribute to retrieve

java.lang.String

Returns

Promise<? extends Attribute>

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

getAttributeType

@CheckReturnValue
Promise<? extends AttributeType> getAttributeType​(java.lang.String label)

Retrieves an AttributeType by its label.

Input parameters
Name Description Type

label

The label of the AttributeType to retrieve

java.lang.String

Returns

Promise<? extends AttributeType>

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

getEntity

@CheckReturnValue
Promise<? extends Entity> getEntity​(java.lang.String iid)

Retrieves an Entity by its iid.

Input parameters
Name Description Type

iid

The iid of the Entity to retrieve

java.lang.String

Returns

Promise<? extends Entity>

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

getEntityType

@CheckReturnValue
Promise<? extends EntityType> getEntityType​(java.lang.String label)

Retrieves an EntityType by its label.

Input parameters
Name Description Type

label

The label of the EntityType to retrieve

java.lang.String

Returns

Promise<? extends EntityType>

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

getRelation

@CheckReturnValue
Promise<? extends Relation> getRelation​(java.lang.String iid)

Retrieves a Relation by its iid.

Input parameters
Name Description Type

iid

The iid of the Relation to retrieve

java.lang.String

Returns

Promise<? extends Relation>

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

getRelationType

@CheckReturnValue
Promise<? extends RelationType> getRelationType​(java.lang.String label)

Retrieves a RelationType by its label.

Input parameters
Name Description Type

label

The label of the RelationType to retrieve

java.lang.String

Returns

Promise<? extends RelationType>

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

getRootAttributeType

@CheckReturnValue
AttributeType getRootAttributeType()

Retrieve the root AttributeType, “attribute”.

Returns

AttributeType

Code examples
transaction.concepts().getRootAttributeType();

getRootEntityType

@CheckReturnValue
EntityType getRootEntityType()

Retrieves the root EntityType, “entity”.

Returns

EntityType

Code examples
transaction.concepts().getRootEntityType();

getRootRelationType

@CheckReturnValue
RelationType getRootRelationType()

Retrieve the root RelationType, “relation”.

Returns

RelationType

Code examples
transaction.concepts().getRootRelationType();

getSchemaExceptions

@CheckReturnValue
java.util.List<com.vaticle.typedb.driver.common.exception.TypeDBException> getSchemaExceptions()

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

Returns

java.util.List<com.vaticle.typedb.driver.common.exception.TypeDBException>

Code examples
transaction.concepts().getSchemaException();

putAttributeType

@CheckReturnValue
Promise<? extends AttributeType> putAttributeType​(java.lang.String label,
                                                  Value.Type valueType)

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

java.lang.String

valueType

The value type of the AttributeType to create

Value.Type

Returns

Promise<? extends AttributeType>

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

putEntityType

@CheckReturnValue
Promise<? extends EntityType> putEntityType​(java.lang.String label)

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

java.lang.String

Returns

Promise<? extends EntityType>

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

putRelationType

@CheckReturnValue
Promise<? extends RelationType> putRelationType​(java.lang.String label)

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

java.lang.String

Returns

Promise<? extends RelationType>

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

Concept

Package: com.vaticle.typedb.driver.api.concept

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asType

default Type asType()

Casts the concept to Type.

Returns

Type

Code examples
concept.asType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isType

@CheckReturnValue
default boolean isType()

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

Schema

Type

Package: com.vaticle.typedb.driver.api.concept.type

Superinterfaces:

  • Concept

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asType

@CheckReturnValue
default Type asType()

Casts the concept to Type.

Returns

Type

Code examples
concept.asType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

delete

@CheckReturnValue
Promise<java.lang.Void> delete​(TypeDBTransaction transaction)

Deletes this type from the database.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.Void>

Code examples
type.delete(transaction).resolve();

getLabel

@CheckReturnValue
Label getLabel()

Retrieves the unique label of the type.

Returns

Label

Code examples
type.getLabel();

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends Type> getSubtypes​(TypeDBTransaction transaction)

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

Returns

java.util.stream.Stream<? extends Type>

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends Type> getSubtypes​(TypeDBTransaction transaction,
                                                    Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends Type>

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

getSupertype

@CheckReturnValue
Promise<? extends Type> getSupertype​(TypeDBTransaction transaction)

Retrieves the most immediate supertype of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<? extends Type>

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

getSupertypes

@CheckReturnValue
java.util.stream.Stream<? extends Type> getSupertypes​(TypeDBTransaction transaction)

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends Type>

Code examples
type.getSupertypes(transaction);

isAbstract

@CheckReturnValue
boolean isAbstract()

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

Returns

boolean

Code examples
type.isAbstract();

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isDeleted

@CheckReturnValue
Promise<java.lang.Boolean> isDeleted​(TypeDBTransaction transaction)

Check if the concept has been deleted

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.Boolean>

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

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isRoot

@CheckReturnValue
boolean isRoot()

Checks if the type is a root type.

Returns

boolean

Code examples
type.isRoot();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isType

@CheckReturnValue
default boolean isType()

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

setLabel

@CheckReturnValue
Promise<java.lang.Void> setLabel​(TypeDBTransaction transaction,
                                 java.lang.String label)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

label

The new Label to be given to the type.

java.lang.String

Returns

Promise<java.lang.Void>

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

Label

Package: com.vaticle.typedb.driver.common

A Label holds the uniquely identifying name of a type.

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

equals

public boolean equals​(java.lang.Object obj)

Checks if this Label is equal to another object.

Input parameters
Name Description Type

obj

Object to compare with

java.lang.Object

Returns

public boolean

Code examples
label.equals(obj);

name

public java.lang.String name()

Returns the name of this Label.

Returns

public java.lang.String

Code examples
label.name();

of

public static Label of​(java.lang.String name)

Creates a Label from a specified name.

Input parameters
Name Description Type

name

Label name

java.lang.String

Returns

public static Label

Code examples
Label.of("entity");

of

public static Label of​(java.lang.String scope,
                       java.lang.String name)

Creates a Label from a specified scope and name.

Input parameters
Name Description Type

scope

Label scope

java.lang.String

name

Label name

java.lang.String

Returns

public static Label

Code examples
Label.of("relation", "role");

scope

public java.util.Optional<java.lang.String> scope()

Returns the scope of this Label.

Returns

public java.util.Optional<java.lang.String>

Code examples
label.scope();

scopedName

public java.lang.String scopedName()

Returns the string representation of the scoped name.

Returns

public java.lang.String

Code examples
label.scopedName();

toString

public java.lang.String toString()

Returns the string representation of the scoped name.

Returns

public java.lang.String

Code examples
label.toString();

ThingType

Package: com.vaticle.typedb.driver.api.concept.type

Superinterfaces:

  • Concept

  • Type

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asThingType

@CheckReturnValue
default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Thing> getInstances​(TypeDBTransaction transaction)

Retrieves all Thing objects that are instances of this ThingType or its subtypes. Equivalent to getInstances(transaction, Transitivity.TRANSITIVE)

Returns

java.util.stream.Stream<? extends Thing>

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Thing> getInstances​(TypeDBTransaction transaction,
                                                      Concept.Transitivity transitivity)

Retrieves Thing objects that are instances of this exact ThingType, OR this ThingType and any of its subtypes

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

Transitivity.EXPLICIT for direct instances only, Transitivity.TRANSITIVE to include instances of subtypes

Concept.Transitivity

Returns

java.util.stream.Stream<? extends Thing>

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

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction)

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

Returns

java.util.stream.Stream<? extends AttributeType>

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction,
                                                         Value.Type valueType)

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

Returns

java.util.stream.Stream<? extends AttributeType>

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction,
                                                         java.util.Set<ThingType.Annotation> annotations)

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

Returns

java.util.stream.Stream<? extends AttributeType>

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction,
                                                         Value.Type valueType,
                                                         java.util.Set<ThingType.Annotation> annotations)

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

Returns

java.util.stream.Stream<? extends AttributeType>

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction,
                                                         Concept.Transitivity transitivity)

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

Returns

java.util.stream.Stream<? extends AttributeType>

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction,
                                                         Value.Type valueType,
                                                         Concept.Transitivity transitivity)

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

Returns

java.util.stream.Stream<? extends AttributeType>

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction,
                                                         java.util.Set<ThingType.Annotation> annotations,
                                                         Concept.Transitivity transitivity)

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

Returns

java.util.stream.Stream<? extends AttributeType>

getOwns

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getOwns​(TypeDBTransaction transaction,
                                                         Value.Type valueType,
                                                         java.util.Set<ThingType.Annotation> annotations,
                                                         Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

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

Value.Type

transitivity

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

Concept.Transitivity

annotations

Only retrieve attribute types owned with annotations.

java.util.Set<ThingType.Annotation>

Returns

java.util.stream.Stream<? extends AttributeType>

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

getOwnsOverridden

@CheckReturnValue
Promise<? extends AttributeType> getOwnsOverridden​(TypeDBTransaction 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

TypeDBTransaction

attributeType

The AttributeType that overrides requested AttributeType

AttributeType

Returns

Promise<? extends AttributeType>

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

getPlays

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getPlays​(TypeDBTransaction transaction)

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

Returns

java.util.stream.Stream<? extends RoleType>

getPlays

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getPlays​(TypeDBTransaction transaction,
                                                     Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends RoleType>

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

getPlaysOverridden

@CheckReturnValue
Promise<? extends RoleType> getPlaysOverridden​(TypeDBTransaction 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

TypeDBTransaction

roleType

The RoleType that overrides an inherited role

RoleType

Returns

Promise<? extends RoleType>

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

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getSubtypes​(TypeDBTransaction transaction)

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

See also: Type.getSubtypes(TypeDBTransaction, Transitivity)

Returns

java.util.stream.Stream<? extends ThingType>

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getSubtypes​(TypeDBTransaction transaction,
                                                         Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends ThingType>

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

getSupertype

@CheckReturnValue
Promise<? extends ThingType> getSupertype​(TypeDBTransaction transaction)

Retrieves the most immediate supertype of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<? extends ThingType>

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

getSupertypes

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getSupertypes​(TypeDBTransaction transaction)

Retrieves all supertypes of the type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends ThingType>

Code examples
type.getSupertypes(transaction);

getSyntax

@CheckReturnValue
Promise<java.lang.String> getSyntax​(TypeDBTransaction transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.String>

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

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

setAbstract

@CheckReturnValue
Promise<java.lang.Void> setAbstract​(TypeDBTransaction transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.Void>

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

setOwns

@CheckReturnValue
Promise<java.lang.Void> setOwns​(TypeDBTransaction transaction,
                                AttributeType attributeType,
                                AttributeType overriddenType,
                                java.util.Set<ThingType.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

TypeDBTransaction

attributeType

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

AttributeType

overriddenType

The AttributeType that this attribute ownership overrides, if applicable.

AttributeType

annotations

Adds annotations to the ownership.

java.util.Set<ThingType.Annotation>

Returns

Promise<java.lang.Void>

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

setOwns

@CheckReturnValue
Promise<java.lang.Void> setOwns​(TypeDBTransaction transaction,
                                AttributeType attributeType,
                                AttributeType overriddenType)

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

Returns

Promise<java.lang.Void>

setOwns

@CheckReturnValue
Promise<java.lang.Void> setOwns​(TypeDBTransaction transaction,
                                AttributeType attributeType,
                                java.util.Set<ThingType.Annotation> annotations)

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

Returns

Promise<java.lang.Void>

setOwns

@CheckReturnValue
Promise<java.lang.Void> setOwns​(TypeDBTransaction transaction,
                                AttributeType attributeType)

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

Returns

Promise<java.lang.Void>

setPlays

@CheckReturnValue
Promise<java.lang.Void> setPlays​(TypeDBTransaction transaction,
                                 RoleType roleType)

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

Returns

Promise<java.lang.Void>

setPlays

@CheckReturnValue
Promise<java.lang.Void> setPlays​(TypeDBTransaction transaction,
                                 RoleType roleType,
                                 RoleType overriddenType)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleType

The role to be played by the instances of this type

RoleType

overriddenType

The role type that this role overrides, if applicable

RoleType

Returns

Promise<java.lang.Void>

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

unsetAbstract

@CheckReturnValue
Promise<java.lang.Void> unsetAbstract​(TypeDBTransaction transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.Void>

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

unsetOwns

@CheckReturnValue
Promise<java.lang.Void> unsetOwns​(TypeDBTransaction transaction,
                                  AttributeType attributeType)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to not be owned by the type.

AttributeType

Returns

Promise<java.lang.Void>

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

unsetPlays

@CheckReturnValue
Promise<java.lang.Void> unsetPlays​(TypeDBTransaction transaction,
                                   RoleType roleType)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleType

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

RoleType

Returns

Promise<java.lang.Void>

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

EntityType

Package: com.vaticle.typedb.driver.api.concept.type

Superinterfaces:

  • Concept

  • ThingType

  • Type

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

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

@CheckReturnValue
default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

create

@CheckReturnValue
Promise<? extends Entity> create​(TypeDBTransaction transaction)

Creates and returns a new instance of this EntityType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<? extends Entity>

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

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Entity> getInstances​(TypeDBTransaction transaction)

Retrieves all Entity objects that are instances of this EntityType or its subtypes. Equivalent to getInstances(transaction, Transitivity.TRANSITIVE)

Returns

java.util.stream.Stream<? extends Entity>

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Entity> getInstances​(TypeDBTransaction transaction,
                                                       Concept.Transitivity transitivity)

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

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends Entity>

Code examples
entityType.getInstances(transaction, transitivity);

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends EntityType> getSubtypes​(TypeDBTransaction transaction)

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

Returns

java.util.stream.Stream<? extends EntityType>

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends EntityType> getSubtypes​(TypeDBTransaction transaction,
                                                          Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends EntityType>

Code examples
entityType.getSubtypes(transaction, transitivity);

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

setSupertype

@CheckReturnValue
Promise<java.lang.Void> setSupertype​(TypeDBTransaction transaction,
                                     EntityType superEntityType)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

superEntityType

The EntityType to set as the supertype of this EntityType

EntityType

Returns

Promise<java.lang.Void>

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

RelationType

Package: com.vaticle.typedb.driver.api.concept.type

Superinterfaces:

  • Concept

  • ThingType

  • Type

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.

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

@CheckReturnValue
default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

create

@CheckReturnValue
Promise<? extends Relation> create​(TypeDBTransaction transaction)

Creates and returns an instance of this RelationType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<? extends Relation>

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

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Relation> getInstances​(TypeDBTransaction transaction)

Retrieves all Relation objects that are instances of this RelationType or its subtypes. Equivalent to getInstances(transaction, Transitivity.TRANSITIVE)

Returns

java.util.stream.Stream<? extends Relation>

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Relation> getInstances​(TypeDBTransaction transaction,
                                                         Concept.Transitivity transitivity)

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

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends Relation>

Code examples
relationType.getInstances(transaction, transitivity)

getRelates

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getRelates​(TypeDBTransaction transaction)

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

Returns

java.util.stream.Stream<? extends RoleType>

getRelates

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getRelates​(TypeDBTransaction transaction,
                                                       Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends RoleType>

Code examples
relationType.getRelates(transaction, transitivity);

getRelates

@CheckReturnValue
Promise<? extends RoleType> getRelates​(TypeDBTransaction transaction,
                                       java.lang.String roleLabel)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleLabel

Label of the role we wish to retrieve

java.lang.String

Returns

Promise<? extends RoleType>

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

getRelatesOverridden

@CheckReturnValue
Promise<? extends RoleType> getRelatesOverridden​(TypeDBTransaction transaction,
                                                 RoleType roleType)
Returns

Promise<? extends RoleType>

getRelatesOverridden

@CheckReturnValue
Promise<? extends RoleType> getRelatesOverridden​(TypeDBTransaction transaction,
                                                 java.lang.String roleLabel)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleLabel

Label of the role that overrides an inherited role

java.lang.String

Returns

Promise<? extends RoleType>

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

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends RelationType> getSubtypes​(TypeDBTransaction transaction)

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

Returns

java.util.stream.Stream<? extends RelationType>

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends RelationType> getSubtypes​(TypeDBTransaction transaction,
                                                            Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends RelationType>

Code examples
relationType.getSubtypes(transaction, transitivity);

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

setRelates

@CheckReturnValue
Promise<java.lang.Void> setRelates​(TypeDBTransaction transaction,
                                   java.lang.String roleLabel)

Sets the new role that this RelationType relates to.

Returns

Promise<java.lang.Void>

setRelates

@CheckReturnValue
Promise<java.lang.Void> setRelates​(TypeDBTransaction transaction,
                                   java.lang.String roleLabel,
                                   RoleType overriddenType)

Sets the new role that this RelationType relates to.

Returns

Promise<java.lang.Void>

setRelates

@CheckReturnValue
Promise<java.lang.Void> setRelates​(TypeDBTransaction transaction,
                                   java.lang.String roleLabel,
                                   java.lang.String overriddenLabel)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleLabel

The new role for the RelationType to relate to

java.lang.String

overriddenLabel

The label being overridden, if applicable

java.lang.String

Returns

Promise<java.lang.Void>

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

setSupertype

@CheckReturnValue
Promise<java.lang.Void> setSupertype​(TypeDBTransaction transaction,
                                     RelationType superRelationType)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

superRelationType

The RelationType to set as the supertype of this RelationType

RelationType

Returns

Promise<java.lang.Void>

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

unsetRelates

@CheckReturnValue
Promise<java.lang.Void> unsetRelates​(TypeDBTransaction transaction,
                                     RoleType roleType)

Disallows this RelationType from relating to the given role.

Returns

Promise<java.lang.Void>

unsetRelates

@CheckReturnValue
Promise<java.lang.Void> unsetRelates​(TypeDBTransaction transaction,
                                     java.lang.String roleLabel)

Disallows this RelationType from relating to the given role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleLabel

The role to not relate to the relation type.

java.lang.String

Returns

Promise<java.lang.Void>

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

RoleType

Package: com.vaticle.typedb.driver.api.concept.type

Superinterfaces:

  • Concept

  • Type

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

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

@CheckReturnValue
default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

getPlayerInstances

@CheckReturnValue
java.util.stream.Stream<? extends Thing> getPlayerInstances​(TypeDBTransaction transaction)

Retrieves the Thing instances that play this role.

Returns

java.util.stream.Stream<? extends Thing>

getPlayerInstances

@CheckReturnValue
java.util.stream.Stream<? extends Thing> getPlayerInstances​(TypeDBTransaction transaction,
                                                            Concept.Transitivity transitivity)

Retrieves the Thing instances that play this role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends Thing>

Code examples
roleType.getPlayerInstances(transaction, transitivity);

getPlayerTypes

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getPlayerTypes​(TypeDBTransaction transaction)

Retrieves the ThingTypes whose instances play this role. Equivalent to getPlayerTypes(transaction, Transitivity.TRANSITIVE).

Returns

java.util.stream.Stream<? extends ThingType>

getPlayerTypes

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getPlayerTypes​(TypeDBTransaction transaction,
                                                            Concept.Transitivity transitivity)

Retrieves the ThingTypes whose instances play this role.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends ThingType>

Code examples
roleType.getPlayerTypes(transaction, transitivity)

getRelationInstances

@CheckReturnValue
java.util.stream.Stream<? extends Relation> getRelationInstances​(TypeDBTransaction transaction)

Retrieves the Relation instances that this role is related to. Equivalent to ````getRelationInstances(transaction, Transitivity.TRANSITIVE)

Returns

java.util.stream.Stream<? extends Relation>

getRelationInstances

@CheckReturnValue
java.util.stream.Stream<? extends Relation> getRelationInstances​(TypeDBTransaction transaction,
                                                                 Concept.Transitivity transitivity)

Retrieves the Relation instances that this role is related to.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends Relation>

Code examples
roleType.getRelationInstances(transaction, transitivity)

getRelationType

@CheckReturnValue
Promise<? extends RelationType> getRelationType​(TypeDBTransaction transaction)

Retrieves the RelationType that this role is directly related to.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<? extends RelationType>

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

getRelationTypes

@CheckReturnValue
java.util.stream.Stream<? extends RelationType> getRelationTypes​(TypeDBTransaction transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends RelationType>

Code examples
roleType.getRelationTypes(transaction);

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getSubtypes​(TypeDBTransaction transaction)

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

Returns

java.util.stream.Stream<? extends RoleType>

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getSubtypes​(TypeDBTransaction transaction,
                                                        Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends RoleType>

Code examples
roleType.getSubtypes(transaction, transitivity);

getSupertype

@CheckReturnValue
Promise<? extends RoleType> getSupertype​(TypeDBTransaction transaction)

Retrieves the most immediate supertype of the RoleType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<? extends RoleType>

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

getSupertypes

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getSupertypes​(TypeDBTransaction transaction)

Retrieves all supertypes of the RoleType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends RoleType>

Code examples
roleType.getSupertypes(transaction);

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

AttributeType

Package: com.vaticle.typedb.driver.api.concept.type

Superinterfaces:

  • Concept

  • ThingType

  • Type

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.

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

@CheckReturnValue
default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

get

@CheckReturnValue
Promise<? extends Attribute> get​(TypeDBTransaction transaction,
                                 Value value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

Value

Returns

Promise<? extends Attribute>

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

get

@CheckReturnValue
Promise<? extends Attribute> get​(TypeDBTransaction transaction,
                                 java.lang.String value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

java.lang.String

Returns

Promise<? extends Attribute>

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

get

@CheckReturnValue
Promise<? extends Attribute> get​(TypeDBTransaction transaction,
                                 long value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

long

Returns

Promise<? extends Attribute>

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

get

@CheckReturnValue
Promise<? extends Attribute> get​(TypeDBTransaction transaction,
                                 double value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

double

Returns

Promise<? extends Attribute>

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

get

@CheckReturnValue
Promise<? extends Attribute> get​(TypeDBTransaction transaction,
                                 boolean value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

boolean

Returns

Promise<? extends Attribute>

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

get

@CheckReturnValue
Promise<? extends Attribute> get​(TypeDBTransaction transaction,
                                 java.time.LocalDateTime value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

Attribute’s value

java.time.LocalDateTime

Returns

Promise<? extends Attribute>

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

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Attribute> getInstances​(TypeDBTransaction transaction)

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

See also: ThingType.getInstances(TypeDBTransaction, Transitivity)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends Attribute>

Code examples
attributeType.getInstances(transaction);

getInstances

@CheckReturnValue
java.util.stream.Stream<? extends Attribute> getInstances​(TypeDBTransaction transaction,
                                                          Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends Attribute>

Code examples
attributeType.getInstances(transaction, transitivity);

getOwners

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getOwners​(TypeDBTransaction transaction)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends ThingType>

Code examples
attributeType.getOwners(transaction);

getOwners

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getOwners​(TypeDBTransaction transaction,
                                                       java.util.Set<ThingType.Annotation> annotations)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

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

java.util.Set<ThingType.Annotation>

Returns

java.util.stream.Stream<? extends ThingType>

Code examples
attributeType.getOwners(transaction, annotations);

getOwners

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getOwners​(TypeDBTransaction transaction,
                                                       Concept.Transitivity transitivity)

Retrieve all Things that own an attribute of this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends ThingType>

Code examples
attributeType.getOwners(transaction, transitivity);

getOwners

@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getOwners​(TypeDBTransaction transaction,
                                                       java.util.Set<ThingType.Annotation> annotations,
                                                       Concept.Transitivity transitivity)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

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

java.util.Set<ThingType.Annotation>

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends ThingType>

Code examples
attributeType.getOwners(transaction, annotations, transitivity);

getRegex

@CheckReturnValue
Promise<java.lang.String> getRegex​(TypeDBTransaction transaction)

Retrieves the regular expression that is defined for this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.String>

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

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getSubtypes​(TypeDBTransaction transaction)

Retrieves all direct and indirect subtypes of this AttributeType.

See also: Type.getSubtypes(TypeDBTransaction, Transitivity)

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends AttributeType>

Code examples
attributeType.getSubtypes(transaction);

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getSubtypes​(TypeDBTransaction transaction,
                                                             Value.Type valueType)

Retrieves all direct and indirect subtypes of this AttributeType with given Value.Type.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

valueType

Value.Type for retrieving subtypes

Value.Type

Returns

java.util.stream.Stream<? extends AttributeType>

Code examples
attributeType.getSubtypes(transaction, valueType);

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getSubtypes​(TypeDBTransaction transaction,
                                                             Value.Type valueType,
                                                             Concept.Transitivity transitivity)

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

TypeDBTransaction

valueType

Value.Type for retrieving subtypes

Value.Type

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends AttributeType>

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

getSubtypes

@CheckReturnValue
java.util.stream.Stream<? extends AttributeType> getSubtypes​(TypeDBTransaction transaction,
                                                             Concept.Transitivity transitivity)

Retrieves all direct and indirect (or direct only) subtypes of this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

transitivity

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

Concept.Transitivity

Returns

java.util.stream.Stream<? extends AttributeType>

Code examples
attributeType.getSubtypes(transaction, transitivity);

getValueType

@CheckReturnValue
Value.Type getValueType()

Retrieves the Value.Type of this AttributeType.

Returns

Value.Type

Code examples
attributeType.getValueType();

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isBoolean

@CheckReturnValue
default boolean isBoolean()

Returns True if the value for attributes of this type is of type boolean. Otherwise, returns False.

Returns

boolean

Code examples
attributeType.isBoolean();

isDateTime

@CheckReturnValue
default boolean isDateTime()

Returns True if the value for attributes of this type is of type datetime. Otherwise, returns False.

Returns

boolean

Code examples
attributeType.isDatetime();

isDouble

@CheckReturnValue
default boolean isDouble()

Returns True if the value for attributes of this type is of type double. Otherwise, returns False.

Returns

boolean

Code examples
attributeType.isDouble();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isLong

@CheckReturnValue
default boolean isLong()

Returns True if the value for attributes of this type is of type long. Otherwise, returns False.

Returns

boolean

Code examples
attributeType.isLong();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isString

@CheckReturnValue
default boolean isString()

Returns True if the value for attributes of this type is of type string. Otherwise, returns False.

Returns

boolean

Code examples
attributeType.isString();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

put

@CheckReturnValue
Promise<? extends Attribute> put​(TypeDBTransaction transaction,
                                 Value value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

Value

Returns

Promise<? extends Attribute>

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

put

@CheckReturnValue
Promise<? extends Attribute> put​(TypeDBTransaction transaction,
                                 java.lang.String value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

java.lang.String

Returns

Promise<? extends Attribute>

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

put

@CheckReturnValue
Promise<? extends Attribute> put​(TypeDBTransaction transaction,
                                 long value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

long

Returns

Promise<? extends Attribute>

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

put

@CheckReturnValue
Promise<? extends Attribute> put​(TypeDBTransaction 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

TypeDBTransaction

value

New Attribute’s value

double

Returns

Promise<? extends Attribute>

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

put

@CheckReturnValue
Promise<? extends Attribute> put​(TypeDBTransaction transaction,
                                 boolean value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

boolean

Returns

Promise<? extends Attribute>

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

put

@CheckReturnValue
Promise<? extends Attribute> put​(TypeDBTransaction transaction,
                                 java.time.LocalDateTime value)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

value

New Attribute’s value

java.time.LocalDateTime

Returns

Promise<? extends Attribute>

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

setRegex

@CheckReturnValue
Promise<java.lang.Void> setRegex​(TypeDBTransaction transaction,
                                 java.lang.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

TypeDBTransaction

regex

Regular expression

java.lang.String

Returns

Promise<java.lang.Void>

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

setSupertype

@CheckReturnValue
Promise<java.lang.Void> setSupertype​(TypeDBTransaction transaction,
                                     AttributeType attributeType)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeType

The AttributeType to set as the supertype of this AttributeType

AttributeType

Returns

Promise<java.lang.Void>

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

unsetRegex

@CheckReturnValue
Promise<java.lang.Void> unsetRegex​(TypeDBTransaction transaction)

Removes the regular expression that is defined for this AttributeType.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.Void>

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

ThingType.Annotation

Package: com.vaticle.typedb.driver.api.concept.type

Annotation

equals

public boolean equals​(java.lang.Object obj)

Checks if this Annotation is equal to another object.

Input parameters
Name Description Type

obj

Object to compare with

java.lang.Object

Returns

public boolean

Code examples
annotation.equals(obj);

hashCode

public int hashCode()
Returns

public int

isKey

public boolean isKey()

Checks if this Annotation is a @key annotation.

Returns

public boolean

Code examples
annotation.isKey();

isUnique

public boolean isUnique()

Checks if this Annotation is a @unique annotation.

Returns

public boolean

Code examples
annotation.isUnique();

key

public static ThingType.Annotation key()

Produces a @key annotation.

Returns

public static ThingType.Annotation

Code examples
ThingType.Annotation.key();

toString

public java.lang.String toString()

Retrieves a string representation of this Annotation.

Returns

public java.lang.String

Code examples
annotation.toString();

unique

public static ThingType.Annotation unique()

Produces a @unique annotation.

Returns

public static ThingType.Annotation

Code examples
Annotation.unique();

Concept.Transitivity

Package: com.vaticle.typedb.driver.api.concept

This class is used for specifying whether we need explicit or transitive subtyping, instances, etc.

Examples
attributeType.getOwners(transaction, annotation, Concept.Transitivity.EXPLICIT);
Enum constants
Name

EXPLICIT

TRANSITIVE

valueOf

public static Concept.Transitivity valueOf​(java.lang.String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Input parameters
Name Description Type

name

the name of the enum constant to be returned.

java.lang.String

Returns

public static Concept.Transitivity

values

public static Concept.Transitivity[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

for (Concept.Transitivity c : Concept.Transitivity.values())
    System.out.println(c);
Returns

public static Concept.Transitivity[]

Code examples
for (Concept.Transitivity c : Concept.Transitivity.values())
    System.out.println(c);

Value.Type

Package: com.vaticle.typedb.driver.api.concept.value

Used to specify the type of the value.

Examples
thingType.getOwns(transaction, Value.Type.STRING);
Enum constants
Name

BOOLEAN

DATETIME

DOUBLE

LONG

OBJECT

STRING

isKeyable

@CheckReturnValue
public boolean isKeyable()

Returns true if this value concept can be used as a key via the @key annotation. Otherwise, returns false.

Returns

public boolean

Code examples
valueType.isKeyable();

isWritable

@CheckReturnValue
public boolean isWritable()

Returns true if this value concept can be written to a database. Otherwise, returns false.

Returns

public boolean

Code examples
valueType.isWritable();

of

@CheckReturnValue
public static Value.Type of​(com.vaticle.typedb.driver.jni.ValueType valueType)
Returns

public static Value.Type

valueClass

@CheckReturnValue
public java.lang.Class<?> valueClass()

Returns a Class equivalent of this value concept for this programming language.

Returns

public java.lang.Class<?>

Code examples
valueType.valueClass();

valueOf

public static Value.Type valueOf​(java.lang.String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Input parameters
Name Description Type

name

the name of the enum constant to be returned.

java.lang.String

Returns

public static Value.Type

values

public static Value.Type[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

for (Value.Type c : Value.Type.values())
    System.out.println(c);
Returns

public static Value.Type[]

Code examples
for (Value.Type c : Value.Type.values())
    System.out.println(c);

Data

Thing

Package: com.vaticle.typedb.driver.api.concept.thing

Superinterfaces:

  • Concept

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThing

@CheckReturnValue
default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
thing.asThing();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asType

default Type asType()

Casts the concept to Type.

Returns

Type

Code examples
concept.asType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

delete

@CheckReturnValue
Promise<java.lang.Void> delete​(TypeDBTransaction transaction)

Deletes this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.Void>

Code examples
thing.delete(transaction).resolve();

getHas

@CheckReturnValue
java.util.stream.Stream<? extends Attribute> getHas​(TypeDBTransaction transaction,
                                                    AttributeType... attributeTypes)

Retrieves the Attributes that this Thing owns, optionally filtered by AttributeTypes.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attributeTypes

The AttributeTypes to filter the attributes by

AttributeType[]

Returns

java.util.stream.Stream<? extends Attribute>

Code examples
thing.getHas(transaction);
 thing.getHas(transaction, attributeType);

getHas

@CheckReturnValue
java.util.stream.Stream<? extends Attribute> getHas​(TypeDBTransaction transaction,
                                                    java.util.Set<ThingType.Annotation> annotations)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

annotations

Only retrieve attributes with all given Annotations

java.util.Set<ThingType.Annotation>

Returns

java.util.stream.Stream<? extends Attribute>

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

getIID

@CheckReturnValue
java.lang.String getIID()

Retrieves the unique id of the Thing.

Returns

java.lang.String

Code examples
thing.getIID();

getPlaying

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getPlaying​(TypeDBTransaction transaction)

Retrieves the roles that this Thing is currently playing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends RoleType>

Code examples
thing.getPlaying(transaction);

getRelations

@CheckReturnValue
java.util.stream.Stream<? extends Relation> getRelations​(TypeDBTransaction transaction,
                                                         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

TypeDBTransaction

roleTypes

The array of roles to filter the relations by.

RoleType[]

Returns

java.util.stream.Stream<? extends Relation>

Code examples
thing.getRelations(transaction, roleTypes);

getType

@CheckReturnValue
ThingType getType()

Retrieves the type which this Thing belongs to.

Returns

ThingType

Code examples
thing.getType();

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isDeleted

@CheckReturnValue
Promise<java.lang.Boolean> isDeleted​(TypeDBTransaction transaction)

Checks if this Thing is deleted.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

Promise<java.lang.Boolean>

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

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isInferred

@CheckReturnValue
boolean isInferred()

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

Returns

boolean

Code examples
thing.isInferred();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
thing.isThing();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isType

@CheckReturnValue
default boolean isType()

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

setHas

@CheckReturnValue
Promise<java.lang.Void> setHas​(TypeDBTransaction transaction,
                               Attribute attribute)

Assigns an Attribute to be owned by this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be owned by this Thing.

Attribute

Returns

Promise<java.lang.Void>

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

unsetHas

@CheckReturnValue
Promise<java.lang.Void> unsetHas​(TypeDBTransaction transaction,
                                 Attribute attribute)

Unassigns an Attribute from this Thing.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

attribute

The Attribute to be disowned from this Thing.

Attribute

Returns

Promise<java.lang.Void>

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

Entity

Package: com.vaticle.typedb.driver.api.concept.thing

Superinterfaces:

  • Concept

  • Thing

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

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

@CheckReturnValue
default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
entity.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asType

default Type asType()

Casts the concept to Type.

Returns

Type

Code examples
concept.asType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

getType

@CheckReturnValue
EntityType getType()

Retrieves the type which this Entity belongs to.

Returns

EntityType

Code examples
entity.getType();

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
entity.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isType

@CheckReturnValue
default boolean isType()

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

Relation

Package: com.vaticle.typedb.driver.api.concept.thing

Superinterfaces:

  • Concept

  • Thing

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

addPlayer

@CheckReturnValue
Promise<java.lang.Void> addPlayer​(TypeDBTransaction 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

TypeDBTransaction

roleType

The role to be played by the player

RoleType

player

The thing to play the role

Thing

Returns

Promise<java.lang.Void>

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

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

@CheckReturnValue
default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
relation.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asType

default Type asType()

Casts the concept to Type.

Returns

Type

Code examples
concept.asType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

getPlayers

@CheckReturnValue
java.util.Map<? extends RoleType,​? extends java.util.List<? extends Thing>> getPlayers​(TypeDBTransaction 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

TypeDBTransaction

Returns

java.util.Map<? extends RoleType,​? extends java.util.List<? extends Thing>>

Code examples
relation.getPlayers(transaction)

getPlayersByRoleType

@CheckReturnValue
java.util.stream.Stream<? extends Thing> getPlayersByRoleType​(TypeDBTransaction transaction,
                                                              RoleType... roleTypes)

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

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

roleTypes

0 or more role types

RoleType[]

Returns

java.util.stream.Stream<? extends Thing>

Code examples
relation.getPlayersByRoleType(transaction, roleTypes);

getRelating

@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getRelating​(TypeDBTransaction transaction)

Retrieves all role types currently played in this Relation.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends RoleType>

Code examples
relation.getRelating(transaction);

getType

@CheckReturnValue
RelationType getType()

Retrieves the type which this Relation belongs to.

Returns

RelationType

Code examples
relation.getType();

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
relation.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isType

@CheckReturnValue
default boolean isType()

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

removePlayer

@CheckReturnValue
Promise<java.lang.Void> removePlayer​(TypeDBTransaction 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

TypeDBTransaction

roleType

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

RoleType

player

The instance to no longer play the role in this Relation

Thing

Returns

Promise<java.lang.Void>

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

Attribute

Package: com.vaticle.typedb.driver.api.concept.thing

Superinterfaces:

  • Concept

  • Thing

Attribute is an instance of the attribute type and has a value. This value is fixed and unique for every given instance of the attribute type.

Attributes can be uniquely addressed by their type and value.

asAttribute

@CheckReturnValue
default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
attribute.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asType

default Type asType()

Casts the concept to Type.

Returns

Type

Code examples
concept.asType();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

getOwners

@CheckReturnValue
java.util.stream.Stream<? extends Thing> getOwners​(TypeDBTransaction transaction)

Retrieves the instances that own this Attribute.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

Returns

java.util.stream.Stream<? extends Thing>

Code examples
attribute.getOwners(transaction);

getOwners

@CheckReturnValue
java.util.stream.Stream<? extends Thing> getOwners​(TypeDBTransaction transaction,
                                                   ThingType ownerType)

Retrieves the instances that own this Attribute.

Input parameters
Name Description Type

transaction

The current transaction

TypeDBTransaction

ownerType

Filter results for only owners of the given type

ThingType

Returns

java.util.stream.Stream<? extends Thing>

Code examples
attribute.getOwners(transaction, ownerType);

getType

@CheckReturnValue
AttributeType getType()

Retrieves the type which this Attribute belongs to.

Returns

AttributeType

Code examples
attribute.getType();

getValue

Value getValue()

Retrieves the value which the Attribute instance holds.

Returns

Value

Code examples
attribute.getValue();

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
attribute.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isType

@CheckReturnValue
default boolean isType()

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType();

isValue

@CheckReturnValue
default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

Value

Package: com.vaticle.typedb.driver.api.concept.value

Superinterfaces:

  • Concept

Fields
Name Type Description

ISO_LOCAL_DATE_TIME_MILLIS

static java.time.format.DateTimeFormatter

asAttribute

default Attribute asAttribute()

Casts the concept to Attribute.

Returns

Attribute

Code examples
concept.asAttribute();

asAttributeType

default AttributeType asAttributeType()

Casts the concept to AttributeType.

Returns

AttributeType

Code examples
concept.asAttributeType();

asBoolean

boolean asBoolean()

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

Returns

boolean

Code examples
value.asBoolean();

asDateTime

java.time.LocalDateTime asDateTime()

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

Returns

java.time.LocalDateTime

Code examples
value.asDatetime();

asDouble

double asDouble()

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

Returns

double

Code examples
value.asDouble();

asEntity

default Entity asEntity()

Casts the concept to Entity.

Returns

Entity

Code examples
concept.asEntity();

asEntityType

default EntityType asEntityType()

Casts the concept to EntityType.

Returns

EntityType

Code examples
concept.asEntityType();

asLong

long asLong()

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

Returns

long

Code examples
value.asLong();

asRelation

default Relation asRelation()

Casts the concept to Relation.

Returns

Relation

Code examples
concept.asRelation();

asRelationType

default RelationType asRelationType()

Casts the concept to RelationType.

Returns

RelationType

Code examples
concept.asRelationType();

asRoleType

default RoleType asRoleType()

Casts the concept to RoleType.

Returns

RoleType

Code examples
concept.asRoleType();

asString

java.lang.String asString()

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

Returns

java.lang.String

Code examples
value.asString();

asThing

default Thing asThing()

Casts the concept to Thing.

Returns

Thing

Code examples
concept.asThing();

asThingType

default ThingType asThingType()

Casts the concept to ThingType.

Returns

ThingType

Code examples
concept.asThingType();

asType

default Type asType()

Casts the concept to Type.

Returns

Type

Code examples
concept.asType();

asUntyped

java.lang.Object asUntyped()

Returns an untyped Object value of this value concept. This is useful for value equality or printing without having to switch on the actual contained value.

Returns

java.lang.Object

Code examples
value.asUntyped();

asValue

default Value asValue()

Casts the concept to Value.

Returns

Value

Code examples
concept.asValue();

getType

Value.Type getType()

Retrieves the Value.Type of this value concept.

Returns

Value.Type

Code examples
value.getType()

isAttribute

@CheckReturnValue
default boolean isAttribute()

Checks if the concept is an Attribute.

Returns

boolean

Code examples
concept.isAttribute();

isAttributeType

@CheckReturnValue
default boolean isAttributeType()

Checks if the concept is an AttributeType.

Returns

boolean

Code examples
concept.isAttributeType();

isBoolean

boolean isBoolean()

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

Returns

boolean

Code examples
value.isBoolean()

isDateTime

boolean isDateTime()

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

Returns

boolean

Code examples
value.isDatetime();

isDouble

boolean isDouble()

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

Returns

boolean

Code examples
value.isDouble();

isEntity

@CheckReturnValue
default boolean isEntity()

Checks if the concept is an Entity.

Returns

boolean

Code examples
concept.isEntity();

isEntityType

@CheckReturnValue
default boolean isEntityType()

Checks if the concept is an EntityType.

Returns

boolean

Code examples
concept.isEntityType();

isLong

boolean isLong()

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

Returns

boolean

Code examples
value.isLong();

isRelation

@CheckReturnValue
default boolean isRelation()

Checks if the concept is a Relation.

Returns

boolean

Code examples
concept.isRelation();

isRelationType

@CheckReturnValue
default boolean isRelationType()

Checks if the concept is a RelationType.

Returns

boolean

Code examples
concept.isRelationType();

isRoleType

@CheckReturnValue
default boolean isRoleType()

Checks if the concept is a RoleType.

Returns

boolean

Code examples
concept.isRoleType();

isString

boolean isString()

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

Returns

boolean

Code examples
value.isString();

isThing

@CheckReturnValue
default boolean isThing()

Checks if the concept is a Thing.

Returns

boolean

Code examples
concept.isThing();

isThingType

@CheckReturnValue
default boolean isThingType()

Checks if the concept is a ThingType.

Returns

boolean

Code examples
concept.isThingType();

isType

@CheckReturnValue
default boolean isType()

Checks if the concept is a Type.

Returns

boolean

Code examples
concept.isType();

isValue

default boolean isValue()

Checks if the concept is a Value.

Returns

boolean

Code examples
concept.isValue();

Logic

LogicManager

Package: com.vaticle.typedb.driver.api.logic

Provides methods for manipulating rules in the database.

getRule

@CheckReturnValue
Promise<Rule> getRule​(java.lang.String label)

Retrieves the Rule that has the given label.

Input parameters
Name Description Type

label

The label of the Rule to create or retrieve

java.lang.String

Returns

Promise<Rule>

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

getRules

@CheckReturnValue
java.util.stream.Stream<? extends Rule> getRules()

Retrieves all rules.

Returns

java.util.stream.Stream<? extends Rule>

Code examples
transaction.logic().getRules()

putRule

@CheckReturnValue
Promise<Rule> putRule​(java.lang.String label,
                      com.vaticle.typeql.lang.pattern.Pattern when,
                      com.vaticle.typeql.lang.pattern.Pattern then)

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

java.lang.String

when

The when body of the rule to create

com.vaticle.typeql.lang.pattern.Pattern

then

The then body of the rule to create

com.vaticle.typeql.lang.pattern.Pattern

Returns

Promise<Rule>

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

Rule

Package: com.vaticle.typedb.driver.api.logic

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.

delete

@CheckReturnValue
Promise<java.lang.Void> delete​(TypeDBTransaction transaction)

Deletes this rule.

Input parameters
Name Description Type

transaction

The current Transaction

TypeDBTransaction

Returns

Promise<java.lang.Void>

Code examples
rule.delete(transaction).resolve();

getLabel

@CheckReturnValue
java.lang.String getLabel()

Retrieves the unique label of the rule.

Returns

java.lang.String

getThen

@CheckReturnValue
com.vaticle.typeql.lang.pattern.Pattern getThen()

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

Returns

com.vaticle.typeql.lang.pattern.Pattern

getWhen

@CheckReturnValue
com.vaticle.typeql.lang.pattern.Pattern getWhen()

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

Returns

com.vaticle.typeql.lang.pattern.Pattern

isDeleted

@CheckReturnValue
Promise<java.lang.Boolean> isDeleted​(TypeDBTransaction transaction)

Check if this rule has been deleted.

Input parameters
Name Description Type

transaction

The current Transaction

TypeDBTransaction

Returns

Promise<java.lang.Boolean>

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

setLabel

@CheckReturnValue
Promise<java.lang.Void> setLabel​(TypeDBTransaction transaction,
                                 java.lang.String label)

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

Input parameters
Name Description Type

transaction

The current Transaction

TypeDBTransaction

label

The new label to be given to the rule

java.lang.String

Returns

Promise<java.lang.Void>

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

Errors

TypeDBDriverException

Package: com.vaticle.typedb.driver.common.exception

Exceptions raised by the driver.

getErrorMessage

@Nullable
public com.vaticle.typedb.driver.common.exception.ErrorMessage getErrorMessage()
Returns

public com.vaticle.typedb.driver.common.exception.ErrorMessage

getName

public java.lang.String getName()
Returns

public java.lang.String

Provide Feedback