use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class EdgeAPI method create.
public List<String> create(List<Edge> edges, boolean checkVertex) {
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
headers.putSingle("Content-Encoding", BATCH_ENCODING);
Map<String, Object> params = ImmutableMap.of("check_vertex", checkVertex);
RestResult result = this.client.post(this.batchPath(), edges, headers, params);
List<String> ids = result.readList(String.class);
if (edges.size() != ids.size()) {
throw new NotAllCreatedException("Not all edges are successfully created, " + "expect '%s', the actual is '%s'", ids, edges.size(), ids.size());
}
return ids;
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class VertexAPI method get.
public Vertex get(Object id) {
String vertexId = GraphAPI.formatVertexId(id);
RestResult result = this.client.get(this.path(), vertexId);
return result.readObject(Vertex.class);
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelAPI method append.
public EdgeLabel append(EdgeLabel edgeLabel) {
String id = edgeLabel.name();
Map<String, Object> params = ImmutableMap.of("action", "append");
Object el = this.checkCreateOrUpdate(edgeLabel);
RestResult result = this.client.put(this.path(), id, el, params);
return result.readObject(EdgeLabel.class);
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelAPI method delete.
public long delete(String name) {
RestResult result = this.client.delete(this.path(), name);
@SuppressWarnings("unchecked") Map<String, Object> task = result.readObject(Map.class);
return TaskAPI.parseTaskId(task);
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelAPI method list.
public List<EdgeLabel> list(List<String> names) {
this.client.checkApiVersion("0.48", "getting schema by names");
E.checkArgument(names != null && !names.isEmpty(), "The edge label names can't be null or empty");
Map<String, Object> params = ImmutableMap.of("names", names);
RestResult result = this.client.get(this.path(), params);
return result.readList(this.type(), EdgeLabel.class);
}
Aggregations