### C++ Example: Get All Explainable Ownerships Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/answer/Explainables.adoc Example of calling the `ownerships` method on a `conceptMap.explainables()` object to retrieve all explainable ownerships associated with the concept map. ```cpp conceptMap.explainables().ownerships(); ``` -------------------------------- ### C++ Example: Get All Explainable Relations Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/answer/Explainables.adoc Example of calling the `relations` method on a `conceptMap.explainables()` object to retrieve all explainable relations associated with the concept map. ```cpp conceptMap.explainables().relations(); ``` -------------------------------- ### C++ Example: Get All Explainable Attributes Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/answer/Explainables.adoc Example of calling the `attributes` method on a `conceptMap.explainables()` object to retrieve all explainable attributes associated with the concept map. ```cpp conceptMap.explainables().attributes(); ``` -------------------------------- ### C++ Example: Get Explainable Ownership Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/answer/Explainables.adoc Example of calling the `ownership` method on a `conceptMap.explainables()` object to retrieve an explainable ownership using specified owner and attribute variables. ```cpp conceptMap.explainables().ownership(owner, attribute); ``` -------------------------------- ### C++ Example: Get Explainable Relation Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/answer/Explainables.adoc Example of calling the `relation` method on a `conceptMap.explainables()` object to retrieve an explainable relation using its variable name. ```cpp conceptMap.explainables().relation(variable); ``` -------------------------------- ### Install Primary Python Dependencies Source: https://github.com/typedb/typedb-driver/blob/master/python/requirements.txt This command installs the primary dependencies required for the project by reading them from the `requirements.txt` file. It's typically used for production or core functionality setups. ```bash pip install -r requirements.txt ``` -------------------------------- ### Initialize TypeDB C++ Driver Core Connection Source: https://github.com/typedb/typedb-driver/blob/master/cpp/README.md This C++ example demonstrates the basic setup for connecting to a TypeDB Core server. It includes the necessary `typedb_driver.hpp` header and initializes a `TypeDB::Driver` object to establish a connection. ```C++ // All files are included from typedb_driver.hpp #include int main() { TypeDB::Driver driver = TypeDB::Driver::coreDriver("127.0.0.1:1729"); ... return 0; } ``` -------------------------------- ### Execute TypeQL Get Query in C++ Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/transaction/QueryManager.adoc Example of executing a TypeQL Get query using the TypeDB C++ driver's QueryManager. This returns an iterable of concept maps. ```cpp transaction.query.get(query, options) ``` -------------------------------- ### C++ Example: Get Explainable Attribute Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/answer/Explainables.adoc Example of calling the `attribute` method on a `conceptMap.explainables()` object to retrieve an explainable attribute using its variable name. ```cpp conceptMap.explainables().attribute(variable); ``` -------------------------------- ### Import and Initialize TypeDB Driver in Python Source: https://github.com/typedb/typedb-driver/blob/master/python/README.md Example Python code to import the TypeDB driver and initialize a connection. This snippet demonstrates the basic setup required to interact with a TypeDB server. ```python from typedb.driver import * driver = TypeDB.driver(address=TypeDB.DEFAULT_ADDRESS, ...) ``` -------------------------------- ### Python TypeDB Driver Comprehensive Usage Example Source: https://github.com/typedb/typedb-driver/blob/master/python/README.md This example demonstrates how to connect to a TypeDB database, create a new database, and perform various transaction types (READ, SCHEMA, WRITE). It covers defining schema, executing TypeQL queries, handling exceptions, resolving query results, and iterating through concept rows and attributes. The example shows how to use 'with' blocks for automatic resource management and 'try-except-finally' for explicit error handling. ```python from typedb.driver import * class TypeDBExample: def typedb_example(self): # Open a driver connection. Specify your parameters if needed # The connection will be automatically closed on the "with" block exit with TypeDB.driver(TypeDB.DEFAULT_ADDRESS, Credentials("admin", "password"), DriverOptions()) as driver: # Create a database driver.databases.create("typedb") database = driver.databases.get("typedb") # Use "try" blocks to catch driver exceptions try: # Open transactions of 3 types tx = driver.transaction(database.name, TransactionType.READ) # Execute any TypeDB query using TypeQL. Wrong queries are rejected with an explicit exception result_promise = tx.query("define entity i-cannot-be-defined-in-read-transactions;") print("The result is still promised, so it needs resolving even in case of errors!") result_promise.resolve() except TypeDBDriverException as expected_exception: print(f"Once the query's promise is resolved, the exception is revealed: {expected_exception}") finally: # Don't forget to close the transaction! tx.close() # Open a schema transaction to make schema changes # Transactions can be opened with configurable options. This option limits its lifetime options = TransactionOptions(transaction_timeout_millis=10_000) # Use "with" blocks to forget about "close" operations (similarly to connections) with driver.transaction(database.name, TransactionType.SCHEMA, options) as tx: define_query = """ define entity person, owns name, owns age; attribute name, value string; attribute age, value integer; """ answer = tx.query(define_query).resolve() if answer.is_ok(): print(f"OK results do not give any extra interesting information, but they mean that the query " f"is successfully executed!") # Commit automatically closes the transaction. It can still be safely called inside "with" blocks tx.commit() # Open a read transaction to safely read anything without database modifications with driver.transaction(database.name, TransactionType.READ) as tx: answer = tx.query("match entity $x;").resolve() # Collect concept rows that represent the answer as a table rows = list(answer.as_concept_rows()) row = rows[0] # Collect column names to get concepts by index if the variable names are lost header = list(row.column_names()) column_name = header[0] # Get concept by the variable name (column name) concept_by_name = row.get(column_name) # Get concept by the header's index concept_by_index = row.get_index(0) print(f"Getting concepts by variable names ({concept_by_name.get_label()}) and " f"indexes ({concept_by_index.get_label()}) is equally correct. ") # Check if it's an entity type before the conversion if concept_by_name.is_entity_type(): print(f"Both represent the defined entity type: '{concept_by_name.as_entity_type().get_label()}' " f"(in case of a doubt: '{concept_by_index.as_entity_type().get_label()}')") # Continue querying in the same transaction if needed answer = tx.query("match attribute $a;").resolve() # Concept rows can be used as any other iterator rows = [row for row in answer.as_concept_rows()] for row in rows: # Same for column names column_names_iter = row.column_names() column_name = next(column_names_iter) concept_by_name = row.get(column_name) # Check if it's an attribute type before the conversion if concept_by_name.is_attribute_type(): attribute_type = concept_by_name.as_attribute_type() print(f"Defined attribute type's label: '{attribute_type.get_label()}', " f"value type: '{attribute_type.try_get_value_type()}'") print(f"It is also possible to just print the concept itself: '{concept_by_name}'") # Open a write transaction to insert data with driver.transaction(database.name, TransactionType.WRITE) as tx: ``` -------------------------------- ### ConceptRow Class API and Usage Examples Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/answer/ConceptRow.adoc Comprehensive API documentation for the `ConceptRow` class, including method signatures, descriptions, parameters, return types, and practical Java code examples for each method. ```APIDOC ConceptRow Class Package: com.typedb.driver.api.answer Description: Contains a row of concepts with a header. Methods: columnNames() Signature: java.util.stream.Stream columnNames() Description: Produces a stream over all column names (variables) in the header of this ConceptRow. Shared between all the rows in a QueryAnswer. Returns: java.util.stream.Stream concepts() Signature: java.util.stream.Stream concepts() Description: Produces a stream over all concepts in this ConceptRow, skipping empty results. Returns: java.util.stream.Stream get(java.lang.String columnName) Signature: java.util.Optional get(java.lang.String columnName) throws TypeDBDriverException Description: Retrieves a concept for a given column name (variable). Returns an empty Optional if the variable has an empty answer. Throws an exception if the variable is not present. Parameters: columnName: Type: java.lang.String Description: the variable (column name from column_names) Returns: java.util.Optional getIndex(long columnIndex) Signature: java.util.Optional getIndex(long columnIndex) throws TypeDBDriverException Description: Retrieves a concept for a given index of the header (columnNames). Returns an empty Optional if the index points to an empty answer. Throws an exception if the index is not in the row's range. Parameters: columnIndex: Type: long Description: the column index Returns: java.util.Optional getQueryType() Signature: QueryType getQueryType() Description: Retrieves the executed query's type of this ConceptRow. Shared between all the rows in a QueryAnswer. Returns: QueryType ``` ```java conceptRow.columnNames(); ``` ```java conceptRow.concepts(); ``` ```java conceptRow.get(columnName); ``` ```java conceptRow.getIndex(columnIndex); ``` ```java conceptRow.getQueryType(); ``` -------------------------------- ### TypeDB: cloudDriver Method Usage Example (Node.js) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/connection/TypeDB.adoc Example demonstrating how to use the `cloudDriver` method in Node.js to connect to TypeDB Cloud, providing server addresses and credentials. ```nodejs const driver = TypeDB.cloudDriver(["127.0.0.1:11729"], new TypeDBCredential(username, password)); ``` -------------------------------- ### Node.js: Retrieve all databases Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/connection/DatabaseManager.adoc Example of calling the `all()` method on the `DatabaseManager` to get all databases from the TypeDB server. ```nodejs driver.databases().all() ``` -------------------------------- ### TypeDB LogicManager getRules C++ Example Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/logic/LogicManager.adoc C++ code example demonstrating how to retrieve all rules using the getRules method on a TypeDB transaction's logic manager. ```cpp transaction.logic.getRules() ``` -------------------------------- ### TypeDB: coreDriver Method Usage Example (Node.js) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/connection/TypeDB.adoc Example demonstrating how to use the `coreDriver` method in Node.js to connect to a TypeDB Core server. ```nodejs const driver = TypeDB.coreDriver("127.0.0.1:11729"); ``` -------------------------------- ### Install All Python Dependencies (including Dev) Source: https://github.com/typedb/typedb-driver/blob/master/python/requirements.txt This command installs all project dependencies, including development-specific ones, by reading them from the `requirements_dev.txt` file. This is useful for developers setting up their environment. ```bash pip install -r requirements_dev.txt ``` -------------------------------- ### Create New User in Rust Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/rust/connection/UserManager.adoc Example of creating a new user with a username and password using the `UserManager.create()` method. This example uses the asynchronous version. ```Rust driver.users.create(username, password).await; ``` -------------------------------- ### TypeDB Rust Driver Comprehensive Example Source: https://github.com/typedb/typedb-driver/blob/master/rust/README.md This Rust code snippet demonstrates a complete workflow for interacting with TypeDB using the `typedb-driver` crate. It covers establishing a connection, creating and managing databases, opening different types of transactions (Read, Schema), executing TypeQL queries, handling potential errors during query execution, committing transactions, and processing query results, including accessing concepts from `ConceptRow` objects. ```Rust use std::time::Duration; use futures::{StreamExt, TryStreamExt}; use typedb_driver::{ answer::{ concept_document::{Leaf, Node}, ConceptRow, QueryAnswer, }, concept::{Concept, ValueType}, Credentials, DriverOptions, Error, QueryOptions, TransactionOptions, TransactionType, TypeDBDriver, }; fn typedb_example() { async_std::task::block_on(async { // Open a driver connection. Specify your parameters if needed let driver = TypeDBDriver::new( TypeDBDriver::DEFAULT_ADDRESS, Credentials::new("admin", "password"), DriverOptions::new(false, None).unwrap(), ) .await .unwrap(); // Create a database driver.databases().create("typedb").await.unwrap(); let database = driver.databases().get("typedb").await.unwrap(); // Dropped transactions are closed { // Open transactions of 3 types let transaction = driver.transaction(database.name(), TransactionType::Read).await.unwrap(); // Execute any TypeDB query using TypeQL. Wrong queries are rejected with an explicit error let result = transaction.query("define entity i-cannot-be-defined-in-read-transactions;").await; match result { Ok(_) => println!("This line will not be printed"), // Handle errors Err(error) => match error { Error::Connection(connection) => println!("Could not connect: {connection}"), Error::Server(server) => { println!("Received a detailed server error regarding the executed query: {server}") } Error::Internal(_) => panic!("Unexpected internal error"), _ => println!("Received an unexpected external error: {error}"), }, } } // Open a schema transaction to make schema changes // Transactions can be opened with configurable options. This option limits its lifetime let options = TransactionOptions::new().transaction_timeout(Duration::from_secs(10)); let transaction = driver.transaction_with_options(database.name(), TransactionType::Schema, options).await.unwrap(); let define_query = r#" define entity person, owns name, owns age; attribute name, value string; attribute age, value integer; "#; let answer = transaction.query(define_query).await.unwrap(); // Work with the driver's enums in a classic way or using helper methods if answer.is_ok() && matches!(answer, QueryAnswer::Ok(_)) { println!("OK results do not give any extra interesting information, but they mean that the query is successfully executed!"); } // Commit automatically closes the transaction (don't forget to await the result!) // CAUTION: Committing or closing a transaction will invalidate all its uncollected answer streams transaction.commit().await.unwrap(); // Open a read transaction to safely read anything without database modifications let transaction = driver.transaction(database.name(), TransactionType::Read).await.unwrap(); let answer = transaction.query("match entity $x;").await.unwrap(); // Collect concept rows that represent the answer as a table let rows: Vec = answer.into_rows().try_collect().await.unwrap(); let row = rows.get(0).unwrap(); // Retrieve column names to get concepts by index if the variable names are lost let column_names = row.get_column_names(); let column_name = column_names.get(0).unwrap(); // Get concept by the variable name (column name) let concept_by_name = row.get(column_name).unwrap().unwrap(); // Get concept by the header's index let concept_by_index = row.get_index(0).unwrap().unwrap(); // Check if it's an entity type if concept_by_name.is_entity_type() { print!("Getting concepts by variable names and indexes is equally correct. "); println!( "Both represent the defined entity type: '{}' (in case of a doubt: '{}')", concept_by_name.get_label(), concept_by_index.get_label() ); } // Continue querying in the same transaction if needed let answer = transaction.query("match attribute $a;").await.unwrap(); // Concept rows can be used as a stream of results let mut rows_stream = answer.into_rows(); while let Some(Ok(row)) = rows_stream.next().await { let mut column_names_iter = row.get_column_names().into_iter(); let column_name = column_names_iter.next().unwrap(); let concept_by_name = row.get(column_name).unwrap().unwrap(); ``` -------------------------------- ### TypeDB Java Driver: Full Example of Connection, Transactions, and Querying Source: https://github.com/typedb/typedb-driver/blob/master/java/README.md This comprehensive Java example demonstrates the full lifecycle of interacting with TypeDB using its Java driver. It includes establishing a driver connection, creating a new database, opening different types of transactions (READ and SCHEMA), executing TypeQL queries (including error handling for invalid queries in a READ transaction), defining schema, and retrieving and processing query results from a READ transaction. ```java package com.typedb.driver; import com.typedb.driver.TypeDB; import com.typedb.driver.api.Credentials; import com.typedb.driver.api.Driver; import com.typedb.driver.api.DriverOptions; import com.typedb.driver.api.QueryOptions; import com.typedb.driver.api.QueryType; import com.typedb.driver.api.Transaction; import com.typedb.driver.api.TransactionOptions; import com.typedb.driver.api.answer.ConceptRow; import com.typedb.driver.api.answer.ConceptRowIterator; import com.typedb.driver.api.answer.QueryAnswer; import com.typedb.driver.api.concept.Concept; import com.typedb.driver.api.concept.type.AttributeType; import com.typedb.driver.api.concept.type.EntityType; import com.typedb.driver.api.database.Database; import com.typedb.driver.common.Promise; import com.typedb.driver.common.exception.TypeDBDriverException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; public class TypeDBExample { public void example() { // Open a driver connection. Try-with-resources can be used for automatic driver connection management try (Driver driver = TypeDB.driver(TypeDB.DEFAULT_ADDRESS, new Credentials("admin", "password"), new DriverOptions(false, null))) { // Create a database driver.databases().create("typedb"); Database database = driver.databases().get("typedb"); // Open transactions of 3 types Transaction tx = driver.transaction(database.name(), Transaction.Type.READ); // Use "try" blocks to catch driver exceptions try { // Execute any TypeDB query using TypeQL. Wrong queries are rejected with an explicit exception Promise promise = tx.query("define entity i-cannot-be-defined-in-read-transactions;"); System.out.println("The result is still promised, so it needs resolving even in case of errors!"); promise.resolve(); } catch (TypeDBDriverException expectedException) { System.out.println("Once the query's promise is resolved, the exception is revealed: " + expectedException); } finally { // Don't forget to close the transaction! tx.close(); } // Open a schema transaction to make schema changes // Transactions can be opened with configurable options. This option limits its lifetime TransactionOptions transactionOptions = new TransactionOptions().transactionTimeoutMillis(10_000); // Use try-with-resources blocks to forget about "close" operations (similarly to connections) try (Transaction transaction = driver.transaction(database.name(), Transaction.Type.SCHEMA, transactionOptions)) { String defineQuery = "define " + "entity person, owns name, owns age; " + "attribute name, value string;\n" + "attribute age, value integer;"; QueryAnswer answer = transaction.query(defineQuery).resolve(); // Commit automatically closes the transaction. It can still be safely called inside "try" blocks transaction.commit(); } // Open a read transaction to safely read anything without database modifications try (Transaction transaction = driver.transaction(database.name(), Transaction.Type.READ)) { QueryAnswer entityAnswer = transaction.query("match entity $x;").resolve(); // Collect concept rows that represent the answer as a table List entityRows = entityAnswer.asConceptRows().stream().collect(Collectors.toList()); ConceptRow entityRow = entityRows.get(0); // Collect column names to get concepts by index if the variable names are lost List entityHeader = entityRow.columnNames().collect(Collectors.toList()); String columnName = entityHeader.get(0); // Get concept by the variable name (column name) Concept conceptByName = entityRow.get(columnName).get(); // Get concept by the header's index Concept conceptByIndex = entityRow.getIndex(0).get(); System.out.printf("Getting concepts by variable names (%s) and indexes (%s) is equally correct. ", conceptByName.getLabel(), conceptByIndex.getLabel()); // Check if it's an entity type before the conversion if (conceptByName.isEntityType()) { System.out.printf("Both represent the defined entity type: '%s' (in case of a doubt: '%s')%n", ``` -------------------------------- ### Connect to TypeDB Cloud and Define Schema (C#) Source: https://github.com/typedb/typedb-driver/blob/master/csharp/README.md This C# example demonstrates how to establish a connection to a TypeDB Cloud instance using `Drivers.CloudDriver`. It shows how to create a new database, obtain a session, initiate a write transaction, and define a simple schema with entities and attributes. Error handling for `TypeDBDriverException` is also included. ```C# using TypeDB.Driver; using TypeDB.Driver.Api; using TypeDB.Driver.Common; class WelcomeToTypeDB { static void Main(string[] args) { string dbName = "access-management-db"; // You can also specify all node addresses like: {"localhost:11729", "localhost:21729", "localhost:31729"} string[] serverAddrs = new string[]{"localhost:11729"}; try { TypeDBCredential connectCredential = new TypeDBCredential( "admin", "password", Environment.GetEnvironmentVariable("ROOT_CA")!); using (ITypeDBDriver driver = Drivers.CloudDriver(serverAddrs, connectCredential)) { driver.Databases.Create(dbName); IDatabase database = driver.Databases.Get(dbName); TypeDBOptions options = new TypeDBOptions(); // Example of one transaction for one session with options (options are optional) using (ITypeDBSession session = driver.Session(dbName, SessionType.Schema, options)) { // Example of multiple queries for one transaction with options (options are optional) using (ITypeDBTransaction transaction = session.Transaction(TransactionType.Write, options)) { transaction.Query.Define("define person sub entity;").Resolve(); string longQuery = "define name sub attribute, value string; person owns name;"; transaction.Query.Define(longQuery).Resolve(); transaction.Commit(); } } } } catch (TypeDBDriverException e) { Console.WriteLine($"Caught TypeDB Driver Exception: {e}"); // ... } } } ``` -------------------------------- ### Example: Initialize TypeDB DriverOptions with TLS (Rust) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/rust/connection/DriverOptions.adoc Demonstrates how to create a new `DriverOptions` instance in Rust, enabling TLS and providing a path to a CA certificate for server authentication. ```Rust DriverOptions::new(true, Some(&path_to_ca)); ``` -------------------------------- ### Execute TypeQL Explain Query in C++ Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/transaction/QueryManager.adoc Example of executing a TypeQL Explain query using the TypeDB C++ driver's QueryManager. This returns an iterable of explanations. ```cpp transaction.query.explain(explainable, options) ``` -------------------------------- ### TypeDB C Driver: Database Management Operations Source: https://github.com/typedb/typedb-driver/blob/master/c/README.md Demonstrates a sequence of operations to initialize a driver, manage databases (create, get), and retrieve database properties using the TypeDB C driver. It includes opening a connection, creating a database manager, creating and retrieving a database, and asserting its name. ```c char* dbName = "hello"; Driver *driver = driver_open_core("127.0.0.1:1729"); DatabaseManager* databaseManager = database_manager_new(driver); databases_create(databaseManager, dbName); Database* database = databases_get(databaseManager, dbName); char* gotName = database_name(database); assert(0 == strcmp(gotName, dbName)); ... ``` -------------------------------- ### Example: Get Untyped Object Value in Java Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Value.adoc Demonstrates how to retrieve the untyped `Object` value of a `Value` concept using the `get()` method, useful for equality checks or printing. ```Java value.get(); ``` -------------------------------- ### Build TypeDB Go Driver with Bazel Source: https://github.com/typedb/typedb-driver/blob/master/go/README.md Commands to build the TypeDB Go driver's native library and the Go driver itself using Bazel. These steps are part of the manual build process for the work-in-progress driver. ```Bash bazel build //go:libtypedb_driver_go_native bazel build //go:driver-go ``` -------------------------------- ### Get Supertypes of ThingType (Node.js) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/schema/EntityType.adoc Example of retrieving all supertypes of a ThingType from the database. ```nodejs thingType.getSupertypes(transaction) ``` -------------------------------- ### Connect to TypeDB Cloud Instances (C++) Source: https://github.com/typedb/typedb-driver/blob/master/cpp/README.md This example demonstrates how to connect to a TypeDB Cloud instance using TypeDB::Driver::cloudDriver. It covers providing credentials, handling self-signed certificates via an environment variable for the root CA path, and iterating through replica information for a created database. ```cpp std::string dbName = "cloud-database"; // Since we're using a self-signed certificate for encryption, we pass the path to the root-ca through an environment variable TypeDB::Credential creds("admin", "password", true, std::getenv("PATH_TO_ROOT_CA")); TypeDB::Driver driver = TypeDB::Driver::cloudDriver({"localhost:11729"}, creds); // You can also specify all node addresses TypeDB::Driver::cloudDriver({"localhost:11729, localhost:21729, localhost:31729"}, creds); driver.databases.create(dbName); TypeDB::Database db = driver.databases.get(dbName); std::cout << "Found replicas:" << std::endl; for (TypeDB::ReplicaInfo& replica : db.replicas()) { std::cout << "- " << replica.address() << " : " << replica.isPrimary() << std::endl; } ``` -------------------------------- ### ConceptRow: Get Concepts (Python) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/python/answer/ConceptRow.adoc Example of how to retrieve an iterator over all concepts in a `ConceptRow`. ```Python concept_row.concepts() ``` -------------------------------- ### Get Supertype of ThingType (Node.js) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/schema/EntityType.adoc Example of retrieving the immediate supertype of a ThingType from the database. ```nodejs thingType.getSupertype(transaction) ``` -------------------------------- ### Execute TypeQL Get Group Query in C++ Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/transaction/QueryManager.adoc Example of executing a TypeQL Get Group query using the TypeDB C++ driver's QueryManager. This returns an iterable of concept map groups. ```cpp transaction.query.getGroup(query, options) ``` -------------------------------- ### Connect to TypeDB and Perform Basic Read/Write Operations (C#) Source: https://github.com/typedb/typedb-driver/blob/master/csharp/README.md This C# code snippet demonstrates how to establish a connection to a TypeDB server using `Drivers.CoreDriver`. It covers creating and accessing a database, opening schema and data sessions, and executing both schema definition and data manipulation queries within transactions. The example illustrates defining types, inserting entities, and retrieving data, highlighting the importance of transaction commits for data visibility. ```C# using TypeDB.Driver; using TypeDB.Driver.Api; using TypeDB.Driver.Common; class WelcomeToTypeDB { static void Main(string[] args) { string dbName = "access-management-db"; string serverAddr = "127.0.0.1:1729"; try { using (ITypeDBDriver driver = Drivers.CoreDriver(serverAddr)) { driver.Databases.Create(dbName); IDatabase database = driver.Databases.Get(dbName); // Example of one transaction for one session using (ITypeDBSession session = driver.Session(dbName, SessionType.Schema)) { // Example of multiple queries for one transaction using (ITypeDBTransaction transaction = session.Transaction(TransactionType.Write)) { transaction.Query.Define("define person sub entity;").Resolve(); string longQuery = "define name sub attribute, value string; person owns name;"; transaction.Query.Define(longQuery).Resolve(); transaction.Commit(); } } // Example of multiple transactions for one session using (ITypeDBSession session = driver.Session(dbName, SessionType.Data)) { // Examples of one query for one transaction using (ITypeDBTransaction transaction = session.Transaction(TransactionType.Write)) { string query = "insert $p isa person, has name 'Alice';"; IEnumerable insertResults = transaction.Query.Insert(query); Console.WriteLine($"Inserted with {insertResults.Count()} result(s)"); transaction.Commit(); } using (ITypeDBTransaction transaction = session.Transaction(TransactionType.Write)) { IEnumerable insertResults = transaction.Query.Insert("insert $p isa person, has name 'Bob';"); foreach (IConceptMap insertResult in insertResults) { Console.WriteLine($"Inserted: {insertResult}"); } // transaction.Commit(); // Not committed } using (ITypeDBTransaction transaction = session.Transaction(TransactionType.Read)) { IConceptMap[] matchResults = transaction.Query.Get("match $p isa person, has name $n; get $n;").ToArray(); // Matches only Alice as Bob has not been committed var resultName = matchResults[0].Get("n"); Console.WriteLine($"Found the first name: {resultName.AsAttribute().Value.AsString()}"); if (matchResults.Length > 1) // Will work only if the previous transaction is committed { Console.WriteLine($"Found the second name as concept: {matchResults[1]}"); } } } database.Delete(); } } catch (TypeDBDriverException e) { Console.WriteLine($"Caught TypeDB Driver Exception: {e}"); // ... } } } ``` -------------------------------- ### Install TypeDB Python Driver via Pip Source: https://github.com/typedb/typedb-driver/blob/master/python/README.md Instructions to install the TypeDB Python driver using the pip package manager. This command installs the necessary `typedb-driver` package. ```bash pip install typedb-driver ``` -------------------------------- ### Install Python Development Dependencies Source: https://github.com/typedb/typedb-driver/blob/master/python/requirements_dev.txt This command installs all required Python packages for development from the `requirements_dev.txt` file. It ensures all necessary libraries are available for running tests and contributing to the project. ```bash pip install -r requirements_dev.txt ``` -------------------------------- ### C# Examples: Retrieve IThing Instances from IThingType Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/csharp/schema/IThingType.adoc Illustrates how to retrieve instances of `IThing` associated with an `IThingType` using the `GetInstances()` method, including examples with and without transitivity. ```cs thingType.GetInstances(transaction); thingType.GetInstances(transaction, Explicit); ``` -------------------------------- ### C++ Example: Get Overridden RoleType Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/schema/RelationType.adoc Illustrates how to retrieve a `RoleType` that is overridden by another role. ```cpp relationType.getRelatesOverridden(transaction, roleLabel).get(); ``` -------------------------------- ### Get All Replica Info for TypeDB Database (Rust) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/rust/connection/Database.adoc Example demonstrating how to retrieve all replica instances for a TypeDB database. This method is applicable only in TypeDB Cloud / Enterprise environments. ```Rust database.replicas_info() ``` -------------------------------- ### Execute TypeQL Get Group Aggregate Query in C++ Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/transaction/QueryManager.adoc Example of executing a TypeQL Get Group Aggregate query using the TypeDB C++ driver's QueryManager. This returns an iterable of value groups. ```cpp transaction.query.getGroupAggregate(query, options) ``` -------------------------------- ### DriverOptions Constructor API Reference Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/connection/DriverOptions.adoc Detailed API documentation for the `DriverOptions` constructor, outlining its parameters (`isTlsEnabled`, `tlsRootCAPath`), their types, and descriptions for configuring TLS settings. ```APIDOC DriverOptions: Constructor: Signature: public DriverOptions(boolean isTlsEnabled, java.lang.String tlsRootCAPath) Parameters: isTlsEnabled: Type: boolean Description: Specify whether the connection to TypeDB Server must be done over TLS. tlsRootCAPath: Type: java.lang.String Description: Path to the CA certificate to use for authenticating server certificates. Returns: public ``` -------------------------------- ### Execute TypeQL Get Aggregate Query in C++ Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/transaction/QueryManager.adoc Example of executing a TypeQL Get Aggregate query using the TypeDB C++ driver's QueryManager. The .get() method is called to retrieve the aggregate result. ```cpp transaction.query.getAggregate(query, options).get() ``` -------------------------------- ### Create a new user (Python) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/python/connection/UserManager.adoc Example of creating a new user with a given username and password using the Python driver. ```python driver.users.create(username, password) ``` -------------------------------- ### ConceptRow: Get Column Names (Python) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/python/answer/ConceptRow.adoc Example of how to retrieve an iterator over all column names in a `ConceptRow`. ```Python concept_row.column_names() ``` -------------------------------- ### Install TypeDB Driver for Python using pip Source: https://github.com/typedb/typedb-driver/blob/master/RELEASE_TEMPLATE.md This command demonstrates how to install the TypeDB Python driver using pip, Python's package installer. Specify the desired version to ensure compatibility. ```sh pip install typedb-driver=={version} ``` -------------------------------- ### Example: Get QueryType from ConceptRow Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/answer/QueryType.adoc Demonstrates how to retrieve the `QueryType` from a `conceptRow` object in Java. ```Java conceptRow.queryType(); ``` -------------------------------- ### Initialize TypeDB Driver in Rust Source: https://github.com/typedb/typedb-driver/blob/master/rust/README.md This Rust code snippet demonstrates how to import the `TypeDBDriver` and initialize a new core driver instance, connecting to the default TypeDB server address. It showcases the asynchronous API for establishing a connection. ```Rust use typedb_driver::TypeDBDriver; let driver = TypeDBDriver::new_core(TypeDBDriver::DEFAULT_ADDRESS).await.unwrap(); ``` -------------------------------- ### Reference All TypeDB C# Driver Pinvoke Runtimes for Cross-Platform Support Source: https://github.com/typedb/typedb-driver/blob/master/csharp/README.md Example of referencing all necessary TypeDB C# Driver Pinvoke runtimes in a .csproj file to build a platform-independent application, noting the impact on application size due to downloading platform-specific dynamic libraries. ```XML ``` -------------------------------- ### Node.js: Retrieve a specific database Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/connection/DatabaseManager.adoc Example of calling the `get()` method on the `DatabaseManager` to retrieve a specific database by its name. ```nodejs driver.databases().get(name) ``` -------------------------------- ### Get Label from Concept (Java) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Attribute.adoc Example of safely retrieving the label from a `Concept` object using `tryGetLabel()` in Java. ```java concept.tryGetLabel(); ``` -------------------------------- ### Create a New Database in Rust Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/rust/connection/DatabaseManager.adoc This code demonstrates how to create a new database with a specified name on the TypeDB server using the `DatabaseManager`. Both asynchronous and synchronous examples are provided to show how to call the `create` method. ```Rust driver.databases().create(name).await; ``` ```Rust driver.databases().create(name); ``` -------------------------------- ### C# Example: Get All Owners of IAttributeType Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/csharp/schema/IAttributeType.adoc Shows how to retrieve all ThingTypes that own an attribute of this IAttributeType, including inherited ownership. ```cs attributeType.GetOwners(transaction); ``` -------------------------------- ### Install TypeDB Driver for NodeJS using npm Source: https://github.com/typedb/typedb-driver/blob/master/RELEASE_TEMPLATE.md This command shows how to install the TypeDB NodeJS driver using npm, the Node.js package manager. The `@` symbol is used to specify the exact version to install. ```sh npm install typedb-driver@{version} ``` -------------------------------- ### Install TypeDB Python Driver using pip3 Source: https://github.com/typedb/typedb-driver/blob/master/python/README.md Alternative installation command for the TypeDB Python driver using `pip3`, useful when multiple Python versions are present on the system. ```bash pip3 install typedb-driver ``` -------------------------------- ### ConceptRow: Get Concept by Column Index (Python) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/python/answer/ConceptRow.adoc Example of how to retrieve a concept from a `ConceptRow` using its column index. ```Python concept_row.get_index(column_index) ``` -------------------------------- ### API Reference for TypeDB DriverOptions new method Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/rust/connection/DriverOptions.adoc Detailed API documentation for the `DriverOptions::new` method, including input parameters and return type. ```APIDOC DriverOptions::new(is_tls_enabled: bool, tls_root_ca: Option<&Path>) Parameters: is_tls_enabled: bool - Specify whether the connection to TypeDB Server must be done over TLS. tls_root_ca: Option<&Path> - Path to the CA certificate to use for authenticating server certificates. Returns: Result ``` -------------------------------- ### ConceptRow: Get Concept by Column Name (Python) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/python/answer/ConceptRow.adoc Example of how to retrieve a concept from a `ConceptRow` using its column name. ```Python concept_row.get(column_name) ``` -------------------------------- ### TypeDB LogicManager getRule C++ Example Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/logic/LogicManager.adoc C++ code example demonstrating how to retrieve a Rule using the getRule method on a TypeDB transaction's logic manager. The .get() method is called to resolve the future. ```cpp transaction.logic.getRule(label).get(); ``` -------------------------------- ### Get Instances of ThingType in Node.js Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/schema/RelationType.adoc Example of retrieving instances of a ThingType using `getInstances` with explicit transitivity. ```nodejs thingType.getInstances(transaction, Transitivity.EXPLICIT) ``` -------------------------------- ### TypeDB C++ Driver API: Connection Components Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/api-reference.adoc Overview of API components for managing connections in the TypeDB C++ Driver, including Driver, Credentials, Database, Replica Information, and User Management. ```APIDOC Connection: Driver Credential DatabaseManager Database ReplicaInfo UserManager User ``` -------------------------------- ### Create new TypeDB user (C++) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/connection/UserManager.adoc Example of creating a new user with a specified username and password using the `driver.users.create()` method in C++. ```cpp driver.users.create(username, password); ``` -------------------------------- ### Get Syntax for ThingType (Node.js) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/schema/EntityType.adoc Example of retrieving the define query syntax for a ThingType, which can be useful for schema introspection or generation. ```nodejs thingType.getSyntax(transaction) ``` -------------------------------- ### Get Subtypes of ThingType (Node.js) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/schema/EntityType.adoc Example of retrieving all direct and indirect subtypes of a ThingType using the default transitivity, which is `Transitivity.TRANSITIVE`. ```nodejs thingType.getSubtypes(transaction) ``` -------------------------------- ### Install TypeDB Python Driver via Pip Source: https://github.com/typedb/typedb-driver/blob/master/RELEASE_NOTES_LATEST.md This command demonstrates how to install the TypeDB Python driver using pip. It ensures that version 3.4.0 of the driver is installed, making it available for your Python applications. ```Shell pip install typedb-driver==3.4.0 ``` -------------------------------- ### UserManager.create(username: str, password: str) API Reference Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/python/connection/UserManager.adoc API documentation for creating a user with the given name and password. ```APIDOC create(username: str, password: str) -> None Parameters: username (str): The name of the user to be created password (str): The password of the user to be created Returns: None ``` -------------------------------- ### C# Example: Retrieve Regex for IAttributeType Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/csharp/schema/IAttributeType.adoc Shows how to get the regular expression associated with an IAttributeType instance within a transaction. ```cs attributeType.GetRegex(transaction).Resolve(); ``` -------------------------------- ### IValueGroup C# Usage Examples Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/csharp/answer/IValueGroup.adoc Examples demonstrating how to access properties of IValueGroup instances in C#. ```C# conceptMapGroup.Owner; ``` ```C# valueGroup.Value; ``` -------------------------------- ### C++ Example: Get Specific Related RoleType by Label Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/schema/RelationType.adoc Demonstrates retrieving a specific `RoleType` related to a `RelationType` by its label. ```cpp relationType.getRelates(transaction, roleLabel).get(); ``` -------------------------------- ### TypeDB C Driver Distribution Structure Source: https://github.com/typedb/typedb-driver/blob/master/c/README.md Illustrates the typical directory structure of the TypeDB C driver distribution, showing the location of header files and shared libraries. ```text |- include/ | |- typedb_driver.h | |- lib/ |- libtypedb_driver_clib. ``` -------------------------------- ### Install TypeDB Driver for Rust using Cargo Source: https://github.com/typedb/typedb-driver/blob/master/RELEASE_TEMPLATE.md This snippet demonstrates how to add the TypeDB driver to a Rust project using the `cargo add` command. This command automatically updates the `Cargo.toml` file with the necessary dependency. ```sh cargo add typedb-driver@{version} ``` -------------------------------- ### Rust Example: Get AttributeType Label Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/rust/schema/AttributeType.adoc Demonstrates how to call the `label()` method on an `AttributeType` instance to retrieve its unique label in Rust. ```Rust attribute_type.label() ``` -------------------------------- ### Get Subtypes of ThingType with Transitivity (Node.js) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/schema/EntityType.adoc Example of retrieving subtypes of a ThingType, specifying transitivity (e.g., direct only) using `Transitivity.EXPLICIT`. ```nodejs thingType.getSubtypes(transaction, Transitivity.EXPLICIT) ``` -------------------------------- ### Reference TypeDB C# Driver Nuget Package for MacOS Source: https://github.com/typedb/typedb-driver/blob/master/csharp/README.md Example of referencing the TypeDB C# Driver and its Pinvoke runtime for MacOS x86-64 in a .csproj file, specifying the required Nuget packages. ```XML ``` -------------------------------- ### Open Read Transaction and Execute Match Query with Options in Rust Source: https://github.com/typedb/typedb-driver/blob/master/rust/README.md Demonstrates how to open a read transaction in TypeDB and execute a 'match' query. It also shows how to apply query options, such as `include_instance_types`, to control the structure of the returned concept rows. ```Rust let transaction = driver.transaction(database.name(), TransactionType::Read).await.unwrap(); // A match query can be used for concept row outputs // Queries can also be executed with configurable options. This option forces the database // to include types of instance concepts in ConceptRows answers let options = QueryOptions::new().include_instance_types(true); let var = "x"; let answer = transaction.query_with_options(format!("match ${} isa person;", var), options).await.unwrap(); ``` -------------------------------- ### Example: Get Label from Concept Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/schema/AttributeType.adoc Demonstrates how to retrieve the label from a Concept using tryGetLabel(). ```java concept.tryGetLabel(); ``` -------------------------------- ### Get Integer Value from Concept (Java) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Attribute.adoc Example of safely retrieving an integer value from a `Concept` object using `tryGetInteger()` in Java. ```java concept.tryGetInteger(); ``` -------------------------------- ### Build TypeDB C# Driver from Source using Bazel Source: https://github.com/typedb/typedb-driver/blob/master/csharp/README.md Command to build the TypeDB C# driver's shared library from source using Bazel, producing the necessary C# libraries in the specified output directory. ```Shell bazel build //csharp:driver-csharp ``` -------------------------------- ### Get Duration Value from Concept (Java) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Attribute.adoc Example of safely retrieving a duration value from a `Concept` object using `tryGetDuration()` in Java. ```java concept.tryGetDuration(); ``` -------------------------------- ### Java: Create a New TypeDB Database Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/connection/DatabaseManager.adoc Example of how to create a new database with a specified name using the `driver.databases().create(name)` method. ```Java driver.databases().create(name) ``` -------------------------------- ### Get Double Value from Concept (Java) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Attribute.adoc Example of safely retrieving a double value from a `Concept` object using `tryGetDouble()` in Java. ```java concept.tryGetDouble(); ``` -------------------------------- ### Get Decimal Value from Concept (Java) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Attribute.adoc Example of safely retrieving a decimal value from a `Concept` object using `tryGetDecimal()` in Java. ```java concept.tryGetDecimal(); ``` -------------------------------- ### Build TypeDB C++ Driver Shared Library with Bazel Source: https://github.com/typedb/typedb-driver/blob/master/cpp/README.md This Bazel command builds the TypeDB C++ driver's shared library. The output includes the library file (e.g., .so, .dylib, .dll) and, for Windows, an import library. Headers are located separately in the `cpp/include` directory. ```Bazel bazel build //cpp:typedb-driver-cpp ``` -------------------------------- ### Configure QueryOptions in Python Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/python/transaction/QueryOptions.adoc Demonstrates how to initialize QueryOptions and set properties to override default server behavior for TypeDB queries. ```python query_options = QueryOptions(include_instance_types=True) query_options.prefetch_size = 10 ``` -------------------------------- ### Get Datetime Value from Concept (Java) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Attribute.adoc Example of safely retrieving a datetime value from a `Concept` object using `tryGetDatetime()` in Java. ```java concept.tryGetDatetime(); ``` -------------------------------- ### Export and Import TypeDB Databases to Files Across Languages Source: https://github.com/typedb/typedb-driver/blob/master/RELEASE_NOTES_LATEST.md These examples illustrate how to export a TypeDB database's schema and data to specified files, and subsequently import them to create a new database. These operations are blocking and can be time-consuming for large datasets, so consider parallel connections for continued server interaction. ```Rust // export let db = driver.databases().get(db_name).await.unwrap(); db.export_to_file(schema_file_path, data_file_path).await.unwrap(); // import let schema = read_to_string(schema_file_path).unwrap(); driver.databases().import_from_file(db_name2, schema, data_file_path).await.unwrap(); ``` ```Python # export database = driver.databases.get(db_name) database.export_to_file(schema_file_path, data_file_path) # import with open(schema_file_path, 'r', encoding='utf-8') as f: schema = f.read() driver.databases.import_from_file(db_name2, schema, data_file_path) ``` ```Java // export Database database = driver.databases().get(dbName); database.exportToFile(schemaFilePath, dataFilePath); // import String schema = Files.readString(Path.of(schemaFilePath)); driver.databases().importFromFile(dbName2, schema, dataFilePath); ``` -------------------------------- ### Get TypeDB Transaction Type (C#) Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/csharp/transaction/ITypeDBTransaction.adoc Example of retrieving the type (Read or Write) of an ITypeDBTransaction. ```cs transaction.Type; ``` -------------------------------- ### C++ Example: Get RelationType Instances Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/cpp/schema/RelationType.adoc Illustrates retrieving instances of a `RelationType`, specifying transitivity to include direct or inherited instances. ```cpp relationType.getInstances(transaction, transitivity) ``` -------------------------------- ### Node.js: Create a new database Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/connection/DatabaseManager.adoc Example of calling the `create()` method on the `DatabaseManager` to create a new database with a given name. ```nodejs driver.databases().create(name) ``` -------------------------------- ### Get Owned Attributes of ThingType in Node.js Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/nodejs/schema/RelationType.adoc Examples of retrieving owned attributes of a ThingType using various `getOwns` overloads. ```nodejs thingType.getOwns(transaction) thingType.getOwns(transaction, valueType, Transitivity.EXPLICIT,[Annotation.KEY]) ``` -------------------------------- ### TypeDB Credentials Constructor API Documentation Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/connection/Credentials.adoc Documents the constructor for the `Credentials` class, detailing its parameters and their types for creating user credentials. ```APIDOC Credentials: __init__(username: java.lang.String, password: java.lang.String) username: The name of the user to connect as password: The password for the user Returns: public ``` -------------------------------- ### TypeDB Driver IUserManager Interface Overview Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/csharp/connection/IUserManager.adoc Provides a high-level overview of the `IUserManager` interface, detailing its purpose and the methods it exposes for managing users within TypeDB. This interface is part of the `TypeDB.Driver.Api` package. ```APIDOC Package: TypeDB.Driver.Api IUserManager Interface: Provides access to all user management methods. Methods: Contains(username: string): bool Create(username: string, password: string): void Delete(username: string): void Get(username: string): IUser? GetAll(): ISet SetPassword(username: string, password: string): void ``` -------------------------------- ### Example: Get Boolean Value from Concept Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/schema/RelationType.adoc Demonstrates how to attempt to retrieve a boolean value from a `Concept` object using `tryGetBoolean()`. ```java concept.tryGetBoolean(); ``` -------------------------------- ### Get Duration Value from Attribute Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/java/data/Attribute.adoc An example of retrieving a duration value from an attribute. The specific method signature and full description are not provided in this snippet. ```java attribute.getDuration(); ``` -------------------------------- ### Retrieve All Users in Rust Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/rust/connection/UserManager.adoc Example of retrieving all users from the TypeDB server using the `UserManager.all()` method. This example uses the asynchronous version. ```Rust driver.users.all().await; ``` -------------------------------- ### C# Example: Get Owners of IAttributeType with Annotations Source: https://github.com/typedb/typedb-driver/blob/master/docs/modules/ROOT/partials/csharp/schema/IAttributeType.adoc Demonstrates how to retrieve ThingTypes that own an attribute of this IAttributeType, applying a filter based on specific annotations. ```cs attributeType.GetOwners(transaction, annotations); ```