Interfaces are provided to increase the proficiency of bulking inserting nodes/edges.
Data Types
Mapping table for Java and Ultipa data types:
Java | Ultipa |
---|---|
int | int32 |
String | string |
float | float |
double | double |
long | uint32 |
long | int64 |
String | uint64 |
java.util.Date | datetime |
java.util.Date | timestamp |
insertBulkNodes
Interface | Type | Description |
---|---|---|
schema | String | insertBulkNodes accepts only one node schema |
properties | List<Property> | A list of node propertie names to insert |
nodes | List<Node> | A list of nodes to insert |
insertType | Ultipa.InsertType | NORMAL , OVERWRITE , UPSERT |
silent | boolean | To omit to return the UUIDs of the inserted nodes by setting true |
Example:
List<Property> propertyList = new ArrayList<>();
Property name = new Property();
name.setName("name");
name.setType(Ultipa.PropertyType.STRING);
propertyList.add(name);
Property age = new Property();
age.setName("age");
age.setType(Ultipa.PropertyType.INT32);
propertyList.add(age);
List<Node> nodeList = new ArrayList<>();
Node person1 = new Node();
person1.setSchema("person");
person1.setID("1");
Value value1 = new Value();
value1.put("name","person1");
value1.put("age",10);
person1.setValues(value1);
nodeList.add(person1);
Node person2 = new Node();
person2.setSchema("person");
person2.setID("2");
Value value2 = new Value();
value2.put("name","person2");
value2.put("age",20);
person2.setValues(value2);
nodeList.add(person2);
Response response = client.insertBulkNodes("person",propertyList,nodeList,Ultipa.InsertType.NORMAL,false);
insertBulkEdges
Interface | Type | Description |
---|---|---|
schema | String | insertBulkEdges accepts only one node schema |
properties | List<Property> | A list of edge propertie names to insert |
edges | List<Edge> | A list of edges to insert |
insertType | Ultipa.InsertType | NORMAL , OVERWRITE , UPSERT |
silent | boolean | To omit to return the UUIDs of the inserted edges by setting true |
Example:
List<Property> propertyList = new ArrayList<>();
Property typeProp = new Property();
typeProp.setName("type");
typeProp.setType(Ultipa.PropertyType.STRING);
propertyList.add(typeProp);
Property amountProp = new Property();
amountProp.setName("amount");
amountProp.setType(Ultipa.PropertyType.DOUBLE);
propertyList.add(amountProp);
List<Edge> edgeList = new ArrayList<>();
Edge edge1 = new Edge();
edge1.setSchema("transfer");
edge1.setFrom("1001");
edge1.setTo("1002");
Value value1 = new Value();
value1.put("type", "1");
value1.put("amount",100.0);
edge1.setValues(value1);
edgeList.add(edge1);
Edge edge2 = new Edge();
edge2.setSchema("transfer");
edge2.setFrom("1002");
edge2.setTo("1003");
Value value2 = new Value();
value2.put("type", "2");
value2.put("amount",200.0);
edge2.setValues(value2);
edgeList.add(edge2);
Response response = client.insertBulkEdges("transfer",propertyList,edgeList,Ultipa.InsertType.NORMAL,false);