Once the connection is established, you can send requests to query the database through various methods on the Connection object, categorized as follows:
UQL Execution
|
|
Graphset Management
|
Schema and Property Management
|
Data Insertion and Deletion
|
Query Acceleration
|
Algorithm Management
|
Downloads and Exports
|
Process and Task Management
|
Access Management
|
Others
|
|
The task specific methods eliminate the need to explicitly write UQL. The following two examples use the uql() and getNodeSchema() methods respectively to retrieve the club-member node schema and print its associated properties. Notice that the latter is easier to write and returns the result as a Schema directly. While with uql(), you need to extract the data from Response and cast it into Schema.
// Uses the uql() method
Response response = client.uql("show().node_schema(@`club-member`)");
List<Schema> schemas = response.get(0).asSchemas();
for (Schema schema : schemas) {
System.out.println(schema.getProperties());
}
// Uses the getNodeSchema() method
Schema schema = client.getNodeSchema("club-member");
System.out.println(schema.getProperties());
However, the uql() method serves all querying purposes and can be utilized when the task specific methods are not privided, such as for node, edge or path queries.
Lastly, if you are retrieving a large amount of data from the database, it is recommended to use the the uqlStream() method to processes the result set incrementally.