use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class WeightedShortestPathAPI method get.
public WeightedPath get(Object sourceId, Object targetId, Direction direction, String label, String weight, long degree, long skipDegree, long capacity, boolean withVertex) {
this.client.checkApiVersion("0.51", "weighted shortest path");
String source = GraphAPI.formatVertexId(sourceId, false);
String target = GraphAPI.formatVertexId(targetId, false);
E.checkNotNull(weight, "weight");
checkDegree(degree);
checkCapacity(capacity);
checkSkipDegree(skipDegree, degree, capacity);
Map<String, Object> params = new LinkedHashMap<>();
params.put("source", source);
params.put("target", target);
params.put("direction", direction);
params.put("label", label);
params.put("weight", weight);
params.put("max_degree", degree);
params.put("skip_degree", skipDegree);
params.put("capacity", capacity);
params.put("with_vertex", withVertex);
RestResult result = this.client.get(this.path(), params);
return result.readObject(WeightedPath.class);
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class GraphsAPI method create.
@SuppressWarnings("unchecked")
public Map<String, String> create(String name, String cloneGraphName, String configText) {
this.client.checkApiVersion("0.67", "dynamic graph add");
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
Map<String, Object> params = null;
if (StringUtils.isNotEmpty(cloneGraphName)) {
params = ImmutableMap.of("clone_graph_name", cloneGraphName);
}
RestResult result = this.client.post(joinPath(this.path(), name), configText, headers, params);
return result.readObject(Map.class);
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class EdgeAPI method eliminate.
public Edge eliminate(Edge edge) {
String id = edge.id();
Map<String, Object> params = ImmutableMap.of("action", "eliminate");
RestResult result = this.client.put(this.path(), id, edge, params);
return result.readObject(Edge.class);
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class EdgeAPI method update.
public List<Edge> update(BatchEdgeRequest request) {
this.client.checkApiVersion("0.45", "batch property update");
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
headers.putSingle("Content-Encoding", BATCH_ENCODING);
RestResult result = this.client.put(this.batchPath(), null, request, headers);
return result.readList(this.type(), Edge.class);
}
use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.
the class EdgeAPI method list.
public Edges list(Object vertexId, Direction direction, String label, Map<String, Object> properties, boolean keepP, int offset, String page, int limit) {
checkOffset(offset);
checkLimit(limit, "Limit");
String vid = GraphAPI.formatVertexId(vertexId, true);
String props = GraphAPI.formatProperties(properties);
Map<String, Object> params = new LinkedHashMap<>();
params.put("vertex_id", vid);
params.put("direction", direction);
params.put("label", label);
params.put("properties", props);
params.put("keep_start_p", keepP);
params.put("offset", offset);
params.put("limit", limit);
params.put("page", page);
RestResult result = this.client.get(this.path(), params);
return result.readObject(Edges.class);
}
Aggregations