UltipaDocs
Try Playground
  • Introduction
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Installation
    • Connection
    • Request Configuration
    • UQL Execution
    • GQL Execution
    • Graphset Management
    • Schema and Property Management
    • Data Insertion and Deletion
    • Query Acceleration
    • Algorithm Management
    • Downloads and Exports
    • Process and Task Management
    • Access Management
    • Server Statistics
    • Result Processing
    • Types Mapping Ultipa and C#
  • RESTful API
  1. Docs
  2. /
  3. Ultipa Drivers
  4. /
  5. Java

Driver Data Classes

The Ultipa Java driver provides a set of data classes designed to facilitate seamless interaction with the graph database. All data classes support getter methods to retrieve an attribute and setter methods to set the value of an attribute.

Node

A Node object includes the following attributes:

Attribute
Type
Default
Description
uuidLong/Node _uuid.
idString/Node _id.
schemaString/Name of the schema the node belongs to.
valuesValue/Node property key-value pairs.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("MATCH (n) RETURN n LIMIT 5", requestConfig);
List<Node> nodes = response.alias("n").asNodes();

System.out.println("ID of the first node: " + nodes.get(0).getID());
System.out.println("Name of the first node: " + nodes.get(0).get("name"));
Output
ID of the first node: ULTIPA800000000000004B
Name of the first node: Claire89

Edge

An Edge object includes the following attributes:

Attribute
Type
Default
Description
uuidLong/Edge _uuid.
fromUuidLong/Source node _uuid of the edge.
toUuidLong/Destination node _uuid of the edge.
fromString/Source node _id of the edge.
toString/Destination node _id of the edge.
schemaString/Name of the schema the edge belongs to.
valuesValue/Edge property key-value pairs.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("MATCH ()-[e]->() RETURN e LIMIT 3", requestConfig);
List<Edge> edges = response.alias("e").asEdges();

for (Edge edge : edges) {
    System.out.println(edge.getValues());
}
Output
{toUuid=108, uuid=1661, fromUuid=59, timestamp=Sun Oct 14 06:27:42 CST 2018}
{toUuid=15, uuid=31, fromUuid=59}
{toUuid=1012, uuid=1368, fromUuid=59, datetime=2019-03-23T17:09:12}

Path

A Path object includes the following attributes:

Attribute
Type
Default
Description
nodeUUidsList<Long>/The list of node _uuids in the path.
edgeUuidsList<Long>/The list of edge _uuids in the path
nodesMap<Long, Node>{}A map of nodes in the path, where the key is the node’s _uuid, and the value is the corresponding node.
edgesMap<Long, Edge>{}A map of edges in the path, where the key is the edge’s _uuid, and the value is the corresponding edge.

Methods on a Path object:

Method
Return
Description
length()intGets the length of the path, i.e., the number of edges in the path.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("MATCH p = ()-[]-()-[]-() RETURN p LIMIT 3", requestConfig);
Graph graph = response.alias("p").asGraph();

System.out.println("Nodes in each returned path:");
List<Path> paths = graph.getPaths();
for (Path path : paths) {
    System.out.println(path.getNodeUUIDs());
}
Output
Nodes in each returned path:
[6196955286285058052, 7998395137233256457, 8214567919347040275]
[6196955286285058052, 7998395137233256457, 8214567919347040275]
[6196955286285058052, 7998395137233256457, 5764609722057490441]

Graph

A Graph object includes the following attributes:

Attribute
Type
Default
Description
pathsList<Path>[]The list of the returned paths.
nodesMap<Long, Node>{}A map of nodes in the graph, where the key is the node’s _uuid, and the value is the corresponding node.
edgesMap<Long, Edge>{}A map of edges in the graph, where the key is the edge’s _uuid, and the value is the corresponding edge.

Methods on a Graph object:

Method
Parameter
Return
Description
addNode()node: Node/Add a node to nodes.
addEdge()edge: Edge/Add an edge to edges.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("MATCH p = ()-[]-()-[]-() RETURN p LIMIT 3", requestConfig);
Graph graph = response.alias("p").asGraph();

System.out.println("Nodes in each returned path:");
List<Path> paths = graph.getPaths();
for (Path path : paths) {
    System.out.println(path.getNodeUUIDs());
}

System.out.println("----------");
System.out.println("Nodes in the graph formed by all returned paths:");
System.out.println(graph.getNodes().keySet());
Output
Nodes in each returned path:
[6196955286285058052, 7998395137233256457, 8214567919347040275]
[6196955286285058052, 7998395137233256457, 8214567919347040275]
[6196955286285058052, 7998395137233256457, 5764609722057490441]
----------
Nodes in the graph formed by all returned paths:
[8214567919347040275, 6196955286285058052, 7998395137233256457, 5764609722057490441]

GraphSet

A GraphSet object includes the following attributes:

Attribute
Type
Default
Description
idString/Graph ID.
nameString/Graph name.
totalNodesLong/Total number of nodes in the graph.
totalEdgesLong/Total number of edges in the graph.
shardsList<String>[]The list of IDs of shard servers where the graph is stored.
partitionByStringCrc32The hash function used for graph sharding, which can be Crc32, Crc64WE, Crc64XZ, or CityHash64.
statusString/Graph status, which can be NORMAL, LOADING_SNAPSHOT, CREATING, DROPPING, or SCALING.
descriptionString/Graph description.
slotNumint0The number of slots used for graph sharding.
Java
Response response = driver.gql("SHOW GRAPH");
List<GraphSet> graphs = response.alias("_graph").asGraphSets();

for (GraphSet graph : graphs) {
    System.out.println(graph.getName());
}
Output
DFS_EG
cyber
netflow

Schema

A Schema object includes the following attributes:

Attribute
Type
Default
Description
nameString/Schema name
dbTypeDBType/Schema type, which can be DBNODE or DBEDGE.
propertiesList<Property>/The list of properties associated with the schema.
descriptionString/Schema description
totalLong0Total number of nodes or edges belonging to the schema.
idString/Schema ID.
statsList<SchemaStat>/A list of SchemaStat objects; each SchemaStat includes attributes name (schema name), dbType (schema type), fromSchema (source node schema), toSchema (destination node schema), and count (count of nodes or edges).
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("SHOW NODE SCHEMA", requestConfig);
List<Schema> schemas = response.alias("_nodeSchema").asSchemas();

for (Schema schema : schemas) {
    System.out.println(schema.getName());
}
Output
default
account
celebrity
country
movie

Property

A Property object includes the following attributes:

Attribute
Type
Default
Description
nameString/Property name.
typeUltipa.PropertyType/Property value type, which can be INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, DECIMAL, STRING, TEXT, LOCAL_DATETIME, ZONED_DATETIME, DATE, LOCAL_TIME, ZONED_TIME, DATETIME, TIMESTAMP, YEAR_TO_MONTH, DAY_TO_SECOND, BLOB, BOOL, POINT, LIST, SET, MAP, NULL, UUID, ID, FROM, FROM_UUID, TO, TO_UUID, IGNORE, or UNSET.
subTypeList<Ultipa.PropertyType>/If the type is LIST or SET, sets its element type; only one UltipaPropertyType is allowed in the list.
schemaString/The associated schema of the property.
descriptionString/Property description.
lteBoolean/Whether the property is LTE-ed.
readBoolean/Whether the property is readable.
writeBoolean/Whether the property can be written.
encryptString/Encryption method of the property, which can be AES128, AES256, RSA, or ECC.
decimalExtraDecimalExtra/The precision (1–65) and scale (0–30) of the DECIMAL type.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("SHOW NODE account PROPERTY", requestConfig);
List<Property> properties = response.alias("_nodeProperty").asProperties();

for (Property property : properties) {
    System.out.println(property.getName());
}
Output
title
profile
age
name
logo

Attr

A Attr object includes the following attributes:

Attribute
Type
Default
Description
nameString/Name of the returned alias.
valuesList<Object>/The returned values.
propertyTypeUltipa.PropertyType/Type of the results.
resultTypeUltipa.ResultType/Type of the results, which can be RESULT_TYPE_NODE, RESULT_TYPE_EDGE, RESULT_TYPE_PATH, RESULT_TYPE_ATTR, RESULT_TYPE_TABLE, or RESULT_TYPE_UNSET.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("MATCH (n:account) RETURN n.name LIMIT 3", requestConfig);
Attr attr = response.alias("n.name").asAttr();

System.out.println("name: " + attr.getName());
System.out.println("values: " + attr.getValues());
System.out.println("type: " + attr.getPropertyType());
Output
name: n.name
values: ['Velox', 'K03', 'Lunatique']
type: STRING

Table

A Table object includes the following attributes:

Attribute
Type
Default
Description
nameString/Table name.
headersList<Header>/Table headers.
rowsList<List<Object>>/Table rows.

Methods on a Table object:

Method
Return
Description
toKV()List<Value>Convert all rows in the table to a list of dictionaries.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("MATCH (n:account) RETURN table(n._id, n.name) LIMIT 3", requestConfig);
Table table = response.get(0).asTable();

System.out.println("Header:");
for (Header header : table.getHeaders()) {
    System.out.println(header.getPropertyName() + " - " + header.getPropertyType());
}

System.out.println("First Row:");
List<Value> rows = table.toKV();
if (!rows.isEmpty()) {
    System.out.println(rows.get(0));
}
Output
Header:
n._id - STRING
n.name - STRING
First Row:
{n._id=ULTIPA800000000000003B, n.name=Velox}

HDCGraph

An HDCGraph object includes the following attributes:

Attribute
Type
Default
Description
nameString/HDC graph name.
graphNameString/The source graph from which the HDC graph is created.
statusString/HDC graph status.
statsString/Statistics of the HDC graph.
isDefaultString/Whether it is the default HDC graph of the source graph.
hdcServerNameString/Name of the HDC server that hosts the HDC graph.
hdcServerStatusString/Status of the HDC server that hosts the HDC graph.
configString/Configurations of the HDC graph.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.uql("hdc.graph.show()", requestConfig);
List<HDCGraph> hdcGraphs = response.alias("_hdcGraphList").asHDCGraphs();

for (HDCGraph hdcGraph : hdcGraphs) {
    System.out.println(hdcGraph.getName() + " on " + hdcGraph.getHdcServerName());
}
Output
miniCircle_hdc_graph on hdc-server-1
miniCircle_hdc_graph2 on hdc-server-2

Algo

An Algo object includes the following attributes:

Attribute
Type
Default
Description
nameString/Algorithm name.
typeString/Algorithm type.
versionString/Algorithm version.
paramsList<AlgoParam>/Algorithm parameters, each AlgoParam has attributes name and desc.
writeSupportTypeString/The writeback types supported by the algorithm.
canRollbackString/Whether the algorithm version supports rollback.
configContextString/The configurations of the algorithm.
Java
Response response = driver.uql("show().hdc('hdc-server-1')");
List<Algo> algos = response.alias("_algoList").asAlgos();

for (Algo algo : algos) {
  System.out.println(algo.getName() + " supports writeback types: " + algo.getWriteSupportType());
}
Output
fastRP supports writeback types: DB,FILE
struc2vec supports writeback types: DB,FILE

Projection

A Projection object includes the following attributes:

Attribute
Type
Default
Description
nameString/Projection name.
graphNameString/The source graph from which the projection is created.
statusString/Projection status.
statsString/Statistics of the projection.
configString/Configurations of the projection.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.uql("show().projection()", requestConfig);
List<Projection> projections = response.alias("_projectionList").asProjections();

for (Projection projection : projections) {
    System.out.println(projection.getName());
}
Output
miniCircle_projection_1

Index

An Index object includes the following attributes:

Attribute
Type
Default
Description
idString/Index ID.
nameString/Index name.
propertiesString/Properties associated with the index.
schemaString/The schema associated with the index
statusString/Index status.
sizeString/Index size in bytes.
dbTypeDBType/Index type, which can be DBNODE or DBEDGE.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("SHOW NODE INDEX", requestConfig);
List<Index> indexList = response.alias("_nodeIndex").asIndexes();

for (Index index : indexList) {
    System.out.println(index.getSchema() + " - " + index.getProperties());
}
Output
account - gender(6),year

Privilege

A Privilege object includes the following attributes:

Attribute
Type
Default
Description
nameString/Privilege name.
levelPrivilegeLevel/Privilege level, which can be SYSTEM_LEVEL or GRAPH_LEVEL.
Java
Response response = driver.uql("show().privilege()");
List<Privilege> privileges = response.alias("_privilege").asPrivileges();

String graphPrivilegeNames = privileges.stream()
		.filter(p -> p.getLevel() == PrivilegeLevel.GRAPH_LEVEL)
		.map(Privilege::getName)
		.collect(Collectors.joining(", "));
System.out.println("Graph privileges: " + graphPrivilegeNames);

String systemPrivilegeNames = privileges.stream()
		.filter(p -> p.getLevel() == PrivilegeLevel.SYSTEM_LEVEL)
		.map(Privilege::getName)
		.collect(Collectors.joining(", "));
System.out.println("System privileges: " + systemPrivilegeNames);
Output
Graph privileges: READ, INSERT, UPSERT, UPDATE, DELETE, CREATE_SCHEMA, DROP_SCHEMA, ALTER_SCHEMA, SHOW_SCHEMA, RELOAD_SCHEMA, CREATE_PROPERTY, DROP_PROPERTY, ALTER_PROPERTY, SHOW_PROPERTY, CREATE_FULLTEXT, DROP_FULLTEXT, SHOW_FULLTEXT, CREATE_INDEX, DROP_INDEX, SHOW_INDEX, LTE, UFE, CLEAR_JOB, STOP_JOB, SHOW_JOB, ALGO, CREATE_PROJECT, SHOW_PROJECT, DROP_PROJECT, CREATE_HDC_GRAPH, SHOW_HDC_GRAPH, DROP_HDC_GRAPH, COMPACT_HDC_GRAPH, SHOW_VECTOR_INDEX, CREATE_VECTOR_INDEX, DROP_VECTOR_INDEX, SHOW_CONSTRAINT, CREATE_CONSTRAINT, DROP_CONSTRAINT
System privileges: TRUNCATE, COMPACT, CREATE_GRAPH, SHOW_GRAPH, DROP_GRAPH, ALTER_GRAPH, TOP, KILL, STAT, SHOW_POLICY, CREATE_POLICY, DROP_POLICY, ALTER_POLICY, SHOW_USER, CREATE_USER, DROP_USER, ALTER_USER, SHOW_PRIVILEGE, SHOW_META, SHOW_SHARD, ADD_SHARD, DELETE_SHARD, REPLACE_SHARD, SHOW_HDC_SERVER, ADD_HDC_SERVER, DELETE_HDC_SERVER, LICENSE_UPDATE, LICENSE_DUMP, GRANT, REVOKE, SHOW_BACKUP, CREATE_BACKUP, SHOW_VECTOR_SERVER, ADD_VECTOR_SERVER, DELETE_VECTOR_SERVER

Policy

A Policy object includes the following attributes:

Attribute
Type
Default
Description
nameString/Policy name.
systemPrivilegesList<String>/System privileges included in the policy.
graphPrivilegesMap<String, List<String>>/Graph privileges included in the policy; in the map, the key is the name of the graph, and the value is the corresponding graph privileges.
propertyPrivilegesPropertyPrivilege/Property privileges included in the policy; the PropertyPrivilege has attributes node and edge, both are PropertyPrivilegeElement objects.
policiesList<String>/Policies included in the policy.

A PropertyPrivilegeElement object includes the following attributes:

Attribute
Type
Default
Description
readList<List<String>>/A list of lists; each inner list contains three strings representing the graph, schema, and property.
writeList<List<String>>/A list of lists; each inner list contains three strings representing the graph, schema, and property.
denyList<List<String>>/A list of lists; each inner list contains three strings representing the graph, schema, and property.
Java
Response response = driver.uql("show().policy('Tester')");
List<Policy> policy = response.alias("_policy").asPolicies();
System.out.println("Graph privileges: " + policy.get(0).getGraphPrivileges());
System.out.println("System privileges: " + policy.get(0).getSystemPrivileges());
System.out.println("Property privileges:");
System.out.println("- Node (Read): " + policy.get(0).getPropertyPrivileges().getNode().getRead());
System.out.println("- Node (Write): " + policy.get(0).getPropertyPrivileges().getNode().getWrite());
System.out.println("- Node (Deny): " + policy.get(0).getPropertyPrivileges().getNode().getDeny());
System.out.println("- Edge (Read): " + policy.get(0).getPropertyPrivileges().getEdge().getRead());
System.out.println("- Edge (Write): " + policy.get(0).getPropertyPrivileges().getEdge().getWrite());
System.out.println("- Edge (Deny): " + policy.get(0).getPropertyPrivileges().getEdge().getDeny());
System.out.println("Policies: " + policy.get(0).getPolicies());
Output
Graph privileges: {amz=[ALGO, DROP_FULLTEXT, INSERT, DELETE, UPSERT], StoryGraph=[UPDATE, READ]}
System privileges: [TRUNCATE, KILL, TOP]
Property privileges:
- Node (Read): [[*, *, *]]
- Node (Write): []
- Node (Deny): []
- Edge (Read): []
- Edge (Write): [[amz, *, *], [alimama, *, *]]
- Edge (Deny): [[miniCircle, review, value, timestamp]]
Policies: [manager, sales]

User

A User object includes the following attributes:

Attribute
Type
Default
Description
usernameString/Username.
passwordString/Password.
createdTimeDate/The time when the user was created.
systemPrivilegesList<String>/System privileges granted to the user.
graphPrivilegesMap<String, List<String>>/Graph privileges granted to the user; in the map, the key is the name of the graph, and the value is the corresponding graph privileges.
propertyPrivilegesPropertyPrivilege/Property privileges granted to the user; the PropertyPrivilege has attributes node and edge, both are PropertyPrivilegeElement objects.
policiesList<String>/Policies granted to the user.

A PropertyPrivilegeElement object includes the following attributes:

Attribute
Type
Default
Description
readList<List<String>>/A list of lists; each inner list contains three strings representing the graph, schema, and property.
writeList<List<String>>/A list of lists; each inner list contains three strings representing the graph, schema, and property.
denyList<List<String>>/A list of lists; each inner list contains three strings representing the graph, schema, and property.
Java
Response response = driver.uql("show().user('johndoe')");
List<User> user = response.alias("_user").asUsers();
System.out.println("Created Time: " + user.get(0).getCreatedTime());
System.out.println("Graph privileges: " + user.get(0).getGraphPrivileges());
System.out.println("System privileges: " + user.get(0).getSystemPrivileges());
System.out.println("Property privileges:");
System.out.println("- Node (Read): " + user.get(0).getPropertyPrivileges().getNode().getRead());
System.out.println("- Node (Write): " + user.get(0).getPropertyPrivileges().getNode().getWrite());
System.out.println("- Node (Deny): " + user.get(0).getPropertyPrivileges().getNode().getDeny());
System.out.println("- Edge (Read): " + user.get(0).getPropertyPrivileges().getEdge().getRead());
System.out.println("- Edge (Write): " + user.get(0).getPropertyPrivileges().getEdge().getWrite());
System.out.println("- Edge (Deny): " + user.get(0).getPropertyPrivileges().getEdge().getDeny());
System.out.println("Policies: " + user.get(0).getPolicies());
Output
Created Time: Wed Apr 02 11:08:38 CST 2025
Graph privileges: {amz=[ALGO, INSERT, DELETE, UPSERT], StoryGraph=[UPDATE, READ]}
System privileges: [TRUNCATE, KILL, TOP]
Property privileges:
- Node (Read): [[*, *, *]]
- Node (Write): []
- Node (Deny): []
- Edge (Read): []
- Edge (Write): [[amz, *, *], [alimama, *, *]]
- Edge (Deny): []
Policies: [sales, manager]

Process

A Process object includes the following attributes:

Attribute
Type
Default
Description
processIdString/Process ID.
processQueryString/The query that the process executes.
statusString/Process status.
durationString/The duration (in seconds) the process has run.
Java
Response response = driver.uql("top()");
List<Process> processes = response.alias("_top").asProcesses();

for (Process process : processes) {
    System.out.println(process.getProcessId());
}
Output
1049435

Job

A Job object includes the following attributes:

Attribute
Type
Default
Description
idString/Job ID.
graphNameString/Name of the graph where the job executes on.
queryString/The query that the job executes.
typeString/Job type.
errNsgString/Error message of the job.
resultMap/Result of the job.
startTimeString/The time when the job begins.
endTimeString/The times when the job ends.
statusString/Job status.
progressString/Progress updates for the job, such as indications that the write operation has been started.
Java
RequestConfig requestConfig = new RequestConfig();
requestConfig.setGraph("miniCircle");
Response response = driver.gql("SHOW JOB", requestConfig);
List<Job> jobs = response.alias("_job").asJobs();

for (Job job : jobs) {
    if ("FAILED".equals(job.getStatus())) {
        System.out.println(job.getId() + " - " + job.getErrMsg() + " - " + job.getType());
    }
}
Output
51 - Fulltext name already exists. - CREATE_FULLTEXT
42 - Fulltext name already exists. - CREATE_FULLTEXT
26 - [engine] uuids should be unsigned integer - HDC_ALGO
26_1 -  - HDC_ALGO
17 - [engine] all failed, because some nodes do not exist in db - HDC_ALGO
17_1 -  - HDC_ALGO