Java driver API reference
Connection
TypeDB
Package: com.vaticle.typedb.driver
Name | Type | Description |
---|---|---|
|
|
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.
Name | Description | Type |
---|---|---|
|
The address of the TypeDB server |
|
|
The credential to connect with |
|
public static TypeDBDriver
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.
Name | Description | Type |
---|---|---|
|
The address(es) of the TypeDB server(s) |
|
|
The credential to connect with |
|
public static TypeDBDriver
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.
Name | Description | Type |
---|---|---|
|
Translation map from addresses to be used by the driver for connection to addresses received from the TypeDB server(s) |
|
|
The credential to connect with |
|
public static TypeDBDriver
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.
Name | Description | Type |
---|---|---|
|
The address of the TypeDB server |
|
public static TypeDBDriver
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.
void
driver.close()
databases
@CheckReturnValue
DatabaseManager databases()
The DatabaseManager
for this connection, providing access to database management methods.
DatabaseManager
isOpen
@CheckReturnValue
boolean isOpen()
Checks whether this connection is presently open.
boolean
driver.isOpen();
session
@CheckReturnValue
TypeDBSession session(java.lang.String database,
TypeDBSession.Type type)
Opens a session to the given database with default options.
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.
Name | Description | Type |
---|---|---|
|
The name of the database with which the session connects |
|
|
The type of session to be created (DATA or SCHEMA) |
|
|
|
|
TypeDBSession
driver.session(database, sessionType, options);
TypeDBCredential
Package: com.vaticle.typedb.driver.api
User credentials and TLS encryption settings for connecting to TypeDB Cloud.
// 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)
Name | Description | Type |
---|---|---|
|
The name of the user to connect as |
|
|
The password for the user |
|
|
Specify whether the connection to TypeDB Cloud must be done over TLS |
|
public
TypeDBCredential
public TypeDBCredential(java.lang.String username,
java.lang.String password,
java.nio.file.Path tlsRootCAPath)
Name | Description | Type |
---|---|---|
|
The name of the user to connect as |
|
|
The password for the user |
|
|
Path to the CA certificate to use for authenticating server certificates. |
|
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
java.util.List<Database>
driver.databases().all()
contains
@CheckReturnValue
boolean contains(java.lang.String name)
Checks if a database with the given name exists
Name | Description | Type |
---|---|---|
|
The database name to be checked |
|
boolean
driver.databases().contains(name)
Database
Package: com.vaticle.typedb.driver.api.database
name
@CheckReturnValue
java.lang.String name()
The database name as a string.
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
java.util.Optional<? extends Database.Replica>
database.preferredReplica()
primaryReplica
@CheckReturnValue
java.util.Optional<? extends Database.Replica> primaryReplica()
Returns the primary replica for this database. Only works in TypeDB Cloud
java.util.Optional<? extends Database.Replica>
database.primaryReplica()
replicas
@CheckReturnValue
java.util.Set<? extends Database.Replica> replicas()
Set of Replica
instances for this database. Only works in TypeDB Cloud
java.util.Set<? extends Database.Replica>
database.replicas()
ruleSchema
@CheckReturnValue
java.lang.String ruleSchema()
The rules in the schema as a valid TypeQL define query string.
java.lang.String
database.ruleSchema()
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.
boolean
isPrimary
@CheckReturnValue
boolean isPrimary()
Checks whether this is the primary replica of the raft cluster.
boolean
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.
java.util.Set<User>
driver.users().all();
contains
@CheckReturnValue
boolean contains(java.lang.String username)
Checks if a user with the given name exists.
Name | Description | Type |
---|---|---|
|
The user name to be checked |
|
boolean
driver.users().contains(username);
create
void create(java.lang.String username,
java.lang.String password)
Creates a user with the given name & password.
Name | Description | Type |
---|---|---|
|
The name of the user to be created |
|
|
The password of the user to be created |
|
void
driver.users().create(username, password);
delete
void delete(java.lang.String username)
Deletes a user with the given name.
Name | Description | Type |
---|---|---|
|
The name of the user to be deleted |
|
void
driver.users().delete(username);
get
@CheckReturnValue
User get(java.lang.String username)
Retrieves a user with the given name.
Name | Description | Type |
---|---|---|
|
The name of the user to retrieve |
|
User
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.
Name | Description | Type |
---|---|---|
|
The name of the user to set the password of |
|
|
The new password |
|
void
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.
java.util.Optional<java.lang.Long>
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.
void
session.close();
databaseName
@CheckReturnValue
java.lang.String databaseName()
Returns the name of the database of the session.
java.lang.String
session.databaseName();
isOpen
@CheckReturnValue
boolean isOpen()
Checks whether this session is open.
boolean
session.isOpen();
onClose
void onClose(java.lang.Runnable function)
Registers a callback function which will be executed when this session is closed.
Name | Description | Type |
---|---|---|
|
The callback function. |
|
void
session.onClose(function)
onReopen
void 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.
Name | Description | Type |
---|---|---|
|
The callback function. |
|
void
session.onReopen(function)
options
@CheckReturnValue
TypeDBOptions options()
Gets the options for the session
TypeDBOptions
transaction
@CheckReturnValue
TypeDBTransaction transaction(TypeDBTransaction.Type type)
Opens a transaction on the database connected to the session with default options.
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.
Name | Description | Type |
---|---|---|
|
The type of transaction to be created (READ or WRITE) |
|
|
Options for the session |
|
TypeDBTransaction
session.transaction(transactionType, options);
TypeDBSession.Type
Package: com.vaticle.typedb.driver.api
Used to specify the type of the session.
driver.session(database, TypeDBSession.Type.SCHEMA);
Name |
---|
|
|
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.)
Name | Description | Type |
---|---|---|
|
the name of the enum constant to be returned. |
|
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);
public static TypeDBSession.Type[]
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.
public
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.
public java.util.Optional<java.lang.Boolean>
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable explanations |
|
public TypeDBOptions
options.explain(explain);
infer
@CheckReturnValue
public java.util.Optional<java.lang.Boolean> infer()
Returns the value set for the inference in this TypeDBOptions
object.
public java.util.Optional<java.lang.Boolean>
options.infer();
infer
public TypeDBOptions infer(boolean infer)
Explicitly enables or disables inference. Only settable at transaction level and above. Only affects read transactions.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable inference |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Boolean>
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable parallel execution |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Boolean>
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable prefetching |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Integer>
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.
Name | Description | Type |
---|---|---|
|
Number of answers that the server should send before the driver issues a fresh request |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Boolean>
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.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable reading data from any replica |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Integer>
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.
Name | Description | Type |
---|---|---|
|
How long the driver should wait if opening a session or transaction is blocked by a schema write lock |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Integer>
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.
Name | Description | Type |
---|---|---|
|
timeout that allows the server to close sessions if the driver terminates or becomes unresponsive |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Boolean>
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
.
Name | Description | Type |
---|---|---|
|
Explicitly enable or disable reasoning tracing |
|
public TypeDBOptions
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.
public java.util.Optional<java.lang.Integer>
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.
Name | Description | Type |
---|---|---|
|
Timeout for killing transactions automatically |
|
public TypeDBOptions
options.transactionTimeoutMillis(transactionTimeoutMillis);
Transaction
TypeDBTransaction
Package: com.vaticle.typedb.driver.api
Superinterfaces:
-
java.lang.AutoCloseable
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.
void
transaction.commit()
concepts
@CheckReturnValue
ConceptManager concepts()
The ConceptManager
for this transaction, providing access to all Concept API methods.
ConceptManager
isOpen
@CheckReturnValue
boolean isOpen()
Checks whether this transaction is open.
boolean
transaction.isOpen();
logic
@CheckReturnValue
LogicManager logic()
The LogicManager
for this Transaction, providing access to all Concept API - Logic methods.
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.
Name | Description | Type |
---|---|---|
|
The callback function. |
|
void
transaction.onClose(function);
options
@CheckReturnValue
TypeDBOptions options()
The options for the transaction
TypeDBOptions
query
@CheckReturnValue
QueryManager query()
The
for this Transaction, from which any TypeQL query can be executed.`QueryManager
`
QueryManager
TypeDBTransaction.Type
Package: com.vaticle.typedb.driver.api
Used to specify the type of transaction.
session.transaction(TransactionType.READ);
Name |
---|
|
|
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.)
Name | Description | Type |
---|---|---|
|
the name of the enum constant to be returned. |
|
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);
public static TypeDBTransaction.Type[]
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.
See also: define(TypeQLDefine, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Define query to be executed |
|
|
Specify query options |
|
Promise<java.lang.Void>
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.
See also: define(TypeQLDefine, TypeDBOptions)
Promise<java.lang.Void>
define
@CheckReturnValue
Promise<java.lang.Void> define(java.lang.String query,
TypeDBOptions options)
See also: define(TypeQLDefine, TypeDBOptions)
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.
See also: delete(TypeQLDelete, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Delete query to be executed |
|
|
Specify query options |
|
Promise<java.lang.Void>
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.
See also: delete(TypeQLDelete, TypeDBOptions)
Promise<java.lang.Void>
delete
@CheckReturnValue
Promise<java.lang.Void> delete(java.lang.String query,
TypeDBOptions options)
See also: delete(TypeQLDelete, TypeDBOptions)
Promise<java.lang.Void>
explain
@CheckReturnValue
java.util.stream.Stream<Explanation> explain(ConceptMap.Explainable explainable)
Performs a TypeQL Explain query with default options.
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.
Name | Description | Type |
---|---|---|
|
The Explainable to be explained |
|
|
Specify query options |
|
java.util.stream.Stream<Explanation>
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.
See also: fetch(TypeQLFetch, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Fetch (Fetch) query to be executed |
|
|
Specify query options |
|
java.util.stream.Stream<JSON>
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.
See also: fetch(TypeQLFetch, TypeDBOptions)
java.util.stream.Stream<JSON>
fetch
@CheckReturnValue
java.util.stream.Stream<JSON> fetch(java.lang.String query,
TypeDBOptions options)
See also: fetch(TypeQLFetch, TypeDBOptions)
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.
See also: get(TypeQLGet, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get (Get) query to be executed |
|
|
Specify query options |
|
java.util.stream.Stream<ConceptMap>
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.
See also: get(TypeQLGet, TypeDBOptions)
java.util.stream.Stream<ConceptMap>
get
@CheckReturnValue
java.util.stream.Stream<ConceptMap> get(java.lang.String query,
TypeDBOptions options)
See also: get(TypeQLGet, TypeDBOptions)
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.
See also: get(TypeQLGet.Aggregate, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get Aggregate query to be executed |
|
|
Specify query options |
|
Promise<java.util.Optional<Value>>
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.
See also: get(TypeQLGet.Group, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get Group query to be executed |
|
|
Specify query options |
|
java.util.stream.Stream<ConceptMapGroup>
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.
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Get Group Aggregate query to be executed |
|
|
Specify query options |
|
java.util.stream.Stream<ValueGroup>
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.
See also: get(TypeQLGet.Aggregate, TypeDBOptions)
Promise<java.util.Optional<Value>>
getAggregate
@CheckReturnValue
Promise<java.util.Optional<Value>> getAggregate(java.lang.String query,
TypeDBOptions options)
See also: get(TypeQLGet.Aggregate, TypeDBOptions)
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.
See also: get(TypeQLGet.Group, TypeDBOptions)
java.util.stream.Stream<ConceptMapGroup>
getGroup
@CheckReturnValue
java.util.stream.Stream<ConceptMapGroup> getGroup(java.lang.String query,
TypeDBOptions options)
See also: get(TypeQLGet.Group, TypeDBOptions)
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.
java.util.stream.Stream<ValueGroup>
getGroupAggregate
@CheckReturnValue
java.util.stream.Stream<ValueGroup> getGroupAggregate(java.lang.String query,
TypeDBOptions options)
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.
See also: insert(TypeQLInsert, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Insert query to be executed |
|
|
Specify query options |
|
java.util.stream.Stream<ConceptMap>
transaction.query().insert(query, options)
insert
java.util.stream.Stream<ConceptMap> insert(java.lang.String query)
Performs a TypeQL Insert query with default options.
See also: insert(TypeQLInsert, TypeDBOptions)
java.util.stream.Stream<ConceptMap>
insert
java.util.stream.Stream<ConceptMap> insert(java.lang.String query,
TypeDBOptions options)
See also: insert(TypeQLInsert, TypeDBOptions)
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.
See also: undefine(TypeQLUndefine, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Undefine query to be executed |
|
|
Specify query options |
|
Promise<java.lang.Void>
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.
See also: undefine(TypeQLUndefine, TypeDBOptions)
Promise<java.lang.Void>
undefine
@CheckReturnValue
Promise<java.lang.Void> undefine(java.lang.String query,
TypeDBOptions options)
See also: undefine(TypeQLUndefine, TypeDBOptions)
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.
See also: update(TypeQLUpdate, TypeDBOptions)
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.
Name | Description | Type |
---|---|---|
|
The TypeQL Update query to be executed |
|
|
Specify query options |
|
java.util.stream.Stream<ConceptMap>
transaction.query().update(query, options)
update
java.util.stream.Stream<ConceptMap> update(java.lang.String query)
Performs a TypeQL Update query with default options.
See also: update(TypeQLUpdate, TypeDBOptions)
java.util.stream.Stream<ConceptMap>
update
java.util.stream.Stream<ConceptMap> update(java.lang.String query,
TypeDBOptions options)
See also: update(TypeQLUpdate, TypeDBOptions)
java.util.stream.Stream<ConceptMap>
Answer
ConceptMapGroup
Package: com.vaticle.typedb.driver.api.answer
Contains an element of the group query result.
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
.
java.util.stream.Stream<Concept>
conceptMap.concepts();
explainables
ConceptMap.Explainables explainables()
Gets the Explainables
object for this ConceptMap
, exposing which of the concepts in this ConceptMap
are explainable.
ConceptMap.Explainables
conceptMap.explainables();
get
@CheckReturnValue
Concept get(java.lang.String variable)
Retrieves a concept for a given variable name.
Name | Description | Type |
---|---|---|
|
The string representation of a variable |
|
Concept
conceptMap.get(variable);
ValueGroup
Package: com.vaticle.typedb.driver.api.answer
Contains an element of the group aggregate query result.
JSON
Package: com.vaticle.typedb.driver.api.answer
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 resolve
d.
Promise
public Promise(java.util.function.Supplier<T> inner)
Promise constructor
Name | Description | Type |
---|---|---|
|
The supplier to function to wrap into the promise |
|
public
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.
Name | Description | Type |
---|---|---|
|
The supplier function to wrap into the promise |
|
|
The mapping function |
|
public static <T,U> Promise<U>
Promise.map(supplier, mapper);
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.
Name | Description | Type |
---|---|---|
|
The string representation of a variable |
|
ConceptMap.Explainable
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.
java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<java.lang.String,ConceptMap.Explainable>>
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.
Name | Description | Type |
---|---|---|
|
The string representation of the owner variable |
|
|
The string representation of the attribute variable |
|
ConceptMap.Explainable
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.
java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<com.vaticle.typedb.common.collection.Pair<java.lang.String,java.lang.String>,ConceptMap.Explainable>>
conceptMap.explainables().ownerships();
relation
ConceptMap.Explainable relation(java.lang.String variable)
Retrieves the explainable relation with the given variable name.
Name | Description | Type |
---|---|---|
|
The string representation of a variable |
|
ConceptMap.Explainable
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.
java.util.stream.Stream<com.vaticle.typedb.common.collection.Pair<java.lang.String,ConceptMap.Explainable>>
conceptMap.explainables().relations();
ConceptMap.Explainable
Package: com.vaticle.typedb.driver.api.answer
Contains an explainable object.
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.
ConceptMap
explanation.conclusion()
condition
ConceptMap condition()
Retrieves the Condition for this Explanation.
ConceptMap
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
.
Name | Description | Type |
---|---|---|
|
The query variable to map to rule variables. |
|
java.util.Set<java.lang.String>
explanation.variableMapping(var)
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.
Name | Description | Type |
---|---|---|
|
The iid of the |
|
Promise<? extends Attribute>
transaction.concepts().getAttribute(iid).resolve();
getAttributeType
@CheckReturnValue
Promise<? extends AttributeType> getAttributeType(java.lang.String label)
Retrieves an AttributeType
by its label.
Name | Description | Type |
---|---|---|
|
The label of the |
|
Promise<? extends AttributeType>
transaction.concepts().getAttributeType(label).resolve();
getEntity
@CheckReturnValue
Promise<? extends Entity> getEntity(java.lang.String iid)
Retrieves an Entity
by its iid.
Name | Description | Type |
---|---|---|
|
The iid of the |
|
Promise<? extends Entity>
transaction.concepts().getEntity(iid).resolve();
getEntityType
@CheckReturnValue
Promise<? extends EntityType> getEntityType(java.lang.String label)
Retrieves an EntityType
by its label.
Name | Description | Type |
---|---|---|
|
The label of the |
|
Promise<? extends EntityType>
transaction.concepts().getEntityType(label).resolve();
getRelation
@CheckReturnValue
Promise<? extends Relation> getRelation(java.lang.String iid)
Retrieves a Relation
by its iid.
Name | Description | Type |
---|---|---|
|
The iid of the |
|
Promise<? extends Relation>
transaction.concepts().getRelation(iid).resolve();
getRelationType
@CheckReturnValue
Promise<? extends RelationType> getRelationType(java.lang.String label)
Retrieves a RelationType
by its label.
Name | Description | Type |
---|---|---|
|
The label of the |
|
Promise<? extends RelationType>
transaction.concepts().getRelationType(label).resolve();
getRootAttributeType
@CheckReturnValue
AttributeType getRootAttributeType()
Retrieve the root AttributeType
, “attribute”.
AttributeType
transaction.concepts().getRootAttributeType();
getRootEntityType
@CheckReturnValue
EntityType getRootEntityType()
Retrieves the root EntityType
, “entity”.
EntityType
transaction.concepts().getRootEntityType();
getRootRelationType
@CheckReturnValue
RelationType getRootRelationType()
Retrieve the root RelationType
, “relation”.
RelationType
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.
java.util.List<com.vaticle.typedb.driver.common.exception.TypeDBException>
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.
Name | Description | Type |
---|---|---|
|
The label of the |
|
|
The value type of the |
|
Promise<? extends AttributeType>
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.
Name | Description | Type |
---|---|---|
|
The label of the |
|
Promise<? extends EntityType>
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.
Name | Description | Type |
---|---|---|
|
The label of the |
|
Promise<? extends RelationType>
transaction.concepts().putRelationType(label).resolve();
Concept
Package: com.vaticle.typedb.driver.api.concept
asAttribute
default Attribute asAttribute()
Casts the concept to Attribute
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asType
default Type asType()
Casts the concept to Type
.
Type
concept.asType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
Schema
Type
Package: com.vaticle.typedb.driver.api.concept.type
Superinterfaces:
-
Concept
asAttribute
default Attribute asAttribute()
Casts the concept to Attribute
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asType
@CheckReturnValue
default Type asType()
Casts the concept to Type
.
Type
concept.asType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
delete
@CheckReturnValue
Promise<java.lang.Void> delete(TypeDBTransaction transaction)
Deletes this type from the database.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.Void>
type.delete(transaction).resolve();
getLabel
@CheckReturnValue
Label getLabel()
Retrieves the unique label of the type.
Label
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)
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends Type>
type.getSubtypes(transaction);
type.getSubtypes(transaction, Transitivity.EXPLICIT);
getSupertype
@CheckReturnValue
Promise<? extends Type> getSupertype(TypeDBTransaction transaction)
Retrieves the most immediate supertype of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<? extends Type>
type.getSupertype(transaction).resolve();
getSupertypes
@CheckReturnValue
java.util.stream.Stream<? extends Type> getSupertypes(TypeDBTransaction transaction)
Retrieves all supertypes of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends Type>
type.getSupertypes(transaction);
isAbstract
@CheckReturnValue
boolean isAbstract()
Checks if the type is prevented from having data instances (i.e., abstract
).
boolean
type.isAbstract();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isDeleted
@CheckReturnValue
Promise<java.lang.Boolean> isDeleted(TypeDBTransaction transaction)
Check if the concept has been deleted
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.Boolean>
type.isDeleted(transaction).resolve();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isRoot
@CheckReturnValue
boolean isRoot()
Checks if the type is a root type.
boolean
type.isRoot();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
isType
@CheckReturnValue
default boolean isType()
Checks if the concept is a Type
.
boolean
concept.isType();
isValue
@CheckReturnValue
default boolean isValue()
Checks if the concept is a Value
.
boolean
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The new |
|
Promise<java.lang.Void>
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.
Name | Description | Type |
---|---|---|
|
Object to compare with |
|
public boolean
label.equals(obj);
name
public java.lang.String name()
Returns the name of this Label.
public java.lang.String
label.name();
of
public static Label of(java.lang.String name)
Creates a Label from a specified name.
Name | Description | Type |
---|---|---|
|
Label name |
|
public static Label
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.
Name | Description | Type |
---|---|---|
|
Label scope |
|
|
Label name |
|
public static Label
Label.of("relation", "role");
scope
public java.util.Optional<java.lang.String> scope()
Returns the scope of this Label.
public java.util.Optional<java.lang.String>
label.scope();
ThingType
Package: com.vaticle.typedb.driver.api.concept.type
Superinterfaces:
-
Concept
-
Type
asAttribute
default Attribute asAttribute()
Casts the concept to Attribute
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asThingType
@CheckReturnValue
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
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)
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
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends Thing>
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.
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.
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.
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.
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.
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.
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.
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
If specified, only attribute types of this |
|
|
|
|
|
Only retrieve attribute types owned with annotations. |
|
java.util.stream.Stream<? extends AttributeType>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<? extends AttributeType>
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
.
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
transitivity: |
|
java.util.stream.Stream<? extends RoleType>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<? extends RoleType>
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)
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends ThingType>
type.getSubtypes(transaction);
type.getSubtypes(transaction, Transitivity.EXPLICIT);
getSupertype
@CheckReturnValue
Promise<? extends ThingType> getSupertype(TypeDBTransaction transaction)
Retrieves the most immediate supertype of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<? extends ThingType>
type.getSupertype(transaction).resolve();
getSupertypes
@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getSupertypes(TypeDBTransaction transaction)
Retrieves all supertypes of the type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends ThingType>
type.getSupertypes(transaction);
getSyntax
@CheckReturnValue
Promise<java.lang.String> getSyntax(TypeDBTransaction transaction)
Produces a pattern for creating this ThingType
in a define
query.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.String>
thingType.getSyntax(transaction).resolve();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
isValue
@CheckReturnValue
default boolean isValue()
Checks if the concept is a Value
.
boolean
concept.isValue();
setAbstract
@CheckReturnValue
Promise<java.lang.Void> setAbstract(TypeDBTransaction transaction)
Set a ThingType
to be abstract, meaning it cannot have instances.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.Void>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
|
The |
|
|
Adds annotations to the ownership. |
|
Promise<java.lang.Void>
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
,
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
.
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
.
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.
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to be played by the instances of this type |
|
|
The role type that this role overrides, if applicable |
|
Promise<java.lang.Void>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.Void>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<java.lang.Void>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to not be played by the instances of this type. |
|
Promise<java.lang.Void>
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
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
@CheckReturnValue
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
create
@CheckReturnValue
Promise<? extends Entity> create(TypeDBTransaction transaction)
Creates and returns a new instance of this EntityType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<? extends Entity>
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)
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends Entity>
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)
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends EntityType>
entityType.getSubtypes(transaction, transitivity);
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
isValue
@CheckReturnValue
default boolean isValue()
Checks if the concept is a Value
.
boolean
concept.isValue();
setSupertype
@CheckReturnValue
Promise<java.lang.Void> setSupertype(TypeDBTransaction transaction,
EntityType superEntityType)
Sets the supplied EntityType
as the supertype of the current EntityType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<java.lang.Void>
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
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
@CheckReturnValue
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
create
@CheckReturnValue
Promise<? extends Relation> create(TypeDBTransaction transaction)
Creates and returns an instance of this RelationType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<? extends Relation>
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)
java.util.stream.Stream<? extends Relation>
getInstances
@CheckReturnValue
java.util.stream.Stream<? extends Relation> getInstances(TypeDBTransaction transaction,
Concept.Transitivity transitivity)
Retrieves Relation
s that are instances of this exact RelationType
, OR this RelationType
and any of its subtypes.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends Relation>
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.
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends RoleType>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Label of the role we wish to retrieve |
|
Promise<? extends RoleType>
relationType.getRelates(transaction, roleLabel).resolve();
getRelatesOverridden
@CheckReturnValue
Promise<? extends RoleType> getRelatesOverridden(TypeDBTransaction transaction,
RoleType roleType)
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Label of the role that overrides an inherited role |
|
Promise<? extends RoleType>
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)
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends RelationType>
relationType.getSubtypes(transaction, transitivity);
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
isValue
@CheckReturnValue
default boolean isValue()
Checks if the concept is a Value
.
boolean
concept.isValue();
setRelates
@CheckReturnValue
Promise<java.lang.Void> setRelates(TypeDBTransaction transaction,
java.lang.String roleLabel)
Sets the new role that this RelationType
relates to.
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.
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The new role for the |
|
|
The label being overridden, if applicable |
|
Promise<java.lang.Void>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<java.lang.Void>
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.
See also: unsetRelates(TypeDBTransaction, String)
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to not relate to the relation type. |
|
Promise<java.lang.Void>
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
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
@CheckReturnValue
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
getPlayerInstances
@CheckReturnValue
java.util.stream.Stream<? extends Thing> getPlayerInstances(TypeDBTransaction transaction)
Retrieves the Thing
instances that play this role.
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends Thing>
roleType.getPlayerInstances(transaction, transitivity);
getPlayerTypes
@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getPlayerTypes(TypeDBTransaction transaction)
Retrieves the ThingType
s whose instances play this role. Equivalent to getPlayerTypes(transaction, Transitivity.TRANSITIVE)
.
java.util.stream.Stream<? extends ThingType>
getPlayerTypes
@CheckReturnValue
java.util.stream.Stream<? extends ThingType> getPlayerTypes(TypeDBTransaction transaction,
Concept.Transitivity transitivity)
Retrieves the ThingType
s whose instances play this role.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends ThingType>
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)
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends Relation>
roleType.getRelationInstances(transaction, transitivity)
getRelationType
@CheckReturnValue
Promise<? extends RelationType> getRelationType(TypeDBTransaction transaction)
Retrieves the RelationType
that this role is directly related to.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<? extends RelationType>
roleType.getRelationType(transaction).resolve();
getRelationTypes
@CheckReturnValue
java.util.stream.Stream<? extends RelationType> getRelationTypes(TypeDBTransaction transaction)
Retrieves RelationType
s that this role is related to (directly or indirectly).
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends RelationType>
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)
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends RoleType>
roleType.getSubtypes(transaction, transitivity);
getSupertype
@CheckReturnValue
Promise<? extends RoleType> getSupertype(TypeDBTransaction transaction)
Retrieves the most immediate supertype of the RoleType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<? extends RoleType>
roleType.getSupertype(transaction).resolve();
getSupertypes
@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getSupertypes(TypeDBTransaction transaction)
Retrieves all supertypes of the RoleType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends RoleType>
roleType.getSupertypes(transaction);
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
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
.
Attribute
concept.asAttribute();
asAttributeType
@CheckReturnValue
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asValue
default Value asValue()
Casts the concept to Value
.
Value
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
Promise<? extends Attribute>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
Promise<? extends Attribute>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
Promise<? extends Attribute>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
Promise<? extends Attribute>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
Promise<? extends Attribute>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
Promise<? extends Attribute>
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)
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends Attribute>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends Attribute>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends ThingType>
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 Annotation
s, directly or through inheritance.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Only retrieve |
|
java.util.stream.Stream<? extends ThingType>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends ThingType>
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 Annotation
s.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Only retrieve |
|
|
|
|
java.util.stream.Stream<? extends ThingType>
attributeType.getOwners(transaction, annotations, transitivity);
getRegex
@CheckReturnValue
Promise<java.lang.String> getRegex(TypeDBTransaction transaction)
Retrieves the regular expression that is defined for this AttributeType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.String>
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)
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends AttributeType>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends AttributeType>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
|
|
|
java.util.stream.Stream<? extends AttributeType>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
|
|
java.util.stream.Stream<? extends AttributeType>
attributeType.getSubtypes(transaction, transitivity);
getValueType
@CheckReturnValue
Value.Type getValueType()
Retrieves the Value.Type
of this AttributeType
.
Value.Type
attributeType.getValueType();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isBoolean
@CheckReturnValue
default boolean isBoolean()
Returns True
if the value for attributes of this type is of type boolean
. Otherwise, returns False
.
boolean
attributeType.isBoolean();
isDateTime
@CheckReturnValue
default boolean isDateTime()
Returns True
if the value for attributes of this type is of type datetime
. Otherwise, returns False
.
boolean
attributeType.isDatetime();
isDouble
@CheckReturnValue
default boolean isDouble()
Returns True
if the value for attributes of this type is of type double
. Otherwise, returns False
.
boolean
attributeType.isDouble();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isLong
@CheckReturnValue
default boolean isLong()
Returns True
if the value for attributes of this type is of type long
. Otherwise, returns False
.
boolean
attributeType.isLong();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isString
@CheckReturnValue
default boolean isString()
Returns True
if the value for attributes of this type is of type string
. Otherwise, returns False
.
boolean
attributeType.isString();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
isValue
@CheckReturnValue
default boolean isValue()
Checks if the concept is a Value
.
boolean
concept.isValue();
put
@CheckReturnValue
Promise<? extends Attribute> put(TypeDBTransaction transaction,
Value value)
Adds and returns an Attribute
of this AttributeType
with the given value.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
Promise<? extends Attribute>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
Promise<? extends Attribute>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
Promise<? extends Attribute>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
Promise<? extends Attribute>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
Promise<? extends Attribute>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
New |
|
Promise<? extends Attribute>
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 Attribute
s of this type (inserted earlier or later) should match this regex.
Can only be applied for AttributeType
s with a string
value type.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Regular expression |
|
Promise<java.lang.Void>
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<java.lang.Void>
attributeType.setSupertype(transaction, superType).resolve();
unsetRegex
@CheckReturnValue
Promise<java.lang.Void> unsetRegex(TypeDBTransaction transaction)
Removes the regular expression that is defined for this AttributeType
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.Void>
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.
Name | Description | Type |
---|---|---|
|
Object to compare with |
|
public boolean
annotation.equals(obj);
isKey
public boolean isKey()
Checks if this Annotation
is a @key
annotation.
public boolean
annotation.isKey();
isUnique
public boolean isUnique()
Checks if this Annotation
is a @unique
annotation.
public boolean
annotation.isUnique();
key
public static ThingType.Annotation key()
Produces a @key
annotation.
public static ThingType.Annotation
ThingType.Annotation.key();
Concept.Transitivity
Package: com.vaticle.typedb.driver.api.concept
This class is used for specifying whether we need explicit or transitive subtyping, instances, etc.
attributeType.getOwners(transaction, annotation, Concept.Transitivity.EXPLICIT);
Name |
---|
|
|
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.)
Name | Description | Type |
---|---|---|
|
the name of the enum constant to be returned. |
|
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);
public static Concept.Transitivity[]
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.
thingType.getOwns(transaction, Value.Type.STRING);
Name |
---|
|
|
|
|
|
|
isKeyable
@CheckReturnValue
public boolean isKeyable()
Returns true
if this value concept can be used as a key via the @key annotation. Otherwise, returns false
.
public boolean
valueType.isKeyable();
isWritable
@CheckReturnValue
public boolean isWritable()
Returns true
if this value concept can be written to a database. Otherwise, returns false
.
public boolean
valueType.isWritable();
of
@CheckReturnValue
public static Value.Type of(com.vaticle.typedb.driver.jni.ValueType valueType)
public static Value.Type
valueClass
@CheckReturnValue
public java.lang.Class<?> valueClass()
Returns a Class
equivalent of this value concept for this programming language.
public java.lang.Class<?>
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.)
Name | Description | Type |
---|---|---|
|
the name of the enum constant to be returned. |
|
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);
public static Value.Type[]
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
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThing
@CheckReturnValue
default Thing asThing()
Casts the concept to Thing
.
Thing
thing.asThing();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asType
default Type asType()
Casts the concept to Type
.
Type
concept.asType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
delete
@CheckReturnValue
Promise<java.lang.Void> delete(TypeDBTransaction transaction)
Deletes this Thing
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.Void>
thing.delete(transaction).resolve();
getHas
@CheckReturnValue
java.util.stream.Stream<? extends Attribute> getHas(TypeDBTransaction transaction,
AttributeType... attributeTypes)
Retrieves the Attribute
s that this Thing
owns, optionally filtered by AttributeType
s.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
java.util.stream.Stream<? extends Attribute>
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 Attribute
s that this Thing
owns, filtered by Annotation
s.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Only retrieve attributes with all given |
|
java.util.stream.Stream<? extends Attribute>
thing.getHas(transaction);
thing.getHas(transaction, set(Annotation.key()));
getIID
@CheckReturnValue
java.lang.String getIID()
Retrieves the unique id of the Thing
.
java.lang.String
thing.getIID();
getPlaying
@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getPlaying(TypeDBTransaction transaction)
Retrieves the roles that this Thing
is currently playing.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends RoleType>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The array of roles to filter the relations by. |
|
java.util.stream.Stream<? extends Relation>
thing.getRelations(transaction, roleTypes);
getType
@CheckReturnValue
ThingType getType()
Retrieves the type which this Thing
belongs to.
ThingType
thing.getType();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isDeleted
@CheckReturnValue
Promise<java.lang.Boolean> isDeleted(TypeDBTransaction transaction)
Checks if this Thing
is deleted.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
Promise<java.lang.Boolean>
thing.isDeleted(transaction).resolve();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isInferred
@CheckReturnValue
boolean isInferred()
Checks if this Thing
is inferred by a [Reasoning Rule].
boolean
thing.isInferred();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
thing.isThing();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
isType
@CheckReturnValue
default boolean isType()
Checks if the concept is a Type
.
boolean
concept.isType();
isValue
@CheckReturnValue
default boolean isValue()
Checks if the concept is a Value
.
boolean
concept.isValue();
setHas
@CheckReturnValue
Promise<java.lang.Void> setHas(TypeDBTransaction transaction,
Attribute attribute)
Assigns an Attribute
to be owned by this Thing
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<java.lang.Void>
thing.setHas(transaction, attribute).resolve();
unsetHas
@CheckReturnValue
Promise<java.lang.Void> unsetHas(TypeDBTransaction transaction,
Attribute attribute)
Unassigns an Attribute
from this Thing
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The |
|
Promise<java.lang.Void>
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
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
@CheckReturnValue
default Entity asEntity()
Casts the concept to Entity
.
Entity
entity.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asType
default Type asType()
Casts the concept to Type
.
Type
concept.asType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
getType
@CheckReturnValue
EntityType getType()
Retrieves the type which this Entity
belongs to.
EntityType
entity.getType();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
entity.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to be played by the |
|
|
The thing to play the role |
|
Promise<java.lang.Void>
relation.addPlayer(transaction, roleType, player).resolve();
asAttribute
default Attribute asAttribute()
Casts the concept to Attribute
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
@CheckReturnValue
default Relation asRelation()
Casts the concept to Relation
.
Relation
relation.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asType
default Type asType()
Casts the concept to Type
.
Type
concept.asType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.Map<? extends RoleType,? extends java.util.List<? extends Thing>>
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.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
0 or more role types |
|
java.util.stream.Stream<? extends Thing>
relation.getPlayersByRoleType(transaction, roleTypes);
getRelating
@CheckReturnValue
java.util.stream.Stream<? extends RoleType> getRelating(TypeDBTransaction transaction)
Retrieves all role types currently played in this Relation
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends RoleType>
relation.getRelating(transaction);
getType
@CheckReturnValue
RelationType getType()
Retrieves the type which this Relation
belongs to.
RelationType
relation.getType();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
relation.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
isType
@CheckReturnValue
default boolean isType()
Checks if the concept is a Type
.
boolean
concept.isType();
isValue
@CheckReturnValue
default boolean isValue()
Checks if the concept is a Value
.
boolean
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
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
The role to no longer be played by the thing in this |
|
|
The instance to no longer play the role in this |
|
Promise<java.lang.Void>
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
.
Attribute
attribute.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asType
default Type asType()
Casts the concept to Type
.
Type
concept.asType();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
getOwners
@CheckReturnValue
java.util.stream.Stream<? extends Thing> getOwners(TypeDBTransaction transaction)
Retrieves the instances that own this Attribute
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
java.util.stream.Stream<? extends Thing>
attribute.getOwners(transaction);
getOwners
@CheckReturnValue
java.util.stream.Stream<? extends Thing> getOwners(TypeDBTransaction transaction,
ThingType ownerType)
Retrieves the instances that own this Attribute
.
Name | Description | Type |
---|---|---|
|
The current transaction |
|
|
Filter results for only owners of the given type |
|
java.util.stream.Stream<? extends Thing>
attribute.getOwners(transaction, ownerType);
getType
@CheckReturnValue
AttributeType getType()
Retrieves the type which this Attribute
belongs to.
AttributeType
attribute.getType();
getValue
Value getValue()
Retrieves the value which the Attribute
instance holds.
Value
attribute.getValue();
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
attribute.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
Value
Package: com.vaticle.typedb.driver.api.concept.value
Superinterfaces:
-
Concept
Name | Type | Description |
---|---|---|
|
|
asAttribute
default Attribute asAttribute()
Casts the concept to Attribute
.
Attribute
concept.asAttribute();
asAttributeType
default AttributeType asAttributeType()
Casts the concept to AttributeType
.
AttributeType
concept.asAttributeType();
asBoolean
boolean asBoolean()
Returns a boolean
value of this value concept. If the value has another type, raises an exception.
boolean
value.asBoolean();
asDateTime
java.time.LocalDateTime asDateTime()
Returns a datetime
value of this value concept. If the value has another type, raises an exception.
java.time.LocalDateTime
value.asDatetime();
asDouble
double asDouble()
Returns a double
value of this value concept. If the value has another type, raises an exception.
double
value.asDouble();
asEntity
default Entity asEntity()
Casts the concept to Entity
.
Entity
concept.asEntity();
asEntityType
default EntityType asEntityType()
Casts the concept to EntityType
.
EntityType
concept.asEntityType();
asLong
long asLong()
Returns a long
value of this value concept. If the value has another type, raises an exception.
long
value.asLong();
asRelation
default Relation asRelation()
Casts the concept to Relation
.
Relation
concept.asRelation();
asRelationType
default RelationType asRelationType()
Casts the concept to RelationType
.
RelationType
concept.asRelationType();
asRoleType
default RoleType asRoleType()
Casts the concept to RoleType
.
RoleType
concept.asRoleType();
asString
java.lang.String asString()
Returns a string
value of this value concept. If the value has another type, raises an exception.
java.lang.String
value.asString();
asThing
default Thing asThing()
Casts the concept to Thing
.
Thing
concept.asThing();
asThingType
default ThingType asThingType()
Casts the concept to ThingType
.
ThingType
concept.asThingType();
asType
default Type asType()
Casts the concept to Type
.
Type
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.
java.lang.Object
value.asUntyped();
asValue
default Value asValue()
Casts the concept to Value
.
Value
concept.asValue();
getType
Value.Type getType()
Retrieves the Value.Type
of this value concept.
Value.Type
value.getType()
isAttribute
@CheckReturnValue
default boolean isAttribute()
Checks if the concept is an Attribute
.
boolean
concept.isAttribute();
isAttributeType
@CheckReturnValue
default boolean isAttributeType()
Checks if the concept is an AttributeType
.
boolean
concept.isAttributeType();
isBoolean
boolean isBoolean()
Returns True
if the value which this value concept holds is of type boolean
. Otherwise, returns false
.
boolean
value.isBoolean()
isDateTime
boolean isDateTime()
Returns True
if the value which this value concept holds is of type datetime
. Otherwise, returns false
.
boolean
value.isDatetime();
isDouble
boolean isDouble()
Returns True
if the value which this value concept holds is of type double
. Otherwise, returns false
.
boolean
value.isDouble();
isEntity
@CheckReturnValue
default boolean isEntity()
Checks if the concept is an Entity
.
boolean
concept.isEntity();
isEntityType
@CheckReturnValue
default boolean isEntityType()
Checks if the concept is an EntityType
.
boolean
concept.isEntityType();
isLong
boolean isLong()
Returns True
if the value which this value concept holds is of type long
. Otherwise, returns false
.
boolean
value.isLong();
isRelation
@CheckReturnValue
default boolean isRelation()
Checks if the concept is a Relation
.
boolean
concept.isRelation();
isRelationType
@CheckReturnValue
default boolean isRelationType()
Checks if the concept is a RelationType
.
boolean
concept.isRelationType();
isRoleType
@CheckReturnValue
default boolean isRoleType()
Checks if the concept is a RoleType
.
boolean
concept.isRoleType();
isString
boolean isString()
Returns True
if the value which this value concept holds is of type string
. Otherwise, returns false
.
boolean
value.isString();
isThing
@CheckReturnValue
default boolean isThing()
Checks if the concept is a Thing
.
boolean
concept.isThing();
isThingType
@CheckReturnValue
default boolean isThingType()
Checks if the concept is a ThingType
.
boolean
concept.isThingType();
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.
Name | Description | Type |
---|---|---|
|
The label of the Rule to create or retrieve |
|
Promise<Rule>
transaction.logic().getRule(label).resolve();
getRules
@CheckReturnValue
java.util.stream.Stream<? extends Rule> getRules()
Retrieves all rules.
java.util.stream.Stream<? extends Rule>
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.
Name | Description | Type |
---|---|---|
|
The label of the Rule to create or replace |
|
|
The when body of the rule to create |
|
|
The then body of the rule to create |
|
Promise<Rule>
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.
Name | Description | Type |
---|---|---|
|
The current |
|
Promise<java.lang.Void>
rule.delete(transaction).resolve();
getLabel
@CheckReturnValue
java.lang.String getLabel()
Retrieves the unique label of the rule.
java.lang.String
getThen
@CheckReturnValue
com.vaticle.typeql.lang.pattern.Pattern getThen()
The single statement that constitutes the ‘then’ of the rule.
com.vaticle.typeql.lang.pattern.Pattern
getWhen
@CheckReturnValue
com.vaticle.typeql.lang.pattern.Pattern getWhen()
The statements that constitute the ‘when’ of the rule.
com.vaticle.typeql.lang.pattern.Pattern
isDeleted
@CheckReturnValue
Promise<java.lang.Boolean> isDeleted(TypeDBTransaction transaction)
Check if this rule has been deleted.
Name | Description | Type |
---|---|---|
|
The current |
|
Promise<java.lang.Boolean>
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.
Name | Description | Type |
---|---|---|
|
The current |
|
|
The new label to be given to the rule |
|
Promise<java.lang.Void>
rule.setLabel(transaction, newLabel).resolve();