You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2022/11/10 08:32:36 UTC
[incubator-hugegraph-toolchain] branch client-rename updated: adapt to org.apache package (#364)
This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch client-rename
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-toolchain.git
The following commit(s) were added to refs/heads/client-rename by this push:
new 964ac5b1 adapt to org.apache package (#364)
964ac5b1 is described below
commit 964ac5b17f4336cad6de6e30bdd5aac45bcbf57f
Author: 青年 <10...@qq.com>
AuthorDate: Thu Nov 10 16:32:29 2022 +0800
adapt to org.apache package (#364)
* adapt to org.apache package
* use latest server commitid
---
.github/workflows/client-ci.yml | 2 +-
.github/workflows/loader-ci.yml | 2 +-
.github/workflows/tools-ci.yml | 2 +-
assembly/static/conf/log4j2.xml | 2 +-
.../hugegraph/annotation/UnimplementedFeature.java | 36 -
.../src/main/java/com/baidu/hugegraph/api/API.java | 66 -
.../com/baidu/hugegraph/api/auth/AccessAPI.java | 71 -
.../java/com/baidu/hugegraph/api/auth/AuthAPI.java | 52 -
.../com/baidu/hugegraph/api/auth/BelongAPI.java | 71 -
.../com/baidu/hugegraph/api/auth/GroupAPI.java | 68 -
.../com/baidu/hugegraph/api/auth/LoginAPI.java | 43 -
.../com/baidu/hugegraph/api/auth/LogoutAPI.java | 40 -
.../com/baidu/hugegraph/api/auth/ProjectAPI.java | 94 -
.../com/baidu/hugegraph/api/auth/TargetAPI.java | 68 -
.../com/baidu/hugegraph/api/auth/TokenAPI.java | 42 -
.../java/com/baidu/hugegraph/api/auth/UserAPI.java | 76 -
.../com/baidu/hugegraph/api/graph/EdgeAPI.java | 132 -
.../com/baidu/hugegraph/api/graph/GraphAPI.java | 87 -
.../com/baidu/hugegraph/api/graph/VertexAPI.java | 142 -
.../com/baidu/hugegraph/api/graphs/GraphsAPI.java | 153 -
.../com/baidu/hugegraph/api/gremlin/CypherAPI.java | 46 -
.../baidu/hugegraph/api/gremlin/GremlinAPI.java | 44 -
.../hugegraph/api/gremlin/GremlinRequest.java | 77 -
.../com/baidu/hugegraph/api/job/GremlinJobAPI.java | 48 -
.../java/com/baidu/hugegraph/api/job/JobAPI.java | 42 -
.../com/baidu/hugegraph/api/job/RebuildAPI.java | 70 -
.../baidu/hugegraph/api/metrics/MetricsAPI.java | 78 -
.../baidu/hugegraph/api/schema/EdgeLabelAPI.java | 105 -
.../baidu/hugegraph/api/schema/IndexLabelAPI.java | 130 -
.../baidu/hugegraph/api/schema/PropertyKeyAPI.java | 131 -
.../com/baidu/hugegraph/api/schema/SchemaAPI.java | 53 -
.../hugegraph/api/schema/SchemaElementAPI.java | 36 -
.../baidu/hugegraph/api/schema/VertexLabelAPI.java | 108 -
.../java/com/baidu/hugegraph/api/task/TaskAPI.java | 159 -
.../baidu/hugegraph/api/task/TasksWithPage.java | 41 -
.../api/traverser/AllShortestPathsAPI.java | 67 -
.../baidu/hugegraph/api/traverser/CountAPI.java | 51 -
.../hugegraph/api/traverser/CrosspointsAPI.java | 67 -
.../api/traverser/CustomizedCrosspointsAPI.java | 42 -
.../api/traverser/CustomizedPathsAPI.java | 42 -
.../baidu/hugegraph/api/traverser/EdgesAPI.java | 74 -
.../api/traverser/FusiformSimilarityAPI.java | 43 -
.../api/traverser/JaccardSimilarityAPI.java | 75 -
.../hugegraph/api/traverser/KneighborAPI.java | 69 -
.../com/baidu/hugegraph/api/traverser/KoutAPI.java | 73 -
.../api/traverser/MultiNodeShortestPathAPI.java | 43 -
.../hugegraph/api/traverser/NeighborRankAPI.java | 202 --
.../baidu/hugegraph/api/traverser/PathsAPI.java | 75 -
.../hugegraph/api/traverser/PersonalRankAPI.java | 164 --
.../com/baidu/hugegraph/api/traverser/RaysAPI.java | 63 -
.../baidu/hugegraph/api/traverser/RingsAPI.java | 70 -
.../hugegraph/api/traverser/SameNeighborsAPI.java | 61 -
.../hugegraph/api/traverser/ShortestPathAPI.java | 67 -
.../api/traverser/SingleSourceShortestPathAPI.java | 68 -
.../hugegraph/api/traverser/TemplatePathsAPI.java | 43 -
.../hugegraph/api/traverser/TraversersAPI.java | 81 -
.../baidu/hugegraph/api/traverser/VerticesAPI.java | 81 -
.../api/traverser/WeightedShortestPathAPI.java | 69 -
.../hugegraph/api/variables/VariablesAPI.java | 66 -
.../baidu/hugegraph/api/version/VersionAPI.java | 44 -
.../com/baidu/hugegraph/client/RestClient.java | 95 -
.../com/baidu/hugegraph/driver/AuthManager.java | 284 --
.../com/baidu/hugegraph/driver/CypherManager.java | 44 -
.../com/baidu/hugegraph/driver/GraphManager.java | 489 ----
.../com/baidu/hugegraph/driver/GraphsManager.java | 82 -
.../com/baidu/hugegraph/driver/GremlinManager.java | 64 -
.../com/baidu/hugegraph/driver/HugeClient.java | 174 --
.../baidu/hugegraph/driver/HugeClientBuilder.java | 167 --
.../com/baidu/hugegraph/driver/JobManager.java | 79 -
.../com/baidu/hugegraph/driver/MetricsManager.java | 53 -
.../com/baidu/hugegraph/driver/SchemaManager.java | 284 --
.../com/baidu/hugegraph/driver/TaskManager.java | 76 -
.../baidu/hugegraph/driver/TraverserManager.java | 558 ----
.../baidu/hugegraph/driver/VariablesManager.java | 50 -
.../com/baidu/hugegraph/driver/VersionManager.java | 48 -
.../com/baidu/hugegraph/example/BatchExample.java | 156 -
.../com/baidu/hugegraph/example/MovieExample.java | 777 -----
.../com/baidu/hugegraph/example/SingleExample.java | 166 --
.../exception/InvalidOperationException.java | 36 -
.../exception/InvalidResponseException.java | 42 -
.../exception/NotAllCreatedException.java | 39 -
.../hugegraph/exception/NotSupportException.java | 37 -
.../baidu/hugegraph/exception/ServerException.java | 138 -
.../hugegraph/serializer/PathDeserializer.java | 95 -
.../serializer/direct/HBaseSerializer.java | 124 -
.../serializer/direct/RocksDBSerializer.java | 32 -
.../serializer/direct/reuse/BytesDemo.java | 194 --
.../serializer/direct/struct/DataType.java | 206 --
.../serializer/direct/struct/HugeType.java | 190 --
.../serializer/direct/util/BytesBuffer.java | 762 -----
.../serializer/direct/util/GraphSchema.java | 105 -
.../serializer/direct/util/HugeException.java | 56 -
.../baidu/hugegraph/serializer/direct/util/Id.java | 88 -
.../serializer/direct/util/IdGenerator.java | 440 ---
.../hugegraph/serializer/direct/util/LZ4Util.java | 92 -
.../direct/util/SplicingIdGenerator.java | 132 -
.../serializer/direct/util/StringEncoding.java | 154 -
.../com/baidu/hugegraph/structure/Element.java | 50 -
.../baidu/hugegraph/structure/GraphElement.java | 100 -
.../baidu/hugegraph/structure/SchemaElement.java | 86 -
.../java/com/baidu/hugegraph/structure/Task.java | 206 --
.../com/baidu/hugegraph/structure/auth/Access.java | 105 -
.../hugegraph/structure/auth/AuthElement.java | 46 -
.../com/baidu/hugegraph/structure/auth/Belong.java | 95 -
.../com/baidu/hugegraph/structure/auth/Group.java | 79 -
.../hugegraph/structure/auth/HugePermission.java | 54 -
.../hugegraph/structure/auth/HugeResource.java | 92 -
.../hugegraph/structure/auth/HugeResourceType.java | 90 -
.../com/baidu/hugegraph/structure/auth/Login.java | 47 -
.../hugegraph/structure/auth/LoginResult.java | 36 -
.../baidu/hugegraph/structure/auth/Project.java | 134 -
.../com/baidu/hugegraph/structure/auth/Target.java | 116 -
.../hugegraph/structure/auth/TokenPayload.java | 50 -
.../com/baidu/hugegraph/structure/auth/User.java | 138 -
.../structure/constant/AggregateType.java | 74 -
.../hugegraph/structure/constant/Cardinality.java | 47 -
.../hugegraph/structure/constant/DataType.java | 79 -
.../hugegraph/structure/constant/Direction.java | 46 -
.../hugegraph/structure/constant/Frequency.java | 46 -
.../structure/constant/GraphAttachable.java | 27 -
.../hugegraph/structure/constant/GraphMode.java | 74 -
.../structure/constant/GraphReadMode.java | 50 -
.../hugegraph/structure/constant/HugeType.java | 84 -
.../hugegraph/structure/constant/IdStrategy.java | 78 -
.../hugegraph/structure/constant/IndexType.java | 55 -
.../com/baidu/hugegraph/structure/constant/T.java | 26 -
.../hugegraph/structure/constant/Traverser.java | 38 -
.../hugegraph/structure/constant/WriteType.java | 62 -
.../structure/graph/BatchEdgeRequest.java | 107 -
.../structure/graph/BatchOlapPropertyRequest.java | 137 -
.../structure/graph/BatchVertexRequest.java | 98 -
.../com/baidu/hugegraph/structure/graph/Edge.java | 211 --
.../com/baidu/hugegraph/structure/graph/Edges.java | 43 -
.../com/baidu/hugegraph/structure/graph/Graph.java | 171 --
.../hugegraph/structure/graph/GraphIterator.java | 91 -
.../baidu/hugegraph/structure/graph/Pageable.java | 43 -
.../com/baidu/hugegraph/structure/graph/Path.java | 117 -
.../com/baidu/hugegraph/structure/graph/Shard.java | 76 -
.../hugegraph/structure/graph/UpdateStrategy.java | 39 -
.../baidu/hugegraph/structure/graph/Vertex.java | 109 -
.../baidu/hugegraph/structure/graph/Vertices.java | 43 -
.../hugegraph/structure/gremlin/Response.java | 72 -
.../baidu/hugegraph/structure/gremlin/Result.java | 85 -
.../hugegraph/structure/gremlin/ResultSet.java | 149 -
.../hugegraph/structure/schema/BuilderProxy.java | 64 -
.../hugegraph/structure/schema/EdgeLabel.java | 342 ---
.../hugegraph/structure/schema/IndexLabel.java | 310 --
.../hugegraph/structure/schema/PropertyKey.java | 416 ---
.../hugegraph/structure/schema/SchemaBuilder.java | 35 -
.../hugegraph/structure/schema/SchemaLabel.java | 61 -
.../hugegraph/structure/schema/VertexLabel.java | 309 --
.../structure/traverser/CountRequest.java | 112 -
.../structure/traverser/CrosspointsRequest.java | 237 --
.../structure/traverser/CustomizedCrosspoints.java | 49 -
.../traverser/CustomizedPathsRequest.java | 247 --
.../hugegraph/structure/traverser/EdgeStep.java | 119 -
.../structure/traverser/FusiformSimilarity.java | 72 -
.../traverser/FusiformSimilarityRequest.java | 203 --
.../hugegraph/structure/traverser/Kneighbor.java | 55 -
.../structure/traverser/KneighborRequest.java | 131 -
.../baidu/hugegraph/structure/traverser/Kout.java | 55 -
.../hugegraph/structure/traverser/KoutRequest.java | 150 -
.../traverser/MultiNodeShortestPathRequest.java | 111 -
.../structure/traverser/PathsRequest.java | 131 -
.../structure/traverser/PathsWithVertices.java | 58 -
.../baidu/hugegraph/structure/traverser/Ranks.java | 27 -
.../structure/traverser/RepeatEdgeStep.java | 112 -
.../SingleSourceJaccardSimilarityRequest.java | 102 -
.../structure/traverser/TemplatePathsRequest.java | 138 -
.../structure/traverser/VerticesArgs.java | 96 -
.../structure/traverser/WeightedPath.java | 58 -
.../structure/traverser/WeightedPaths.java | 42 -
.../hugegraph/structure/version/Versions.java | 34 -
.../java/com/baidu/hugegraph/util/CommonUtil.java | 48 -
.../main/java/com/baidu/hugegraph/util/IdUtil.java | 74 -
.../java/com/baidu/hugegraph/util/JsonUtil.java | 64 -
.../baidu/hugegraph/util/SplicingIdGenerator.java | 101 -
.../java/com/baidu/hugegraph/util/TaskCache.java | 115 -
.../com/baidu/hugegraph/version/ClientVersion.java | 42 -
.../hugegraph/annotation/UnimplementedFeature.java | 36 +
.../main/java/org/apache/hugegraph/api/API.java | 66 +
.../org/apache/hugegraph/api/auth/AccessAPI.java | 71 +
.../org/apache/hugegraph/api/auth/AuthAPI.java | 52 +
.../org/apache/hugegraph/api/auth/BelongAPI.java | 71 +
.../org/apache/hugegraph/api/auth/GroupAPI.java | 68 +
.../org/apache/hugegraph/api/auth/LoginAPI.java | 43 +
.../org/apache/hugegraph/api/auth/LogoutAPI.java | 40 +
.../org/apache/hugegraph/api/auth/ProjectAPI.java | 94 +
.../org/apache/hugegraph/api/auth/TargetAPI.java | 68 +
.../org/apache/hugegraph/api/auth/TokenAPI.java | 42 +
.../org/apache/hugegraph/api/auth/UserAPI.java | 76 +
.../org/apache/hugegraph/api/graph/EdgeAPI.java | 132 +
.../org/apache/hugegraph/api/graph/GraphAPI.java | 87 +
.../org/apache/hugegraph/api/graph/VertexAPI.java | 142 +
.../org/apache/hugegraph/api/graphs/GraphsAPI.java | 153 +
.../apache/hugegraph/api/gremlin/CypherAPI.java | 46 +
.../apache/hugegraph/api/gremlin/GremlinAPI.java | 44 +
.../hugegraph/api/gremlin/GremlinRequest.java | 77 +
.../apache/hugegraph/api/job/GremlinJobAPI.java | 48 +
.../java/org/apache/hugegraph/api/job/JobAPI.java | 42 +
.../org/apache/hugegraph/api/job/RebuildAPI.java | 70 +
.../apache/hugegraph/api/metrics/MetricsAPI.java | 78 +
.../apache/hugegraph/api/schema/EdgeLabelAPI.java | 105 +
.../apache/hugegraph/api/schema/IndexLabelAPI.java | 130 +
.../hugegraph/api/schema/PropertyKeyAPI.java | 131 +
.../org/apache/hugegraph/api/schema/SchemaAPI.java | 53 +
.../hugegraph/api/schema/SchemaElementAPI.java | 36 +
.../hugegraph/api/schema/VertexLabelAPI.java | 108 +
.../org/apache/hugegraph/api/task/TaskAPI.java | 159 +
.../apache/hugegraph/api/task/TasksWithPage.java | 41 +
.../api/traverser/AllShortestPathsAPI.java | 67 +
.../apache/hugegraph/api/traverser/CountAPI.java | 51 +
.../hugegraph/api/traverser/CrosspointsAPI.java | 67 +
.../api/traverser/CustomizedCrosspointsAPI.java | 42 +
.../api/traverser/CustomizedPathsAPI.java | 42 +
.../apache/hugegraph/api/traverser/EdgesAPI.java | 74 +
.../api/traverser/FusiformSimilarityAPI.java | 43 +
.../api/traverser/JaccardSimilarityAPI.java | 75 +
.../hugegraph/api/traverser/KneighborAPI.java | 69 +
.../apache/hugegraph/api/traverser/KoutAPI.java | 73 +
.../api/traverser/MultiNodeShortestPathAPI.java | 43 +
.../hugegraph/api/traverser/NeighborRankAPI.java | 202 ++
.../apache/hugegraph/api/traverser/PathsAPI.java | 75 +
.../hugegraph/api/traverser/PersonalRankAPI.java | 164 ++
.../apache/hugegraph/api/traverser/RaysAPI.java | 63 +
.../apache/hugegraph/api/traverser/RingsAPI.java | 70 +
.../hugegraph/api/traverser/SameNeighborsAPI.java | 61 +
.../hugegraph/api/traverser/ShortestPathAPI.java | 67 +
.../api/traverser/SingleSourceShortestPathAPI.java | 68 +
.../hugegraph/api/traverser/TemplatePathsAPI.java | 43 +
.../hugegraph/api/traverser/TraversersAPI.java | 81 +
.../hugegraph/api/traverser/VerticesAPI.java | 81 +
.../api/traverser/WeightedShortestPathAPI.java | 69 +
.../hugegraph/api/variables/VariablesAPI.java | 66 +
.../apache/hugegraph/api/version/VersionAPI.java | 44 +
.../org/apache/hugegraph/client/RestClient.java | 95 +
.../org/apache/hugegraph/driver/AuthManager.java | 283 ++
.../org/apache/hugegraph/driver/CypherManager.java | 44 +
.../org/apache/hugegraph/driver/GraphManager.java | 489 ++++
.../org/apache/hugegraph/driver/GraphsManager.java | 82 +
.../apache/hugegraph/driver/GremlinManager.java | 64 +
.../org/apache/hugegraph/driver/HugeClient.java | 173 ++
.../apache/hugegraph/driver/HugeClientBuilder.java | 167 ++
.../org/apache/hugegraph/driver/JobManager.java | 77 +
.../apache/hugegraph/driver/MetricsManager.java | 53 +
.../org/apache/hugegraph/driver/SchemaManager.java | 282 ++
.../org/apache/hugegraph/driver/TaskManager.java | 76 +
.../apache/hugegraph/driver/TraverserManager.java | 553 ++++
.../apache/hugegraph/driver/VariablesManager.java | 50 +
.../apache/hugegraph/driver/VersionManager.java | 48 +
.../org/apache/hugegraph/example/BatchExample.java | 156 +
.../org/apache/hugegraph/example/MovieExample.java | 777 +++++
.../apache/hugegraph/example/SingleExample.java | 166 ++
.../exception/InvalidOperationException.java | 36 +
.../exception/InvalidResponseException.java | 42 +
.../exception/NotAllCreatedException.java | 39 +
.../hugegraph/exception/NotSupportException.java | 37 +
.../hugegraph/exception/ServerException.java | 138 +
.../hugegraph/serializer/PathDeserializer.java | 95 +
.../serializer/direct/HBaseSerializer.java | 124 +
.../serializer/direct/RocksDBSerializer.java | 32 +
.../serializer/direct/reuse/BytesDemo.java | 194 ++
.../serializer/direct/struct/DataType.java | 206 ++
.../serializer/direct/struct/HugeType.java | 190 ++
.../serializer/direct/util/BytesBuffer.java | 763 +++++
.../serializer/direct/util/GraphSchema.java | 105 +
.../serializer/direct/util/HugeException.java | 56 +
.../hugegraph/serializer/direct/util/Id.java | 88 +
.../serializer/direct/util/IdGenerator.java | 438 +++
.../hugegraph/serializer/direct/util/LZ4Util.java | 92 +
.../direct/util/SplicingIdGenerator.java | 132 +
.../serializer/direct/util/StringEncoding.java | 154 +
.../org/apache/hugegraph/structure/Element.java | 50 +
.../apache/hugegraph/structure/GraphElement.java | 100 +
.../apache/hugegraph/structure/SchemaElement.java | 86 +
.../java/org/apache/hugegraph/structure/Task.java | 206 ++
.../apache/hugegraph/structure/auth/Access.java | 105 +
.../hugegraph/structure/auth/AuthElement.java | 46 +
.../apache/hugegraph/structure/auth/Belong.java | 95 +
.../org/apache/hugegraph/structure/auth/Group.java | 79 +
.../hugegraph/structure/auth/HugePermission.java | 54 +
.../hugegraph/structure/auth/HugeResource.java | 92 +
.../hugegraph/structure/auth/HugeResourceType.java | 90 +
.../org/apache/hugegraph/structure/auth/Login.java | 47 +
.../hugegraph/structure/auth/LoginResult.java | 36 +
.../apache/hugegraph/structure/auth/Project.java | 134 +
.../apache/hugegraph/structure/auth/Target.java | 116 +
.../hugegraph/structure/auth/TokenPayload.java | 50 +
.../org/apache/hugegraph/structure/auth/User.java | 138 +
.../structure/constant/AggregateType.java | 74 +
.../hugegraph/structure/constant/Cardinality.java | 47 +
.../hugegraph/structure/constant/DataType.java | 79 +
.../hugegraph/structure/constant/Direction.java | 46 +
.../hugegraph/structure/constant/Frequency.java | 46 +
.../structure/constant/GraphAttachable.java | 27 +
.../hugegraph/structure/constant/GraphMode.java | 74 +
.../structure/constant/GraphReadMode.java | 50 +
.../hugegraph/structure/constant/HugeType.java | 84 +
.../hugegraph/structure/constant/IdStrategy.java | 78 +
.../hugegraph/structure/constant/IndexType.java | 55 +
.../org/apache/hugegraph/structure/constant/T.java | 26 +
.../hugegraph/structure/constant/Traverser.java | 38 +
.../hugegraph/structure/constant/WriteType.java | 62 +
.../structure/graph/BatchEdgeRequest.java | 107 +
.../structure/graph/BatchOlapPropertyRequest.java | 137 +
.../structure/graph/BatchVertexRequest.java | 98 +
.../org/apache/hugegraph/structure/graph/Edge.java | 211 ++
.../apache/hugegraph/structure/graph/Edges.java | 43 +
.../apache/hugegraph/structure/graph/Graph.java | 171 ++
.../hugegraph/structure/graph/GraphIterator.java | 91 +
.../apache/hugegraph/structure/graph/Pageable.java | 43 +
.../org/apache/hugegraph/structure/graph/Path.java | 117 +
.../apache/hugegraph/structure/graph/Shard.java | 76 +
.../hugegraph/structure/graph/UpdateStrategy.java | 39 +
.../apache/hugegraph/structure/graph/Vertex.java | 109 +
.../apache/hugegraph/structure/graph/Vertices.java | 43 +
.../hugegraph/structure/gremlin/Response.java | 72 +
.../apache/hugegraph/structure/gremlin/Result.java | 85 +
.../hugegraph/structure/gremlin/ResultSet.java | 149 +
.../hugegraph/structure/schema/BuilderProxy.java | 64 +
.../hugegraph/structure/schema/EdgeLabel.java | 342 +++
.../hugegraph/structure/schema/IndexLabel.java | 310 ++
.../hugegraph/structure/schema/PropertyKey.java | 416 +++
.../hugegraph/structure/schema/SchemaBuilder.java | 35 +
.../hugegraph/structure/schema/SchemaLabel.java | 61 +
.../hugegraph/structure/schema/VertexLabel.java | 309 ++
.../structure/traverser/CountRequest.java | 112 +
.../structure/traverser/CrosspointsRequest.java | 237 ++
.../structure/traverser/CustomizedCrosspoints.java | 49 +
.../traverser/CustomizedPathsRequest.java | 246 ++
.../hugegraph/structure/traverser/EdgeStep.java | 119 +
.../structure/traverser/FusiformSimilarity.java | 72 +
.../traverser/FusiformSimilarityRequest.java | 203 ++
.../hugegraph/structure/traverser/Kneighbor.java | 55 +
.../structure/traverser/KneighborRequest.java | 131 +
.../apache/hugegraph/structure/traverser/Kout.java | 55 +
.../hugegraph/structure/traverser/KoutRequest.java | 150 +
.../traverser/MultiNodeShortestPathRequest.java | 111 +
.../structure/traverser/PathsRequest.java | 131 +
.../structure/traverser/PathsWithVertices.java | 58 +
.../hugegraph/structure/traverser/Ranks.java | 27 +
.../structure/traverser/RepeatEdgeStep.java | 112 +
.../SingleSourceJaccardSimilarityRequest.java | 102 +
.../structure/traverser/TemplatePathsRequest.java | 138 +
.../structure/traverser/VerticesArgs.java | 96 +
.../structure/traverser/WeightedPath.java | 58 +
.../structure/traverser/WeightedPaths.java | 42 +
.../hugegraph/structure/version/Versions.java | 34 +
.../java/org/apache/hugegraph/util/CommonUtil.java | 48 +
.../java/org/apache/hugegraph/util/IdUtil.java | 74 +
.../java/org/apache/hugegraph/util/JsonUtil.java | 64 +
.../apache/hugegraph/util/SplicingIdGenerator.java | 101 +
.../java/org/apache/hugegraph/util/TaskCache.java | 114 +
.../apache/hugegraph/version/ClientVersion.java | 41 +
.../java/com/baidu/hugegraph/BaseClientTest.java | 365 ---
.../java/com/baidu/hugegraph/api/ApiTestSuite.java | 102 -
.../java/com/baidu/hugegraph/api/BaseApiTest.java | 165 --
.../hugegraph/api/BatchUpdateElementApiTest.java | 760 -----
.../com/baidu/hugegraph/api/CypherApiTest.java | 60 -
.../java/com/baidu/hugegraph/api/EdgeApiTest.java | 761 -----
.../com/baidu/hugegraph/api/EdgeLabelApiTest.java | 550 ----
.../com/baidu/hugegraph/api/GraphsApiTest.java | 332 ---
.../com/baidu/hugegraph/api/GremlinApiTest.java | 220 --
.../com/baidu/hugegraph/api/IndexLabelApiTest.java | 490 ----
.../java/com/baidu/hugegraph/api/JobApiTest.java | 76 -
.../baidu/hugegraph/api/PropertyKeyApiTest.java | 510 ----
.../com/baidu/hugegraph/api/RestoreApiTest.java | 60 -
.../com/baidu/hugegraph/api/SchemaApiTest.java | 50 -
.../java/com/baidu/hugegraph/api/TaskApiTest.java | 293 --
.../com/baidu/hugegraph/api/VariablesApiTest.java | 149 -
.../com/baidu/hugegraph/api/VertexApiTest.java | 679 -----
.../baidu/hugegraph/api/VertexLabelApiTest.java | 499 ----
.../baidu/hugegraph/api/auth/AccessApiTest.java | 361 ---
.../com/baidu/hugegraph/api/auth/AuthApiTest.java | 25 -
.../baidu/hugegraph/api/auth/BelongApiTest.java | 326 ---
.../com/baidu/hugegraph/api/auth/GroupApiTest.java | 204 --
.../com/baidu/hugegraph/api/auth/LoginApiTest.java | 77 -
.../baidu/hugegraph/api/auth/LogoutApiTest.java | 87 -
.../baidu/hugegraph/api/auth/ProjectApiTest.java | 165 --
.../baidu/hugegraph/api/auth/TargetApiTest.java | 248 --
.../com/baidu/hugegraph/api/auth/TokenApiTest.java | 111 -
.../com/baidu/hugegraph/api/auth/UserApiTest.java | 272 --
.../api/traverser/AllShortestPathsApiTest.java | 255 --
.../api/traverser/CommonTraverserApiTest.java | 284 --
.../hugegraph/api/traverser/CountApiTest.java | 497 ----
.../api/traverser/CustomizedPathsApiTest.java | 374 ---
.../api/traverser/FusiformSimilarityApiTest.java | 665 -----
.../api/traverser/JaccardSimilarityApiTest.java | 228 --
.../hugegraph/api/traverser/KneighborApiTest.java | 510 ----
.../baidu/hugegraph/api/traverser/KoutApiTest.java | 625 ----
.../traverser/MultiNodeShortestPathApiTest.java | 218 --
.../api/traverser/NeighborRankApiTest.java | 414 ---
.../hugegraph/api/traverser/PathsApiTest.java | 352 ---
.../api/traverser/PersonalRankApiTest.java | 324 --
.../hugegraph/api/traverser/RingsRaysApiTest.java | 327 ---
.../api/traverser/SameNeighborsApiTest.java | 175 --
.../api/traverser/ShortestPathApiTest.java | 255 --
.../traverser/SingleSourceShortestPathApiTest.java | 507 ----
.../api/traverser/TemplatePathsApiTest.java | 317 --
.../hugegraph/api/traverser/TraverserApiTest.java | 89 -
.../api/traverser/WeightedShortestPathApiTest.java | 197 --
.../hugegraph/functional/AuthManagerTest.java | 163 --
.../baidu/hugegraph/functional/BaseFuncTest.java | 96 -
.../hugegraph/functional/BatchInsertTest.java | 145 -
.../baidu/hugegraph/functional/EdgeLabelTest.java | 255 --
.../com/baidu/hugegraph/functional/EdgeTest.java | 799 -----
.../baidu/hugegraph/functional/FuncTestSuite.java | 43 -
.../hugegraph/functional/GraphManagerTest.java | 82 -
.../baidu/hugegraph/functional/GraphModeTest.java | 58 -
.../hugegraph/functional/HugeClientHttpsTest.java | 182 --
.../baidu/hugegraph/functional/HugeClientTest.java | 47 -
.../baidu/hugegraph/functional/IndexLabelTest.java | 265 --
.../hugegraph/functional/MetricsManagerTest.java | 56 -
.../hugegraph/functional/PropertyKeyTest.java | 210 --
.../com/baidu/hugegraph/functional/SchemaTest.java | 51 -
.../hugegraph/functional/TraverserManagerTest.java | 77 -
.../hugegraph/functional/VertexLabelTest.java | 196 --
.../com/baidu/hugegraph/functional/VertexTest.java | 480 ---
.../java/com/baidu/hugegraph/testutil/Utils.java | 327 ---
.../com/baidu/hugegraph/unit/BaseUnitTest.java | 33 -
.../hugegraph/unit/BatchElementRequestTest.java | 160 -
.../com/baidu/hugegraph/unit/CommonUtilTest.java | 50 -
.../java/com/baidu/hugegraph/unit/IdUtilTest.java | 44 -
.../com/baidu/hugegraph/unit/IndexLabelTest.java | 98 -
.../baidu/hugegraph/unit/PathSerializerTest.java | 131 -
.../com/baidu/hugegraph/unit/PropertyKeyTest.java | 86 -
.../com/baidu/hugegraph/unit/RestResultTest.java | 1020 -------
.../hugegraph/unit/SplicingIdGeneratorTest.java | 72 -
.../com/baidu/hugegraph/unit/UnitTestSuite.java | 38 -
.../baidu/hugegraph/unit/VertexSerializerTest.java | 94 -
.../java/org/apache/hugegraph/BaseClientTest.java | 365 +++
.../org/apache/hugegraph/api/ApiTestSuite.java | 102 +
.../java/org/apache/hugegraph/api/BaseApiTest.java | 165 ++
.../hugegraph/api/BatchUpdateElementApiTest.java | 760 +++++
.../org/apache/hugegraph/api/CypherApiTest.java | 60 +
.../java/org/apache/hugegraph/api/EdgeApiTest.java | 761 +++++
.../org/apache/hugegraph/api/EdgeLabelApiTest.java | 550 ++++
.../org/apache/hugegraph/api/GraphsApiTest.java | 331 +++
.../org/apache/hugegraph/api/GremlinApiTest.java | 220 ++
.../apache/hugegraph/api/IndexLabelApiTest.java | 490 ++++
.../java/org/apache/hugegraph/api/JobApiTest.java | 76 +
.../apache/hugegraph/api/PropertyKeyApiTest.java | 510 ++++
.../org/apache/hugegraph/api/RestoreApiTest.java | 60 +
.../org/apache/hugegraph/api/SchemaApiTest.java | 50 +
.../java/org/apache/hugegraph/api/TaskApiTest.java | 293 ++
.../org/apache/hugegraph/api/VariablesApiTest.java | 149 +
.../org/apache/hugegraph/api/VertexApiTest.java | 679 +++++
.../apache/hugegraph/api/VertexLabelApiTest.java | 499 ++++
.../apache/hugegraph/api/auth/AccessApiTest.java | 361 +++
.../org/apache/hugegraph/api/auth/AuthApiTest.java | 25 +
.../apache/hugegraph/api/auth/BelongApiTest.java | 326 +++
.../apache/hugegraph/api/auth/GroupApiTest.java | 204 ++
.../apache/hugegraph/api/auth/LoginApiTest.java | 77 +
.../apache/hugegraph/api/auth/LogoutApiTest.java | 87 +
.../apache/hugegraph/api/auth/ProjectApiTest.java | 165 ++
.../apache/hugegraph/api/auth/TargetApiTest.java | 248 ++
.../apache/hugegraph/api/auth/TokenApiTest.java | 111 +
.../org/apache/hugegraph/api/auth/UserApiTest.java | 272 ++
.../api/traverser/AllShortestPathsApiTest.java | 255 ++
.../api/traverser/CommonTraverserApiTest.java | 284 ++
.../hugegraph/api/traverser/CountApiTest.java | 497 ++++
.../api/traverser/CustomizedPathsApiTest.java | 374 +++
.../api/traverser/FusiformSimilarityApiTest.java | 665 +++++
.../api/traverser/JaccardSimilarityApiTest.java | 228 ++
.../hugegraph/api/traverser/KneighborApiTest.java | 510 ++++
.../hugegraph/api/traverser/KoutApiTest.java | 625 ++++
.../traverser/MultiNodeShortestPathApiTest.java | 218 ++
.../api/traverser/NeighborRankApiTest.java | 414 +++
.../hugegraph/api/traverser/PathsApiTest.java | 352 +++
.../api/traverser/PersonalRankApiTest.java | 324 ++
.../hugegraph/api/traverser/RingsRaysApiTest.java | 327 +++
.../api/traverser/SameNeighborsApiTest.java | 175 ++
.../api/traverser/ShortestPathApiTest.java | 255 ++
.../traverser/SingleSourceShortestPathApiTest.java | 507 ++++
.../api/traverser/TemplatePathsApiTest.java | 317 ++
.../hugegraph/api/traverser/TraverserApiTest.java | 89 +
.../api/traverser/WeightedShortestPathApiTest.java | 197 ++
.../hugegraph/functional/AuthManagerTest.java | 163 ++
.../apache/hugegraph/functional/BaseFuncTest.java | 96 +
.../hugegraph/functional/BatchInsertTest.java | 145 +
.../apache/hugegraph/functional/EdgeLabelTest.java | 255 ++
.../org/apache/hugegraph/functional/EdgeTest.java | 799 +++++
.../apache/hugegraph/functional/FuncTestSuite.java | 43 +
.../hugegraph/functional/GraphManagerTest.java | 82 +
.../apache/hugegraph/functional/GraphModeTest.java | 58 +
.../hugegraph/functional/HugeClientHttpsTest.java | 182 ++
.../hugegraph/functional/HugeClientTest.java | 47 +
.../hugegraph/functional/IndexLabelTest.java | 265 ++
.../hugegraph/functional/MetricsManagerTest.java | 56 +
.../hugegraph/functional/PropertyKeyTest.java | 210 ++
.../apache/hugegraph/functional/SchemaTest.java | 51 +
.../hugegraph/functional/TraverserManagerTest.java | 77 +
.../hugegraph/functional/VertexLabelTest.java | 196 ++
.../apache/hugegraph/functional/VertexTest.java | 480 +++
.../java/org/apache/hugegraph/testutil/Utils.java | 326 +++
.../org/apache/hugegraph/unit/BaseUnitTest.java | 33 +
.../hugegraph/unit/BatchElementRequestTest.java | 160 +
.../org/apache/hugegraph/unit/CommonUtilTest.java | 50 +
.../java/org/apache/hugegraph/unit/IdUtilTest.java | 43 +
.../org/apache/hugegraph/unit/IndexLabelTest.java | 98 +
.../apache/hugegraph/unit/PathSerializerTest.java | 131 +
.../org/apache/hugegraph/unit/PropertyKeyTest.java | 86 +
.../org/apache/hugegraph/unit/RestResultTest.java | 1020 +++++++
.../hugegraph/unit/SplicingIdGeneratorTest.java | 72 +
.../org/apache/hugegraph/unit/UnitTestSuite.java | 38 +
.../hugegraph/unit/VertexSerializerTest.java | 94 +
hugegraph-hubble/hubble-be/pom.xml | 4 +-
.../java/com/baidu/hugegraph/HugeGraphHubble.java | 57 -
.../baidu/hugegraph/annotation/MergeProperty.java | 34 -
.../java/com/baidu/hugegraph/common/Constant.java | 77 -
.../com/baidu/hugegraph/common/Identifiable.java | 25 -
.../java/com/baidu/hugegraph/common/Mergeable.java | 23 -
.../java/com/baidu/hugegraph/common/Response.java | 37 -
.../com/baidu/hugegraph/config/AsyncConfig.java | 42 -
.../com/baidu/hugegraph/config/CacheConfig.java | 86 -
.../baidu/hugegraph/config/GlobalCorsConfig.java | 46 -
.../com/baidu/hugegraph/config/HubbleConfig.java | 65 -
.../com/baidu/hugegraph/config/JacksonConfig.java | 134 -
.../baidu/hugegraph/config/MybatisPlusConfig.java | 36 -
.../hugegraph/config/TomcatServletConfig.java | 59 -
.../com/baidu/hugegraph/config/WebMvcConfig.java | 51 -
.../hugegraph/controller/AboutController.java | 50 -
.../baidu/hugegraph/controller/BaseController.java | 62 -
.../controller/GraphConnectionController.java | 237 --
.../hugegraph/controller/SettingController.java | 76 -
.../controller/algorithm/OltpAlgoController.java | 49 -
.../controller/graph/GraphController.java | 140 -
.../controller/load/FileMappingController.java | 380 ---
.../controller/load/FileUploadController.java | 312 --
.../controller/load/JobManagerController.java | 204 --
.../controller/load/LoadTaskController.java | 271 --
.../controller/query/ExecuteHistoryController.java | 72 -
.../query/GremlinCollectionController.java | 179 --
.../controller/query/GremlinController.java | 39 -
.../controller/query/GremlinQueryController.java | 172 --
.../controller/schema/EdgeLabelController.java | 274 --
.../controller/schema/PropertyIndexController.java | 66 -
.../controller/schema/PropertyKeyController.java | 188 --
.../controller/schema/SchemaController.java | 276 --
.../controller/schema/VertexLabelController.java | 281 --
.../controller/task/AsyncTaskController.java | 116 -
.../baidu/hugegraph/entity/GraphConnection.java | 106 -
.../java/com/baidu/hugegraph/entity/UserInfo.java | 46 -
.../hugegraph/entity/algorithm/ShortestPath.java | 59 -
.../hugegraph/entity/enums/AsyncTaskStatus.java | 50 -
.../hugegraph/entity/enums/ExecuteStatus.java | 49 -
.../baidu/hugegraph/entity/enums/ExecuteType.java | 43 -
.../hugegraph/entity/enums/FileMappingStatus.java | 47 -
.../baidu/hugegraph/entity/enums/JobStatus.java | 59 -
.../baidu/hugegraph/entity/enums/LoadAction.java | 47 -
.../baidu/hugegraph/entity/enums/LoadStatus.java | 51 -
.../baidu/hugegraph/entity/graph/EdgeEntity.java | 52 -
.../baidu/hugegraph/entity/graph/VertexEntity.java | 46 -
.../baidu/hugegraph/entity/load/EdgeMapping.java | 59 -
.../hugegraph/entity/load/ElementMapping.java | 87 -
.../hugegraph/entity/load/FieldMappingItem.java | 43 -
.../baidu/hugegraph/entity/load/FileMapping.java | 174 --
.../baidu/hugegraph/entity/load/FileSetting.java | 130 -
.../hugegraph/entity/load/FileUploadResult.java | 63 -
.../baidu/hugegraph/entity/load/JobManager.java | 94 -
.../hugegraph/entity/load/JobManagerItem.java | 47 -
.../entity/load/JobManagerReasonResult.java | 51 -
.../baidu/hugegraph/entity/load/ListFormat.java | 67 -
.../baidu/hugegraph/entity/load/LoadParameter.java | 60 -
.../com/baidu/hugegraph/entity/load/LoadTask.java | 257 --
.../baidu/hugegraph/entity/load/NullValues.java | 45 -
.../hugegraph/entity/load/ValueMappingItem.java | 60 -
.../baidu/hugegraph/entity/load/VertexMapping.java | 55 -
.../hugegraph/entity/query/AdjacentQuery.java | 91 -
.../hugegraph/entity/query/ExecuteHistory.java | 100 -
.../baidu/hugegraph/entity/query/GraphView.java | 45 -
.../hugegraph/entity/query/GremlinCollection.java | 64 -
.../baidu/hugegraph/entity/query/GremlinQuery.java | 37 -
.../hugegraph/entity/query/GremlinResult.java | 83 -
.../com/baidu/hugegraph/entity/query/JsonView.java | 41 -
.../baidu/hugegraph/entity/query/TableView.java | 60 -
.../baidu/hugegraph/entity/query/TypedResult.java | 38 -
.../entity/schema/ConflictCheckEntity.java | 48 -
.../hugegraph/entity/schema/ConflictDetail.java | 147 -
.../hugegraph/entity/schema/ConflictStatus.java | 35 -
.../hugegraph/entity/schema/EdgeLabelEntity.java | 103 -
.../hugegraph/entity/schema/EdgeLabelStyle.java | 98 -
.../entity/schema/EdgeLabelUpdateEntity.java | 44 -
.../hugegraph/entity/schema/LabelUpdateEntity.java | 53 -
.../baidu/hugegraph/entity/schema/Property.java | 40 -
.../hugegraph/entity/schema/PropertyIndex.java | 75 -
.../hugegraph/entity/schema/PropertyKeyEntity.java | 71 -
.../hugegraph/entity/schema/SchemaConflict.java | 25 -
.../hugegraph/entity/schema/SchemaEntity.java | 36 -
.../hugegraph/entity/schema/SchemaLabelEntity.java | 82 -
.../baidu/hugegraph/entity/schema/SchemaStyle.java | 23 -
.../baidu/hugegraph/entity/schema/SchemaType.java | 76 -
.../baidu/hugegraph/entity/schema/Timefiable.java | 27 -
.../baidu/hugegraph/entity/schema/Typifiable.java | 28 -
.../hugegraph/entity/schema/UsingCheckEntity.java | 39 -
.../hugegraph/entity/schema/VertexLabelEntity.java | 89 -
.../hugegraph/entity/schema/VertexLabelStyle.java | 88 -
.../entity/schema/VertexLabelUpdateEntity.java | 44 -
.../com/baidu/hugegraph/entity/task/AsyncTask.java | 105 -
.../hugegraph/entity/task/AsyncTaskResult.java | 79 -
.../hugegraph/exception/ExternalException.java | 47 -
.../exception/IllegalGremlinException.java | 40 -
.../hugegraph/exception/InternalException.java | 31 -
.../exception/ParameterizedException.java | 40 -
.../hugegraph/handler/CustomApplicationRunner.java | 46 -
.../baidu/hugegraph/handler/CustomInterceptor.java | 63 -
.../hugegraph/handler/EdgeMappingTypeHandler.java | 70 -
.../baidu/hugegraph/handler/ExceptionAdvisor.java | 114 -
.../hugegraph/handler/HubbleDisposableBean.java | 42 -
.../baidu/hugegraph/handler/LoadTaskExecutor.java | 40 -
.../hugegraph/handler/MessageSourceHandler.java | 91 -
.../baidu/hugegraph/handler/ResponseAdvisor.java | 59 -
.../handler/VertexMappingTypeHandler.java | 72 -
.../com/baidu/hugegraph/license/ServerInfo.java | 41 -
.../hugegraph/mapper/GraphConnectionMapper.java | 51 -
.../com/baidu/hugegraph/mapper/UserInfoMapper.java | 31 -
.../mapper/algorithm/AsyncTaskMapper.java | 31 -
.../hugegraph/mapper/load/FileMappingMapper.java | 31 -
.../hugegraph/mapper/load/JobManagerMapper.java | 40 -
.../hugegraph/mapper/load/LoadTaskMapper.java | 31 -
.../mapper/query/ExecuteHistoryMapper.java | 38 -
.../mapper/query/GremlinCollectionMapper.java | 50 -
.../com/baidu/hugegraph/options/HubbleOptions.java | 228 --
.../hugegraph/service/GraphConnectionService.java | 90 -
.../hugegraph/service/HugeClientPoolService.java | 88 -
.../baidu/hugegraph/service/SettingSSLService.java | 46 -
.../baidu/hugegraph/service/UserInfoService.java | 54 -
.../service/algorithm/AsyncTaskService.java | 91 -
.../service/algorithm/OltpAlgoService.java | 127 -
.../hugegraph/service/graph/GraphService.java | 208 --
.../hugegraph/service/license/LicenseService.java | 194 --
.../hugegraph/service/load/FileMappingService.java | 367 ---
.../hugegraph/service/load/JobManagerService.java | 136 -
.../hugegraph/service/load/LoadTaskService.java | 553 ----
.../service/query/ExecuteHistoryService.java | 146 -
.../service/query/GremlinCollectionService.java | 124 -
.../service/query/GremlinQueryService.java | 509 ----
.../hugegraph/service/schema/EdgeLabelService.java | 398 ---
.../service/schema/PropertyIndexService.java | 299 --
.../service/schema/PropertyKeyService.java | 248 --
.../hugegraph/service/schema/SchemaService.java | 280 --
.../service/schema/VertexLabelService.java | 407 ---
.../java/com/baidu/hugegraph/util/EntityUtil.java | 70 -
.../src/main/java/com/baidu/hugegraph/util/Ex.java | 89 -
.../java/com/baidu/hugegraph/util/FileUtil.java | 68 -
.../java/com/baidu/hugegraph/util/GremlinUtil.java | 141 -
.../java/com/baidu/hugegraph/util/HubbleUtil.java | 60 -
.../com/baidu/hugegraph/util/HugeClientUtil.java | 147 -
.../java/com/baidu/hugegraph/util/PageUtil.java | 56 -
.../java/com/baidu/hugegraph/util/SQLUtil.java | 34 -
.../com/baidu/hugegraph/util/SerializeUtil.java | 50 -
.../com/baidu/hugegraph/version/HubbleVersion.java | 46 -
.../java/org/apache/hugegraph/HugeGraphHubble.java | 56 +
.../apache/hugegraph/annotation/MergeProperty.java | 34 +
.../java/org/apache/hugegraph/common/Constant.java | 77 +
.../org/apache/hugegraph/common/Identifiable.java | 25 +
.../org/apache/hugegraph/common/Mergeable.java | 23 +
.../java/org/apache/hugegraph/common/Response.java | 37 +
.../org/apache/hugegraph/config/AsyncConfig.java | 42 +
.../org/apache/hugegraph/config/CacheConfig.java | 86 +
.../apache/hugegraph/config/GlobalCorsConfig.java | 46 +
.../org/apache/hugegraph/config/HubbleConfig.java | 63 +
.../org/apache/hugegraph/config/JacksonConfig.java | 134 +
.../apache/hugegraph/config/MybatisPlusConfig.java | 36 +
.../hugegraph/config/TomcatServletConfig.java | 57 +
.../org/apache/hugegraph/config/WebMvcConfig.java | 50 +
.../hugegraph/controller/AboutController.java | 50 +
.../hugegraph/controller/BaseController.java | 62 +
.../controller/GraphConnectionController.java | 237 ++
.../hugegraph/controller/SettingController.java | 76 +
.../controller/algorithm/OltpAlgoController.java | 49 +
.../controller/graph/GraphController.java | 140 +
.../controller/load/FileMappingController.java | 380 +++
.../controller/load/FileUploadController.java | 312 ++
.../controller/load/JobManagerController.java | 204 ++
.../controller/load/LoadTaskController.java | 271 ++
.../controller/query/ExecuteHistoryController.java | 72 +
.../query/GremlinCollectionController.java | 179 ++
.../controller/query/GremlinController.java | 39 +
.../controller/query/GremlinQueryController.java | 172 ++
.../controller/schema/EdgeLabelController.java | 274 ++
.../controller/schema/PropertyIndexController.java | 66 +
.../controller/schema/PropertyKeyController.java | 188 ++
.../controller/schema/SchemaController.java | 276 ++
.../controller/schema/VertexLabelController.java | 281 ++
.../controller/task/AsyncTaskController.java | 116 +
.../apache/hugegraph/entity/GraphConnection.java | 106 +
.../java/org/apache/hugegraph/entity/UserInfo.java | 46 +
.../hugegraph/entity/algorithm/ShortestPath.java | 59 +
.../hugegraph/entity/enums/AsyncTaskStatus.java | 50 +
.../hugegraph/entity/enums/ExecuteStatus.java | 49 +
.../apache/hugegraph/entity/enums/ExecuteType.java | 43 +
.../hugegraph/entity/enums/FileMappingStatus.java | 47 +
.../apache/hugegraph/entity/enums/JobStatus.java | 59 +
.../apache/hugegraph/entity/enums/LoadAction.java | 47 +
.../apache/hugegraph/entity/enums/LoadStatus.java | 51 +
.../apache/hugegraph/entity/graph/EdgeEntity.java | 52 +
.../hugegraph/entity/graph/VertexEntity.java | 46 +
.../apache/hugegraph/entity/load/EdgeMapping.java | 59 +
.../hugegraph/entity/load/ElementMapping.java | 87 +
.../hugegraph/entity/load/FieldMappingItem.java | 43 +
.../apache/hugegraph/entity/load/FileMapping.java | 174 ++
.../apache/hugegraph/entity/load/FileSetting.java | 130 +
.../hugegraph/entity/load/FileUploadResult.java | 63 +
.../apache/hugegraph/entity/load/JobManager.java | 94 +
.../hugegraph/entity/load/JobManagerItem.java | 47 +
.../entity/load/JobManagerReasonResult.java | 51 +
.../apache/hugegraph/entity/load/ListFormat.java | 67 +
.../hugegraph/entity/load/LoadParameter.java | 60 +
.../org/apache/hugegraph/entity/load/LoadTask.java | 257 ++
.../apache/hugegraph/entity/load/NullValues.java | 45 +
.../hugegraph/entity/load/ValueMappingItem.java | 60 +
.../hugegraph/entity/load/VertexMapping.java | 55 +
.../hugegraph/entity/query/AdjacentQuery.java | 91 +
.../hugegraph/entity/query/ExecuteHistory.java | 100 +
.../apache/hugegraph/entity/query/GraphView.java | 45 +
.../hugegraph/entity/query/GremlinCollection.java | 64 +
.../hugegraph/entity/query/GremlinQuery.java | 37 +
.../hugegraph/entity/query/GremlinResult.java | 83 +
.../apache/hugegraph/entity/query/JsonView.java | 41 +
.../apache/hugegraph/entity/query/TableView.java | 60 +
.../apache/hugegraph/entity/query/TypedResult.java | 38 +
.../entity/schema/ConflictCheckEntity.java | 48 +
.../hugegraph/entity/schema/ConflictDetail.java | 147 +
.../hugegraph/entity/schema/ConflictStatus.java | 35 +
.../hugegraph/entity/schema/EdgeLabelEntity.java | 103 +
.../hugegraph/entity/schema/EdgeLabelStyle.java | 98 +
.../entity/schema/EdgeLabelUpdateEntity.java | 44 +
.../hugegraph/entity/schema/LabelUpdateEntity.java | 53 +
.../apache/hugegraph/entity/schema/Property.java | 40 +
.../hugegraph/entity/schema/PropertyIndex.java | 75 +
.../hugegraph/entity/schema/PropertyKeyEntity.java | 71 +
.../hugegraph/entity/schema/SchemaConflict.java | 25 +
.../hugegraph/entity/schema/SchemaEntity.java | 36 +
.../hugegraph/entity/schema/SchemaLabelEntity.java | 82 +
.../hugegraph/entity/schema/SchemaStyle.java | 23 +
.../apache/hugegraph/entity/schema/SchemaType.java | 76 +
.../apache/hugegraph/entity/schema/Timefiable.java | 27 +
.../apache/hugegraph/entity/schema/Typifiable.java | 28 +
.../hugegraph/entity/schema/UsingCheckEntity.java | 39 +
.../hugegraph/entity/schema/VertexLabelEntity.java | 89 +
.../hugegraph/entity/schema/VertexLabelStyle.java | 88 +
.../entity/schema/VertexLabelUpdateEntity.java | 44 +
.../apache/hugegraph/entity/task/AsyncTask.java | 105 +
.../hugegraph/entity/task/AsyncTaskResult.java | 79 +
.../hugegraph/exception/ExternalException.java | 47 +
.../exception/IllegalGremlinException.java | 40 +
.../hugegraph/exception/InternalException.java | 31 +
.../exception/ParameterizedException.java | 40 +
.../hugegraph/handler/CustomApplicationRunner.java | 46 +
.../hugegraph/handler/CustomInterceptor.java | 62 +
.../hugegraph/handler/EdgeMappingTypeHandler.java | 70 +
.../apache/hugegraph/handler/ExceptionAdvisor.java | 114 +
.../hugegraph/handler/HubbleDisposableBean.java | 41 +
.../apache/hugegraph/handler/LoadTaskExecutor.java | 40 +
.../hugegraph/handler/MessageSourceHandler.java | 91 +
.../apache/hugegraph/handler/ResponseAdvisor.java | 59 +
.../handler/VertexMappingTypeHandler.java | 72 +
.../org/apache/hugegraph/license/ServerInfo.java | 41 +
.../hugegraph/mapper/GraphConnectionMapper.java | 51 +
.../apache/hugegraph/mapper/UserInfoMapper.java | 31 +
.../mapper/algorithm/AsyncTaskMapper.java | 31 +
.../hugegraph/mapper/load/FileMappingMapper.java | 31 +
.../hugegraph/mapper/load/JobManagerMapper.java | 40 +
.../hugegraph/mapper/load/LoadTaskMapper.java | 31 +
.../mapper/query/ExecuteHistoryMapper.java | 38 +
.../mapper/query/GremlinCollectionMapper.java | 50 +
.../apache/hugegraph/options/HubbleOptions.java | 228 ++
.../hugegraph/service/GraphConnectionService.java | 90 +
.../hugegraph/service/HugeClientPoolService.java | 88 +
.../hugegraph/service/SettingSSLService.java | 46 +
.../apache/hugegraph/service/UserInfoService.java | 54 +
.../service/algorithm/AsyncTaskService.java | 91 +
.../service/algorithm/OltpAlgoService.java | 127 +
.../hugegraph/service/graph/GraphService.java | 208 ++
.../hugegraph/service/license/LicenseService.java | 194 ++
.../hugegraph/service/load/FileMappingService.java | 367 +++
.../hugegraph/service/load/JobManagerService.java | 136 +
.../hugegraph/service/load/LoadTaskService.java | 551 ++++
.../service/query/ExecuteHistoryService.java | 146 +
.../service/query/GremlinCollectionService.java | 124 +
.../service/query/GremlinQueryService.java | 509 ++++
.../hugegraph/service/schema/EdgeLabelService.java | 398 +++
.../service/schema/PropertyIndexService.java | 299 ++
.../service/schema/PropertyKeyService.java | 248 ++
.../hugegraph/service/schema/SchemaService.java | 280 ++
.../service/schema/VertexLabelService.java | 407 +++
.../java/org/apache/hugegraph/util/EntityUtil.java | 70 +
.../main/java/org/apache/hugegraph/util/Ex.java | 89 +
.../java/org/apache/hugegraph/util/FileUtil.java | 68 +
.../org/apache/hugegraph/util/GremlinUtil.java | 141 +
.../java/org/apache/hugegraph/util/HubbleUtil.java | 60 +
.../org/apache/hugegraph/util/HugeClientUtil.java | 147 +
.../java/org/apache/hugegraph/util/PageUtil.java | 56 +
.../java/org/apache/hugegraph/util/SQLUtil.java | 34 +
.../org/apache/hugegraph/util/SerializeUtil.java | 50 +
.../apache/hugegraph/version/HubbleVersion.java | 45 +
.../src/main/resources/application.properties | 8 +-
.../com/baidu/hugegraph/unit/EntityUtilTest.java | 55 -
.../com/baidu/hugegraph/unit/FileUtilTest.java | 37 -
.../com/baidu/hugegraph/unit/UnitTestSuite.java | 31 -
.../org/apache/hugegraph/unit/EntityUtilTest.java | 55 +
.../org/apache/hugegraph/unit/FileUtilTest.java | 37 +
.../org/apache/hugegraph/unit/UnitTestSuite.java | 31 +
.../src/test/resources/application.properties | 8 +-
.../assembly/static/bin/start-hubble.sh | 2 +-
.../hubble-dist/assembly/travis/build-report.sh | 2 +-
.../hubble-dist/assembly/travis/start-hubble.sh | 2 +-
.../static/bin/hugegraph-flinkcdc-loader.sh | 2 +-
.../assembly/static/bin/hugegraph-loader.sh | 2 +-
.../assembly/static/bin/hugegraph-spark-loader.sh | 2 +-
.../assembly/static/bin/mapping-convert.sh | 2 +-
hugegraph-loader/assembly/static/conf/log4j2.xml | 2 +-
.../baidu/hugegraph/loader/HugeGraphLoader.java | 400 ---
.../baidu/hugegraph/loader/MappingConverter.java | 66 -
.../hugegraph/loader/builder/EdgeBuilder.java | 263 --
.../hugegraph/loader/builder/ElementBuilder.java | 658 -----
.../com/baidu/hugegraph/loader/builder/Record.java | 46 -
.../hugegraph/loader/builder/SchemaCache.java | 132 -
.../hugegraph/loader/builder/VertexBuilder.java | 110 -
.../loader/constant/AutoCloseableIterator.java | 25 -
.../baidu/hugegraph/loader/constant/Checkable.java | 25 -
.../baidu/hugegraph/loader/constant/Constants.java | 86 -
.../baidu/hugegraph/loader/constant/ElemType.java | 45 -
.../baidu/hugegraph/loader/constant/Unique.java | 25 -
.../loader/direct/loader/DirectLoader.java | 76 -
.../loader/direct/loader/HBaseDirectLoader.java | 269 --
.../hugegraph/loader/direct/util/SinkToHBase.java | 168 --
.../hugegraph/loader/exception/InitException.java | 41 -
.../loader/exception/InsertException.java | 47 -
.../hugegraph/loader/exception/LoadException.java | 41 -
.../hugegraph/loader/exception/ParseException.java | 47 -
.../hugegraph/loader/exception/ReadException.java | 38 -
.../loader/executor/ComputerLoadOptions.java | 36 -
.../hugegraph/loader/executor/GroovyExecutor.java | 60 -
.../hugegraph/loader/executor/LoadContext.java | 199 --
.../hugegraph/loader/executor/LoadOptions.java | 373 ---
.../baidu/hugegraph/loader/failure/FailLogger.java | 193 --
.../baidu/hugegraph/loader/failure/FailWriter.java | 132 -
.../loader/flink/HugeGraphDeserialization.java | 88 -
.../loader/flink/HugeGraphFlinkCDCLoader.java | 108 -
.../loader/flink/HugeGraphOutputFormat.java | 227 --
.../loader/flink/HugeGraphSinkFunction.java | 70 -
.../hugegraph/loader/mapping/BackendStoreInfo.java | 83 -
.../hugegraph/loader/mapping/EdgeMapping.java | 89 -
.../hugegraph/loader/mapping/ElementMapping.java | 215 --
.../hugegraph/loader/mapping/InputStruct.java | 139 -
.../hugegraph/loader/mapping/LoadMapping.java | 201 --
.../hugegraph/loader/mapping/VertexMapping.java | 63 -
.../loader/metrics/LoadDistributeMetrics.java | 154 -
.../hugegraph/loader/metrics/LoadMetrics.java | 204 --
.../baidu/hugegraph/loader/metrics/LoadReport.java | 106 -
.../hugegraph/loader/metrics/LoadSummary.java | 181 --
.../hugegraph/loader/metrics/RangesTimer.java | 130 -
.../hugegraph/loader/parser/CsvLineParser.java | 48 -
.../hugegraph/loader/parser/JsonLineParser.java | 63 -
.../baidu/hugegraph/loader/parser/LineParser.java | 30 -
.../hugegraph/loader/parser/TextLineParser.java | 82 -
.../loader/progress/FileItemProgress.java | 71 -
.../loader/progress/InputItemProgress.java | 55 -
.../hugegraph/loader/progress/InputProgress.java | 118 -
.../hugegraph/loader/progress/LoadProgress.java | 161 -
.../hugegraph/loader/reader/AbstractReader.java | 39 -
.../baidu/hugegraph/loader/reader/InputReader.java | 61 -
.../baidu/hugegraph/loader/reader/Readable.java | 38 -
.../loader/reader/file/FileLineFetcher.java | 301 --
.../hugegraph/loader/reader/file/FileReader.java | 212 --
.../loader/reader/file/LocalFileReader.java | 144 -
.../loader/reader/file/OrcFileLineFetcher.java | 160 -
.../loader/reader/file/ParquetFileLineFetcher.java | 180 --
.../loader/reader/hdfs/HDFSFileReader.java | 220 --
.../hugegraph/loader/reader/jdbc/JDBCReader.java | 102 -
.../hugegraph/loader/reader/jdbc/JDBCUtil.java | 139 -
.../hugegraph/loader/reader/jdbc/RowFetcher.java | 181 --
.../baidu/hugegraph/loader/reader/line/Line.java | 92 -
.../hugegraph/loader/reader/line/LineFetcher.java | 77 -
.../loader/serializer/DeserializeException.java | 50 -
.../loader/serializer/InputProgressDeser.java | 91 -
.../loader/serializer/InputSourceDeser.java | 85 -
.../hugegraph/loader/source/AbstractSource.java | 94 -
.../baidu/hugegraph/loader/source/InputSource.java | 36 -
.../baidu/hugegraph/loader/source/SourceType.java | 29 -
.../hugegraph/loader/source/file/Compression.java | 59 -
.../hugegraph/loader/source/file/FileFilter.java | 52 -
.../hugegraph/loader/source/file/FileFormat.java | 45 -
.../hugegraph/loader/source/file/FileSource.java | 201 --
.../hugegraph/loader/source/file/ListFormat.java | 89 -
.../hugegraph/loader/source/file/SkippedLine.java | 60 -
.../hugegraph/loader/source/hdfs/HDFSSource.java | 87 -
.../loader/source/hdfs/KerberosConfig.java | 82 -
.../hugegraph/loader/source/jdbc/JDBCSource.java | 132 -
.../hugegraph/loader/source/jdbc/JDBCVendor.java | 411 ---
.../loader/spark/HugeGraphSparkLoader.java | 337 ---
.../hugegraph/loader/struct/EdgeStructV1.java | 90 -
.../hugegraph/loader/struct/ElementStructV1.java | 178 --
.../hugegraph/loader/struct/GraphStructV1.java | 122 -
.../hugegraph/loader/struct/VertexStructV1.java | 64 -
.../hugegraph/loader/task/BatchInsertTask.java | 112 -
.../baidu/hugegraph/loader/task/InsertTask.java | 145 -
.../hugegraph/loader/task/ParseTaskBuilder.java | 163 --
.../hugegraph/loader/task/SingleInsertTask.java | 103 -
.../baidu/hugegraph/loader/task/TaskManager.java | 193 --
.../baidu/hugegraph/loader/util/DataTypeUtil.java | 337 ---
.../com/baidu/hugegraph/loader/util/DateUtil.java | 80 -
.../hugegraph/loader/util/HugeClientHolder.java | 113 -
.../com/baidu/hugegraph/loader/util/JsonUtil.java | 148 -
.../com/baidu/hugegraph/loader/util/LoadUtil.java | 72 -
.../baidu/hugegraph/loader/util/MappingUtil.java | 188 --
.../baidu/hugegraph/loader/util/ParquetUtil.java | 104 -
.../com/baidu/hugegraph/loader/util/Printer.java | 205 --
.../apache/hugegraph/loader/HugeGraphLoader.java | 399 +++
.../apache/hugegraph/loader/MappingConverter.java | 66 +
.../hugegraph/loader/builder/EdgeBuilder.java | 263 ++
.../hugegraph/loader/builder/ElementBuilder.java | 658 +++++
.../apache/hugegraph/loader/builder/Record.java | 46 +
.../hugegraph/loader/builder/SchemaCache.java | 132 +
.../hugegraph/loader/builder/VertexBuilder.java | 110 +
.../loader/constant/AutoCloseableIterator.java | 25 +
.../hugegraph/loader/constant/Checkable.java | 25 +
.../hugegraph/loader/constant/Constants.java | 86 +
.../apache/hugegraph/loader/constant/ElemType.java | 45 +
.../apache/hugegraph/loader/constant/Unique.java | 25 +
.../loader/direct/loader/DirectLoader.java | 76 +
.../loader/direct/loader/HBaseDirectLoader.java | 270 ++
.../hugegraph/loader/direct/util/SinkToHBase.java | 167 ++
.../hugegraph/loader/exception/InitException.java | 41 +
.../loader/exception/InsertException.java | 47 +
.../hugegraph/loader/exception/LoadException.java | 41 +
.../hugegraph/loader/exception/ParseException.java | 47 +
.../hugegraph/loader/exception/ReadException.java | 38 +
.../loader/executor/ComputerLoadOptions.java | 36 +
.../hugegraph/loader/executor/GroovyExecutor.java | 60 +
.../hugegraph/loader/executor/LoadContext.java | 199 ++
.../hugegraph/loader/executor/LoadOptions.java | 373 +++
.../hugegraph/loader/failure/FailLogger.java | 193 ++
.../hugegraph/loader/failure/FailWriter.java | 132 +
.../loader/flink/HugeGraphDeserialization.java | 88 +
.../loader/flink/HugeGraphFlinkCDCLoader.java | 108 +
.../loader/flink/HugeGraphOutputFormat.java | 227 ++
.../loader/flink/HugeGraphSinkFunction.java | 70 +
.../hugegraph/loader/mapping/BackendStoreInfo.java | 83 +
.../hugegraph/loader/mapping/EdgeMapping.java | 89 +
.../hugegraph/loader/mapping/ElementMapping.java | 215 ++
.../hugegraph/loader/mapping/InputStruct.java | 139 +
.../hugegraph/loader/mapping/LoadMapping.java | 201 ++
.../hugegraph/loader/mapping/VertexMapping.java | 63 +
.../loader/metrics/LoadDistributeMetrics.java | 154 +
.../hugegraph/loader/metrics/LoadMetrics.java | 204 ++
.../hugegraph/loader/metrics/LoadReport.java | 104 +
.../hugegraph/loader/metrics/LoadSummary.java | 182 ++
.../hugegraph/loader/metrics/RangesTimer.java | 130 +
.../hugegraph/loader/parser/CsvLineParser.java | 47 +
.../hugegraph/loader/parser/JsonLineParser.java | 63 +
.../apache/hugegraph/loader/parser/LineParser.java | 30 +
.../hugegraph/loader/parser/TextLineParser.java | 82 +
.../loader/progress/FileItemProgress.java | 71 +
.../loader/progress/InputItemProgress.java | 55 +
.../hugegraph/loader/progress/InputProgress.java | 118 +
.../hugegraph/loader/progress/LoadProgress.java | 161 +
.../hugegraph/loader/reader/AbstractReader.java | 39 +
.../hugegraph/loader/reader/InputReader.java | 61 +
.../apache/hugegraph/loader/reader/Readable.java | 38 +
.../loader/reader/file/FileLineFetcher.java | 301 ++
.../hugegraph/loader/reader/file/FileReader.java | 212 ++
.../loader/reader/file/LocalFileReader.java | 144 +
.../loader/reader/file/OrcFileLineFetcher.java | 160 +
.../loader/reader/file/ParquetFileLineFetcher.java | 180 ++
.../loader/reader/hdfs/HDFSFileReader.java | 220 ++
.../hugegraph/loader/reader/jdbc/JDBCReader.java | 102 +
.../hugegraph/loader/reader/jdbc/JDBCUtil.java | 138 +
.../hugegraph/loader/reader/jdbc/RowFetcher.java | 181 ++
.../apache/hugegraph/loader/reader/line/Line.java | 92 +
.../hugegraph/loader/reader/line/LineFetcher.java | 77 +
.../loader/serializer/DeserializeException.java | 50 +
.../loader/serializer/InputProgressDeser.java | 91 +
.../loader/serializer/InputSourceDeser.java | 85 +
.../hugegraph/loader/source/AbstractSource.java | 94 +
.../hugegraph/loader/source/InputSource.java | 36 +
.../apache/hugegraph/loader/source/SourceType.java | 29 +
.../hugegraph/loader/source/file/Compression.java | 59 +
.../hugegraph/loader/source/file/FileFilter.java | 52 +
.../hugegraph/loader/source/file/FileFormat.java | 45 +
.../hugegraph/loader/source/file/FileSource.java | 201 ++
.../hugegraph/loader/source/file/ListFormat.java | 89 +
.../hugegraph/loader/source/file/SkippedLine.java | 60 +
.../hugegraph/loader/source/hdfs/HDFSSource.java | 87 +
.../loader/source/hdfs/KerberosConfig.java | 82 +
.../hugegraph/loader/source/jdbc/JDBCSource.java | 132 +
.../hugegraph/loader/source/jdbc/JDBCVendor.java | 411 +++
.../loader/spark/HugeGraphSparkLoader.java | 338 +++
.../hugegraph/loader/struct/EdgeStructV1.java | 90 +
.../hugegraph/loader/struct/ElementStructV1.java | 178 ++
.../hugegraph/loader/struct/GraphStructV1.java | 122 +
.../hugegraph/loader/struct/VertexStructV1.java | 64 +
.../hugegraph/loader/task/BatchInsertTask.java | 112 +
.../apache/hugegraph/loader/task/InsertTask.java | 145 +
.../hugegraph/loader/task/ParseTaskBuilder.java | 163 ++
.../hugegraph/loader/task/SingleInsertTask.java | 103 +
.../apache/hugegraph/loader/task/TaskManager.java | 193 ++
.../apache/hugegraph/loader/util/DataTypeUtil.java | 337 +++
.../org/apache/hugegraph/loader/util/DateUtil.java | 80 +
.../hugegraph/loader/util/HugeClientHolder.java | 113 +
.../org/apache/hugegraph/loader/util/JsonUtil.java | 148 +
.../org/apache/hugegraph/loader/util/LoadUtil.java | 72 +
.../apache/hugegraph/loader/util/MappingUtil.java | 188 ++
.../apache/hugegraph/loader/util/ParquetUtil.java | 104 +
.../org/apache/hugegraph/loader/util/Printer.java | 205 ++
hugegraph-loader/src/main/resources/log4j2.xml | 2 +-
.../hugegraph/loader/test/functional/DBUtil.java | 100 -
.../loader/test/functional/FileLoadTest.java | 3092 --------------------
.../hugegraph/loader/test/functional/FileUtil.java | 144 -
.../loader/test/functional/HDFSLoadTest.java | 157 -
.../hugegraph/loader/test/functional/HDFSUtil.java | 170 --
.../hugegraph/loader/test/functional/IOUtil.java | 109 -
.../loader/test/functional/JDBCLoadTest.java | 213 --
.../hugegraph/loader/test/functional/LoadTest.java | 146 -
.../hugegraph/loader/test/unit/DateUtilTest.java | 75 -
.../baidu/hugegraph/loader/test/unit/LineTest.java | 65 -
.../loader/test/unit/LoadProgressTest.java | 90 -
.../loader/test/unit/MappingConverterTest.java | 126 -
.../loader/test/unit/RangesTimerTest.java | 64 -
.../hugegraph/loader/test/unit/UnitTestSuite.java | 34 -
.../hugegraph/loader/test/functional/DBUtil.java | 100 +
.../loader/test/functional/FileLoadTest.java | 3092 ++++++++++++++++++++
.../hugegraph/loader/test/functional/FileUtil.java | 144 +
.../loader/test/functional/HDFSLoadTest.java | 157 +
.../hugegraph/loader/test/functional/HDFSUtil.java | 170 ++
.../hugegraph/loader/test/functional/IOUtil.java | 109 +
.../loader/test/functional/JDBCLoadTest.java | 213 ++
.../hugegraph/loader/test/functional/LoadTest.java | 146 +
.../hugegraph/loader/test/unit/DateUtilTest.java | 75 +
.../hugegraph/loader/test/unit/LineTest.java | 65 +
.../loader/test/unit/LoadProgressTest.java | 90 +
.../loader/test/unit/MappingConverterTest.java | 125 +
.../loader/test/unit/RangesTimerTest.java | 64 +
.../hugegraph/loader/test/unit/UnitTestSuite.java | 34 +
hugegraph-tools/assembly/bin/hugegraph | 2 +-
.../java/com/baidu/hugegraph/base/Directory.java | 66 -
.../com/baidu/hugegraph/base/HdfsDirectory.java | 202 --
.../com/baidu/hugegraph/base/LocalDirectory.java | 181 --
.../java/com/baidu/hugegraph/base/Printer.java | 81 -
.../com/baidu/hugegraph/base/RetryManager.java | 115 -
.../java/com/baidu/hugegraph/base/ToolClient.java | 151 -
.../java/com/baidu/hugegraph/base/ToolManager.java | 72 -
.../com/baidu/hugegraph/cmd/HugeGraphCommand.java | 564 ----
.../java/com/baidu/hugegraph/cmd/SubCommands.java | 1261 --------
.../constant/AuthRestoreConflictStrategy.java | 69 -
.../com/baidu/hugegraph/constant/Constants.java | 31 -
.../baidu/hugegraph/exception/ExitException.java | 90 -
.../baidu/hugegraph/exception/ToolsException.java | 39 -
.../com/baidu/hugegraph/formatter/Formatter.java | 46 -
.../baidu/hugegraph/formatter/JsonFormatter.java | 33 -
.../hugegraph/formatter/kgdumper/ComputeSign.java | 103 -
.../formatter/kgdumper/DumpKGFormatter.java | 147 -
.../hugegraph/formatter/kgdumper/SignFS64.java | 175 --
.../manager/AuthBackupRestoreManager.java | 595 ----
.../com/baidu/hugegraph/manager/BackupManager.java | 500 ----
.../manager/BackupRestoreBaseManager.java | 300 --
.../baidu/hugegraph/manager/DumpGraphManager.java | 124 -
.../com/baidu/hugegraph/manager/GraphsManager.java | 66 -
.../baidu/hugegraph/manager/GremlinManager.java | 57 -
.../baidu/hugegraph/manager/RestoreManager.java | 294 --
.../com/baidu/hugegraph/manager/TasksManager.java | 92 -
.../com/baidu/hugegraph/structure/JsonGraph.java | 177 --
.../java/com/baidu/hugegraph/util/ToolUtil.java | 98 -
.../java/org/apache/hugegraph/base/Directory.java | 66 +
.../org/apache/hugegraph/base/HdfsDirectory.java | 202 ++
.../org/apache/hugegraph/base/LocalDirectory.java | 181 ++
.../java/org/apache/hugegraph/base/Printer.java | 81 +
.../org/apache/hugegraph/base/RetryManager.java | 115 +
.../java/org/apache/hugegraph/base/ToolClient.java | 152 +
.../org/apache/hugegraph/base/ToolManager.java | 72 +
.../org/apache/hugegraph/cmd/HugeGraphCommand.java | 561 ++++
.../java/org/apache/hugegraph/cmd/SubCommands.java | 1261 ++++++++
.../constant/AuthRestoreConflictStrategy.java | 69 +
.../org/apache/hugegraph/constant/Constants.java | 31 +
.../apache/hugegraph/exception/ExitException.java | 90 +
.../apache/hugegraph/exception/ToolsException.java | 39 +
.../org/apache/hugegraph/formatter/Formatter.java | 46 +
.../apache/hugegraph/formatter/JsonFormatter.java | 33 +
.../hugegraph/formatter/kgdumper/ComputeSign.java | 103 +
.../formatter/kgdumper/DumpKGFormatter.java | 146 +
.../hugegraph/formatter/kgdumper/SignFS64.java | 175 ++
.../manager/AuthBackupRestoreManager.java | 595 ++++
.../apache/hugegraph/manager/BackupManager.java | 500 ++++
.../manager/BackupRestoreBaseManager.java | 300 ++
.../apache/hugegraph/manager/DumpGraphManager.java | 123 +
.../apache/hugegraph/manager/GraphsManager.java | 66 +
.../apache/hugegraph/manager/GremlinManager.java | 57 +
.../apache/hugegraph/manager/RestoreManager.java | 294 ++
.../org/apache/hugegraph/manager/TasksManager.java | 92 +
.../org/apache/hugegraph/structure/JsonGraph.java | 177 ++
.../java/org/apache/hugegraph/util/ToolUtil.java | 98 +
hugegraph-tools/src/main/resources/log4j2.xml | 2 +-
.../hugegraph/test/functional/AuthBackupTest.java | 107 -
.../hugegraph/test/functional/AuthRestoreTest.java | 345 ---
.../baidu/hugegraph/test/functional/AuthTest.java | 33 -
.../hugegraph/test/functional/CommandTest.java | 110 -
.../hugegraph/test/functional/FuncTestSuite.java | 32 -
.../com/baidu/hugegraph/test/util/FileUtil.java | 117 -
.../hugegraph/test/functional/AuthBackupTest.java | 107 +
.../hugegraph/test/functional/AuthRestoreTest.java | 344 +++
.../apache/hugegraph/test/functional/AuthTest.java | 33 +
.../hugegraph/test/functional/CommandTest.java | 110 +
.../hugegraph/test/functional/FuncTestSuite.java | 32 +
.../org/apache/hugegraph/test/util/FileUtil.java | 117 +
1106 files changed, 77394 insertions(+), 77432 deletions(-)
diff --git a/.github/workflows/client-ci.yml b/.github/workflows/client-ci.yml
index 0442a7cf..2a2143fd 100644
--- a/.github/workflows/client-ci.yml
+++ b/.github/workflows/client-ci.yml
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-20.04
env:
TRAVIS_DIR: hugegraph-client/assembly/travis
- COMMIT_ID: 8abf3d5524de3d3d5a97bbdce460a75652792b0d
+ COMMIT_ID: b1b12098feb726e46c781a2f171c77558db05fc1
strategy:
fail-fast: false
matrix:
diff --git a/.github/workflows/loader-ci.yml b/.github/workflows/loader-ci.yml
index 08b0556a..703e54c8 100644
--- a/.github/workflows/loader-ci.yml
+++ b/.github/workflows/loader-ci.yml
@@ -24,7 +24,7 @@ jobs:
env:
TRAVIS_DIR: hugegraph-loader/assembly/travis
STATIC_DIR: hugegraph-loader/assembly/static
- COMMIT_ID: 7621aa71d235374de61139915638c47eea3cdce2
+ COMMIT_ID: b1b12098feb726e46c781a2f171c77558db05fc1
DB_USER: root
DB_PASS: root
DB_DATABASE: load_test
diff --git a/.github/workflows/tools-ci.yml b/.github/workflows/tools-ci.yml
index 910fd8ec..e6edbbef 100644
--- a/.github/workflows/tools-ci.yml
+++ b/.github/workflows/tools-ci.yml
@@ -23,7 +23,7 @@ jobs:
env:
TRAVIS_DIR: hugegraph-tools/assembly/travis
# TODO: could we use one param to unify it? or use a action template
- COMMIT_ID: 8abf3d5524de3d3d5a97bbdce460a75652792b0d
+ COMMIT_ID: b1b12098feb726e46c781a2f171c77558db05fc1
steps:
- name: Install JDK 8
uses: actions/setup-java@v3
diff --git a/assembly/static/conf/log4j2.xml b/assembly/static/conf/log4j2.xml
index 47c2e639..53758f36 100644
--- a/assembly/static/conf/log4j2.xml
+++ b/assembly/static/conf/log4j2.xml
@@ -47,7 +47,7 @@
<appender-ref ref="file"/>
</logger>
- <logger name="com.baidu.hugegraph" level="INFO" additivity="false">
+ <logger name="org.apache.hugegraph" level="INFO" additivity="false">
<appender-ref ref="file"/>
</logger>
</loggers>
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/annotation/UnimplementedFeature.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/annotation/UnimplementedFeature.java
deleted file mode 100644
index a920beba..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/annotation/UnimplementedFeature.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates that a method is a feature to be implemented,
- * and may cause an exception if it is used directly now.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
-public @interface UnimplementedFeature {
-
- String desc() default "";
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/API.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/API.java
deleted file mode 100644
index dba7660c..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/API.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.util.E;
-
-public abstract class API {
-
- public static final String CHARSET = "UTF-8";
- public static final String BATCH_ENCODING = "gzip";
- public static final long NO_LIMIT = -1L;
- public static final String PATH_SPLITOR = "/";
-
- protected final RestClient client;
-
- private String path;
-
- public API(RestClient client) {
- E.checkNotNull(client, "client");
- this.client = client;
- this.path = null;
- }
-
- public String path() {
- E.checkState(this.path != null, "Path can't be null");
- return this.path;
- }
-
- protected void path(String path) {
- this.path = path;
- }
-
- protected void path(String pathTemplate, Object... args) {
- this.path = String.format(pathTemplate, args);
- }
-
- protected abstract String type();
-
- protected static void checkOffset(long value) {
- E.checkArgument(value >= 0, "Offset must be >= 0, but got: %s", value);
- }
-
- protected static void checkLimit(long value, String name) {
- E.checkArgument(value > 0 || value == NO_LIMIT,
- "%s must be > 0 or == %s, but got: %s",
- name, NO_LIMIT, value);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
deleted file mode 100644
index 28f3e4b2..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.Access;
-import com.baidu.hugegraph.structure.constant.HugeType;
-
-public class AccessAPI extends AuthAPI {
-
- public AccessAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.ACCESS.string();
- }
-
- public Access create(Access access) {
- RestResult result = this.client.post(this.path(), access);
- return result.readObject(Access.class);
- }
-
- public Access get(Object id) {
- RestResult result = this.client.get(this.path(), formatRelationId(id));
- return result.readObject(Access.class);
- }
-
- public List<Access> list(Object group, Object target, int limit) {
- checkLimit(limit, "Limit");
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("limit", limit);
- params.put("group", formatEntityId(group));
- params.put("target", formatEntityId(target));
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Access.class);
- }
-
- public Access update(Access access) {
- String id = formatRelationId(access.id());
- RestResult result = this.client.put(this.path(), id, access);
- return result.readObject(Access.class);
- }
-
- public void delete(Object id) {
- this.client.delete(this.path(), formatRelationId(id));
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/AuthAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/AuthAPI.java
deleted file mode 100644
index 646c6b85..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/AuthAPI.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.auth.AuthElement;
-
-public abstract class AuthAPI extends API {
-
- private static final String PATH = "graphs/%s/auth/%s";
-
- public AuthAPI(RestClient client, String graph) {
- super(client);
- this.path(PATH, graph, this.type());
- }
-
- public static String formatEntityId(Object id) {
- if (id == null) {
- return null;
- } else if (id instanceof AuthElement) {
- id = ((AuthElement) id).id();
- }
- return String.valueOf(id);
- }
-
- public static String formatRelationId(Object id) {
- if (id == null) {
- return null;
- } else if (id instanceof AuthElement) {
- id = ((AuthElement) id).id();
- }
- return String.valueOf(id);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java
deleted file mode 100644
index 3692114d..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.Belong;
-import com.baidu.hugegraph.structure.constant.HugeType;
-
-public class BelongAPI extends AuthAPI {
-
- public BelongAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.BELONG.string();
- }
-
- public Belong create(Belong belong) {
- RestResult result = this.client.post(this.path(), belong);
- return result.readObject(Belong.class);
- }
-
- public Belong get(Object id) {
- RestResult result = this.client.get(this.path(), formatRelationId(id));
- return result.readObject(Belong.class);
- }
-
- public List<Belong> list(Object user, Object group, int limit) {
- checkLimit(limit, "Limit");
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("limit", limit);
- params.put("user", formatEntityId(user));
- params.put("group", formatEntityId(group));
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Belong.class);
- }
-
- public Belong update(Belong belong) {
- String id = formatRelationId(belong.id());
- RestResult result = this.client.put(this.path(), id, belong);
- return result.readObject(Belong.class);
- }
-
- public void delete(Object id) {
- this.client.delete(this.path(), formatRelationId(id));
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java
deleted file mode 100644
index 7e40ad13..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.Group;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.google.common.collect.ImmutableMap;
-
-public class GroupAPI extends AuthAPI {
-
- public GroupAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.GROUP.string();
- }
-
- public Group create(Group group) {
- RestResult result = this.client.post(this.path(), group);
- return result.readObject(Group.class);
- }
-
- public Group get(Object id) {
- RestResult result = this.client.get(this.path(), formatEntityId(id));
- return result.readObject(Group.class);
- }
-
- public List<Group> list(int limit) {
- checkLimit(limit, "Limit");
- Map<String, Object> params = ImmutableMap.of("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Group.class);
- }
-
- public Group update(Group group) {
- String id = formatEntityId(group.id());
- RestResult result = this.client.put(this.path(), id, group);
- return result.readObject(Group.class);
- }
-
- public void delete(Object id) {
- this.client.delete(this.path(), formatEntityId(id));
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
deleted file mode 100644
index b3a64182..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.Login;
-import com.baidu.hugegraph.structure.auth.LoginResult;
-import com.baidu.hugegraph.structure.constant.HugeType;
-
-public class LoginAPI extends AuthAPI {
-
- public LoginAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.LOGIN.string();
- }
-
- public LoginResult login(Login login) {
- RestResult result = this.client.post(this.path(), login);
- return result.readObject(LoginResult.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/LogoutAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/LogoutAPI.java
deleted file mode 100644
index cd53f6b3..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/LogoutAPI.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.google.common.collect.ImmutableMap;
-
-public class LogoutAPI extends AuthAPI {
-
- public LogoutAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.LOGOUT.string();
- }
-
- public void logout() {
- this.client.delete(this.path(), ImmutableMap.of());
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java
deleted file mode 100644
index 9ac208fc..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.Project;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.google.common.collect.ImmutableMap;
-
-public class ProjectAPI extends AuthAPI {
-
- private static final String ACTION_ADD_GRAPH = "add_graph";
- private static final String ACTION_REMOVE_GRAPH = "remove_graph";
-
- public ProjectAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.PROJECT.string();
- }
-
- public Project create(Project project) {
- RestResult result = this.client.post(this.path(), project);
- return result.readObject(Project.class);
- }
-
- public Project get(Object id) {
- RestResult result = this.client.get(this.path(), formatEntityId(id));
- return result.readObject(Project.class);
- }
-
- public List<Project> list(long limit) {
- checkLimit(limit, "Limit");
- Map<String, Object> params = ImmutableMap.of("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Project.class);
- }
-
- public Project update(Project project) {
- String id = formatEntityId(project.id());
- RestResult result = this.client.put(this.path(), id, project);
- return result.readObject(Project.class);
- }
-
- public void delete(Object id) {
- this.client.delete(this.path(), formatEntityId(id));
- }
-
- public Project addGraphs(Object projectId, Set<String> graphs) {
- Project project = new Project();
- project.graphs(graphs);
- RestResult result = this.client.put(this.path(),
- formatEntityId(projectId),
- project,
- ImmutableMap.of("action",
- ACTION_ADD_GRAPH));
- return result.readObject(Project.class);
- }
-
- public Project removeGraphs(Object projectId, Set<String> graphs) {
- Project project = new Project();
- project.graphs(graphs);
- RestResult result = this.client.put(this.path(),
- formatEntityId(projectId),
- project,
- ImmutableMap.of("action",
- ACTION_REMOVE_GRAPH));
- return result.readObject(Project.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java
deleted file mode 100644
index 63500863..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.Target;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.google.common.collect.ImmutableMap;
-
-public class TargetAPI extends AuthAPI {
-
- public TargetAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.TARGET.string();
- }
-
- public Target create(Target target) {
- RestResult result = this.client.post(this.path(), target);
- return result.readObject(Target.class);
- }
-
- public Target get(Object id) {
- RestResult result = this.client.get(this.path(), formatEntityId(id));
- return result.readObject(Target.class);
- }
-
- public List<Target> list(int limit) {
- checkLimit(limit, "Limit");
- Map<String, Object> params = ImmutableMap.of("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Target.class);
- }
-
- public Target update(Target target) {
- String id = formatEntityId(target.id());
- RestResult result = this.client.put(this.path(), id, target);
- return result.readObject(Target.class);
- }
-
- public void delete(Object id) {
- this.client.delete(this.path(), formatEntityId(id));
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/TokenAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/TokenAPI.java
deleted file mode 100644
index 2c160eca..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/TokenAPI.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.TokenPayload;
-import com.baidu.hugegraph.structure.constant.HugeType;
-
-public class TokenAPI extends AuthAPI {
-
- public TokenAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.TOKEN_VERIFY.string();
- }
-
- public TokenPayload verifyToken() {
- RestResult result = this.client.get(this.path());
- return result.readObject(TokenPayload.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java
deleted file mode 100644
index 82305828..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.auth;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.auth.User;
-import com.baidu.hugegraph.structure.auth.User.UserRole;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.google.common.collect.ImmutableMap;
-
-public class UserAPI extends AuthAPI {
-
- public UserAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.USER.string();
- }
-
- public User create(User user) {
- RestResult result = this.client.post(this.path(), user);
- return result.readObject(User.class);
- }
-
- public User get(Object id) {
- RestResult result = this.client.get(this.path(), formatEntityId(id));
- return result.readObject(User.class);
- }
-
- public UserRole getUserRole(Object id) {
- String idEncoded = RestClient.encode(formatEntityId(id));
- String path = String.join("/", this.path(), idEncoded, "role");
- RestResult result = this.client.get(path);
- return result.readObject(UserRole.class);
- }
-
- public List<User> list(int limit) {
- checkLimit(limit, "Limit");
- Map<String, Object> params = ImmutableMap.of("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), User.class);
- }
-
- public User update(User user) {
- String id = formatEntityId(user.id());
- RestResult result = this.client.put(this.path(), id, user);
- return result.readObject(User.class);
- }
-
- public void delete(Object id) {
- this.client.delete(this.path(), formatEntityId(id));
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java
deleted file mode 100644
index f7a09e6f..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/EdgeAPI.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.graph;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.exception.NotAllCreatedException;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.graph.BatchEdgeRequest;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.graph.Edges;
-import com.google.common.collect.ImmutableMap;
-import jakarta.ws.rs.core.MultivaluedHashMap;
-
-public class EdgeAPI extends GraphAPI {
-
- public EdgeAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.EDGE.string();
- }
-
- public Edge create(Edge edge) {
- RestResult result = this.client.post(this.path(), edge);
- return result.readObject(Edge.class);
- }
-
- 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;
- }
-
- 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);
- }
-
- public Edge append(Edge edge) {
- String id = edge.id();
- Map<String, Object> params = ImmutableMap.of("action", "append");
- RestResult result = this.client.put(this.path(), id, edge, params);
- return result.readObject(Edge.class);
- }
-
- 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);
- }
-
- public Edge get(String id) {
- RestResult result = this.client.get(this.path(), id);
- return result.readObject(Edge.class);
- }
-
- public Edges list(int limit) {
- return this.list(null, null, null, null, 0, null, limit);
- }
-
- public Edges list(Object vertexId, Direction direction,
- String label, Map<String, Object> properties,
- int offset, String page, int limit) {
- return this.list(vertexId, direction, label, properties, false,
- offset, page, limit);
- }
-
- 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);
- }
-
- public void delete(String id) {
- this.client.delete(this.path(), id);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/GraphAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/GraphAPI.java
deleted file mode 100644
index 41e1aeae..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/GraphAPI.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.graph;
-
-import java.util.Map;
-import java.util.UUID;
-
-import org.glassfish.jersey.uri.UriComponent;
-import org.glassfish.jersey.uri.UriComponent.Type;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.util.E;
-import com.baidu.hugegraph.util.JsonUtil;
-
-public abstract class GraphAPI extends API {
-
- private static final String PATH = "graphs/%s/graph/%s";
-
- private final String batchPath;
-
- public GraphAPI(RestClient client, String graph) {
- super(client);
- this.path(PATH, graph, this.type());
- this.batchPath = String.join("/", this.path(), "batch");
- }
-
- public String batchPath() {
- return this.batchPath;
- }
-
- public static String formatVertexId(Object id) {
- return formatVertexId(id, false);
- }
-
- public static String formatVertexId(Object id, boolean allowNull) {
- if (!allowNull) {
- E.checkArgumentNotNull(id, "The vertex id can't be null");
- } else {
- if (id == null) {
- return null;
- }
- }
- boolean uuid = id instanceof UUID;
- if (uuid) {
- id = id.toString();
- }
- E.checkArgument(id instanceof String || id instanceof Number,
- "The vertex id must be either String or " +
- "Number, but got '%s'", id);
- return (uuid ? "U" : "") + JsonUtil.toJson(id);
- }
-
- public static String formatProperties(Map<String, Object> properties) {
- if (properties == null) {
- return null;
- }
- String json = JsonUtil.toJson(properties);
- /*
- * Don't use UrlEncoder.encode, it encoded the space as `+`,
- * which will invalidate the jersey's automatic decoding
- * because it considers the space to be encoded as `%2F`
- */
- return encode(json);
- }
-
- public static String encode(String raw) {
- return UriComponent.encode(raw, Type.QUERY_PARAM_SPACE_ENCODED);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java
deleted file mode 100644
index 9f878a3d..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graph/VertexAPI.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.graph;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.exception.InvalidResponseException;
-import com.baidu.hugegraph.exception.NotAllCreatedException;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.graph.BatchOlapPropertyRequest;
-import com.baidu.hugegraph.structure.graph.BatchVertexRequest;
-import com.baidu.hugegraph.structure.graph.Vertex;
-import com.baidu.hugegraph.structure.graph.Vertices;
-import com.google.common.collect.ImmutableMap;
-import jakarta.ws.rs.core.MultivaluedHashMap;
-import org.apache.hugegraph.rest.RestResult;
-
-public class VertexAPI extends GraphAPI {
-
- public VertexAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.VERTEX.string();
- }
-
- public Vertex create(Vertex vertex) {
- RestResult result = this.client.post(this.path(), vertex);
- return result.readObject(Vertex.class);
- }
-
- public List<Object> create(List<Vertex> vertices) {
- MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
- headers.putSingle("Content-Encoding", BATCH_ENCODING);
- RestResult result = this.client.post(this.batchPath(), vertices,
- headers);
- List<Object> ids = result.readList(Object.class);
- if (vertices.size() != ids.size()) {
- throw new NotAllCreatedException(
- "Not all vertices are successfully created, " +
- "expect '%s', the actual is '%s'",
- ids, vertices.size(), ids.size());
- }
- return ids;
- }
-
- public List<Vertex> update(BatchVertexRequest 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(), Vertex.class);
- }
-
- public int update(BatchOlapPropertyRequest request) {
- this.client.checkApiVersion("0.59", "olap property batch update");
- MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
- headers.putSingle("Content-Encoding", BATCH_ENCODING);
- String path = String.join("/", this.path(), "olap/batch");
- RestResult result = this.client.put(path, null, request, headers);
- Object size = result.readObject(Map.class).get("size");
- if (!(size instanceof Integer)) {
- throw new InvalidResponseException(
- "The 'size' in response must be int, but got: %s(%s)",
- size, size.getClass());
- }
- return (int) size;
- }
-
- public Vertex append(Vertex vertex) {
- String id = GraphAPI.formatVertexId(vertex.id());
- Map<String, Object> params = ImmutableMap.of("action", "append");
- RestResult result = this.client.put(this.path(), id, vertex, params);
- return result.readObject(Vertex.class);
- }
-
- public Vertex eliminate(Vertex vertex) {
- String id = GraphAPI.formatVertexId(vertex.id());
- Map<String, Object> params = ImmutableMap.of("action", "eliminate");
- RestResult result = this.client.put(this.path(), id, vertex, params);
- return result.readObject(Vertex.class);
- }
-
- public Vertex get(Object id) {
- String vertexId = GraphAPI.formatVertexId(id);
- RestResult result = this.client.get(this.path(), vertexId);
- return result.readObject(Vertex.class);
- }
-
- public Vertices list(int limit) {
- return this.list(null, null, 0, null, limit);
- }
-
- public Vertices list(String label, Map<String, Object> properties,
- int offset, String page, int limit) {
- return this.list(label, properties, false, offset, page, limit);
- }
-
- public Vertices list(String label, Map<String, Object> properties,
- boolean keepP, int offset, String page, int limit) {
- checkOffset(offset);
- checkLimit(limit, "Limit");
- String props = GraphAPI.formatProperties(properties);
- Map<String, Object> params = new LinkedHashMap<>();
- 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(Vertices.class);
- }
-
- public void delete(Object id) {
- String vertexId = GraphAPI.formatVertexId(id);
- this.client.delete(this.path(), vertexId);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graphs/GraphsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graphs/GraphsAPI.java
deleted file mode 100644
index 0ced91ba..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/graphs/GraphsAPI.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.graphs;
-
-import java.util.List;
-import java.util.Map;
-
-import jakarta.ws.rs.core.HttpHeaders;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.MultivaluedHashMap;
-import org.apache.commons.lang3.StringUtils;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.exception.InvalidResponseException;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.GraphMode;
-import com.baidu.hugegraph.structure.constant.GraphReadMode;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.google.common.collect.ImmutableMap;
-
-public class GraphsAPI extends API {
-
- private static final String DELIMITER = "/";
- private static final String MODE = "mode";
- private static final String GRAPH_READ_MODE = "graph_read_mode";
- private static final String CLEAR = "clear";
-
- private static final String CONFIRM_MESSAGE = "confirm_message";
-
- public GraphsAPI(RestClient client) {
- super(client);
- this.path(this.type());
- }
-
- @Override
- protected String type() {
- return HugeType.GRAPHS.string();
- }
-
- @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.TEXT_PLAIN);
- 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);
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, String> get(String name) {
- RestResult result = this.client.get(this.path(), name);
- return result.readObject(Map.class);
- }
-
- public List<String> list() {
- RestResult result = this.client.get(this.path());
- return result.readList(this.type(), String.class);
- }
-
- public void clear(String graph, String message) {
- this.client.delete(joinPath(this.path(), graph, CLEAR),
- ImmutableMap.of(CONFIRM_MESSAGE, message));
- }
-
- public void drop(String graph, String message) {
- this.client.checkApiVersion("0.67", "dynamic graph delete");
- this.client.delete(joinPath(this.path(), graph),
- ImmutableMap.of(CONFIRM_MESSAGE, message));
- }
-
- public void mode(String graph, GraphMode mode) {
- // NOTE: Must provide id for PUT. If use "graph/mode", "/" will
- // be encoded to "%2F". So use "mode" here although inaccurate.
- this.client.put(joinPath(this.path(), graph, MODE), null, mode);
- }
-
- public GraphMode mode(String graph) {
- RestResult result = this.client.get(joinPath(this.path(), graph), MODE);
- @SuppressWarnings("unchecked")
- Map<String, String> mode = result.readObject(Map.class);
- String value = mode.get(MODE);
- if (value == null) {
- throw new InvalidResponseException(
- "Invalid response, expect 'mode' in response");
- }
- try {
- return GraphMode.valueOf(value);
- } catch (IllegalArgumentException e) {
- throw new InvalidResponseException(
- "Invalid GraphMode value '%s'", value);
- }
- }
-
- public void readMode(String graph, GraphReadMode readMode) {
- this.client.checkApiVersion("0.59", "graph read mode");
- // NOTE: Must provide id for PUT. If use "graph/graph_read_mode", "/"
- // will be encoded to "%2F". So use "graph_read_mode" here although
- // inaccurate.
- this.client.put(joinPath(this.path(), graph, GRAPH_READ_MODE),
- null, readMode);
- }
-
- public GraphReadMode readMode(String graph) {
- this.client.checkApiVersion("0.59", "graph read mode");
- RestResult result = this.client.get(joinPath(this.path(), graph),
- GRAPH_READ_MODE);
- @SuppressWarnings("unchecked")
- Map<String, String> readMode = result.readObject(Map.class);
- String value = readMode.get(GRAPH_READ_MODE);
- if (value == null) {
- throw new InvalidResponseException(
- "Invalid response, expect 'graph_read_mode' in response");
- }
- try {
- return GraphReadMode.valueOf(value);
- } catch (IllegalArgumentException e) {
- throw new InvalidResponseException(
- "Invalid GraphReadMode value '%s'", value);
- }
- }
-
- private static String joinPath(String path, String graph) {
- return String.join(DELIMITER, path, graph);
- }
-
- private static String joinPath(String path, String graph, String action) {
- return String.join(DELIMITER, path, graph, action);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/CypherAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/CypherAPI.java
deleted file mode 100644
index 856634de..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/CypherAPI.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.gremlin;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.gremlin.Response;
-
-public class CypherAPI extends API {
-
- private static final String PATH = "graphs/%s/cypher";
-
- public CypherAPI(RestClient client, String graph) {
- super(client);
- this.path(PATH, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.CYPHER.string();
- }
-
- public Response post(String cypher) {
- RestResult result = this.client.post(this.path(), cypher);
- return result.readObject(Response.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java
deleted file mode 100644
index 7af56fba..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinAPI.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.gremlin;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.gremlin.Response;
-
-public class GremlinAPI extends API {
-
- public GremlinAPI(RestClient client) {
- super(client);
- this.path(type());
- }
-
- @Override
- protected String type() {
- return HugeType.GREMLIN.string();
- }
-
- public Response post(GremlinRequest request) {
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(Response.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinRequest.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinRequest.java
deleted file mode 100644
index 8c6311b4..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/gremlin/GremlinRequest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.gremlin;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.baidu.hugegraph.driver.GremlinManager;
-import com.baidu.hugegraph.structure.gremlin.ResultSet;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class GremlinRequest {
-
- // See org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
- public String gremlin;
- public Map<String, Object> bindings;
- public String language;
- public Map<String, String> aliases;
-
- public GremlinRequest(String gremlin) {
- this.gremlin = gremlin;
- this.bindings = new ConcurrentHashMap<>();
- this.language = "gremlin-groovy";
- this.aliases = new ConcurrentHashMap<>();
- }
-
- public static class Builder {
- private GremlinRequest request;
- private GremlinManager manager;
-
- public Builder(String gremlin, GremlinManager executor) {
- this.request = new GremlinRequest(gremlin);
- this.manager = executor;
- }
-
- public ResultSet execute() {
- return this.manager.execute(this.request);
- }
-
- public long executeAsTask() {
- return this.manager.executeAsTask(this.request);
- }
-
- public Builder binding(String key, Object value) {
- this.request.bindings.put(key, value);
- return this;
- }
-
- public Builder language(String language) {
- this.request.language = language;
- return this;
- }
-
- public Builder alias(String key, String value) {
- this.request.aliases.put(key, value);
- return this;
- }
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/GremlinJobAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/GremlinJobAPI.java
deleted file mode 100644
index 01ec5937..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/GremlinJobAPI.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.job;
-
-import java.util.Map;
-
-import com.baidu.hugegraph.api.gremlin.GremlinRequest;
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-
-public class GremlinJobAPI extends JobAPI {
-
- private static final String JOB_TYPE = "gremlin";
-
- public GremlinJobAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String jobType() {
- return JOB_TYPE;
- }
-
- public long execute(GremlinRequest request) {
- RestResult result = this.client.post(this.path(), request);
- @SuppressWarnings("unchecked")
- Map<String, Object> task = result.readObject(Map.class);
- return TaskAPI.parseTaskId(task);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/JobAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/JobAPI.java
deleted file mode 100644
index 6447759b..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/JobAPI.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.job;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.constant.HugeType;
-
-public abstract class JobAPI extends API {
-
- // For example: graphs/hugegraph/jobs/gremlin
- private static final String PATH = "graphs/%s/%s/%s";
-
- public JobAPI(RestClient client, String graph) {
- super(client);
- this.path(String.format(PATH, graph, this.type(), this.jobType()));
- }
-
- @Override
- protected String type() {
- return HugeType.JOB.string();
- }
-
- protected abstract String jobType();
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/RebuildAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/RebuildAPI.java
deleted file mode 100644
index 5a22c2de..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/job/RebuildAPI.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.job;
-
-import java.util.Map;
-
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.SchemaElement;
-import com.baidu.hugegraph.structure.schema.EdgeLabel;
-import com.baidu.hugegraph.structure.schema.IndexLabel;
-import com.baidu.hugegraph.structure.schema.VertexLabel;
-import org.apache.hugegraph.util.E;
-
-public class RebuildAPI extends JobAPI {
-
- private static final String JOB_TYPE = "rebuild";
-
- public RebuildAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String jobType() {
- return JOB_TYPE;
- }
-
- public long rebuild(VertexLabel vertexLabel) {
- return this.rebuildIndex(vertexLabel);
- }
-
- public long rebuild(EdgeLabel edgeLabel) {
- return this.rebuildIndex(edgeLabel);
- }
-
- public long rebuild(IndexLabel indexLabel) {
- return this.rebuildIndex(indexLabel);
- }
-
- private long rebuildIndex(SchemaElement element) {
- E.checkArgument(element instanceof VertexLabel ||
- element instanceof EdgeLabel ||
- element instanceof IndexLabel,
- "Only VertexLabel, EdgeLabel and IndexLabel support " +
- "rebuild, but got '%s'", element);
- String path = String.join(PATH_SPLITOR, this.path(), element.type());
- RestResult result = this.client.put(path, element.name(), element);
- @SuppressWarnings("unchecked")
- Map<String, Object> task = result.readObject(Map.class);
- return TaskAPI.parseTaskId(task);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/metrics/MetricsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/metrics/MetricsAPI.java
deleted file mode 100644
index 38bd7029..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/metrics/MetricsAPI.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.metrics;
-
-import java.util.Map;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.util.CommonUtil;
-
-public class MetricsAPI extends API {
-
- public MetricsAPI(RestClient client) {
- super(client);
- this.path(this.type());
- }
-
- @Override
- protected String type() {
- return HugeType.METRICS.string();
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, Map<String, Object>> system() {
- RestResult result = this.client.get(this.path(), "system");
- Map<?, ?> map = result.readObject(Map.class);
- CommonUtil.checkMapClass(map, String.class, Map.class);
- for (Object mapValue : map.values()) {
- CommonUtil.checkMapClass(mapValue, String.class, Object.class);
- }
- return (Map<String, Map<String, Object>>) map;
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, Map<String, Object>> backend() {
- RestResult result = this.client.get(this.path(), "backend");
- Map<?, ?> map = result.readObject(Map.class);
- CommonUtil.checkMapClass(map, String.class, Map.class);
- for (Object mapValue : map.values()) {
- CommonUtil.checkMapClass(mapValue, String.class, Object.class);
- }
- return (Map<String, Map<String, Object>>) map;
- }
-
- public Map<String, Object> backend(String graph) {
- return this.backend().get(graph);
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, Map<String, Object>> all() {
- RestResult result = this.client.get(this.path());
- Map<?, ?> map = result.readObject(Map.class);
- CommonUtil.checkMapClass(map, String.class, Map.class);
- for (Object mapValue : map.values()) {
- CommonUtil.checkMapClass(mapValue, String.class, Object.class);
- }
- return (Map<String, Map<String, Object>>) map;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java
deleted file mode 100644
index 8f4b284b..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/EdgeLabelAPI.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.schema;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.SchemaElement;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.schema.EdgeLabel;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableMap;
-
-public class EdgeLabelAPI extends SchemaElementAPI {
-
- public EdgeLabelAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.EDGE_LABEL.string();
- }
-
- public EdgeLabel create(EdgeLabel edgeLabel) {
- Object el = this.checkCreateOrUpdate(edgeLabel);
- RestResult result = this.client.post(this.path(), el);
- return result.readObject(EdgeLabel.class);
- }
-
- 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);
- }
-
- public EdgeLabel eliminate(EdgeLabel edgeLabel) {
- String id = edgeLabel.name();
- Map<String, Object> params = ImmutableMap.of("action", "eliminate");
- Object el = this.checkCreateOrUpdate(edgeLabel);
- RestResult result = this.client.put(this.path(), id, el, params);
- return result.readObject(EdgeLabel.class);
- }
-
- public EdgeLabel get(String name) {
- RestResult result = this.client.get(this.path(), name);
- return result.readObject(EdgeLabel.class);
- }
-
- public List<EdgeLabel> list() {
- RestResult result = this.client.get(this.path());
- return result.readList(this.type(), EdgeLabel.class);
- }
-
- 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);
- }
-
- 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);
- }
-
- @Override
- protected Object checkCreateOrUpdate(SchemaElement schemaElement) {
- EdgeLabel edgeLabel = (EdgeLabel) schemaElement;
- Object el = edgeLabel;
- if (this.client.apiVersionLt("0.54")) {
- E.checkArgument(edgeLabel.ttl() == 0L &&
- edgeLabel.ttlStartTime() == null,
- "Not support ttl until api version 0.54");
- el = edgeLabel.switchV53();
- }
- return el;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java
deleted file mode 100644
index abd9c50b..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/IndexLabelAPI.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.schema;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.exception.NotSupportException;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.SchemaElement;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.constant.IndexType;
-import com.baidu.hugegraph.structure.schema.IndexLabel;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableMap;
-
-public class IndexLabelAPI extends SchemaElementAPI {
-
- public IndexLabelAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.INDEX_LABEL.string();
- }
-
- public IndexLabel.IndexLabelWithTask create(IndexLabel indexLabel) {
- Object il = this.checkCreateOrUpdate(indexLabel);
- RestResult result = this.client.post(this.path(), il);
- return result.readObject(IndexLabel.IndexLabelWithTask.class);
- }
-
- public IndexLabel append(IndexLabel indexLabel) {
- if (this.client.apiVersionLt("0.50")) {
- throw new NotSupportException("action append on index label");
- }
-
- String id = indexLabel.name();
- Map<String, Object> params = ImmutableMap.of("action", "append");
- Object il = this.checkCreateOrUpdate(indexLabel);
- RestResult result = this.client.put(this.path(), id, il, params);
- return result.readObject(IndexLabel.class);
- }
-
- public IndexLabel eliminate(IndexLabel indexLabel) {
- if (this.client.apiVersionLt("0.50")) {
- throw new NotSupportException("action eliminate on index label");
- }
-
- String id = indexLabel.name();
- Map<String, Object> params = ImmutableMap.of("action", "eliminate");
- Object il = this.checkCreateOrUpdate(indexLabel);
- RestResult result = this.client.put(this.path(), id, il, params);
- return result.readObject(IndexLabel.class);
- }
-
- public IndexLabel get(String name) {
- RestResult result = this.client.get(this.path(), name);
- return result.readObject(IndexLabel.class);
- }
-
- public List<IndexLabel> list() {
- RestResult result = this.client.get(this.path());
- return result.readList(this.type(), IndexLabel.class);
- }
-
- public List<IndexLabel> list(List<String> names) {
- this.client.checkApiVersion("0.48", "getting schema by names");
- E.checkArgument(names != null && !names.isEmpty(),
- "The index 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(), IndexLabel.class);
- }
-
- 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);
- }
-
- @Override
- protected Object checkCreateOrUpdate(SchemaElement schemaElement) {
- IndexLabel indexLabel = (IndexLabel) schemaElement;
- if (indexLabel.indexType() == IndexType.SHARD) {
- this.client.checkApiVersion("0.43", "shard index");
- } else if (indexLabel.indexType() == IndexType.UNIQUE) {
- this.client.checkApiVersion("0.44", "unique index");
- }
-
- IndexLabel il = indexLabel;
- if (this.client.apiVersionLt("0.50")) {
- E.checkArgument(indexLabel.userdata() == null ||
- indexLabel.userdata().isEmpty(),
- "Not support userdata of index label until api " +
- "version 0.50");
- E.checkArgument(indexLabel.rebuild(),
- "Not support rebuild of index label until api " +
- "version 0.57");
- il = indexLabel.switchV49();
- } else if (this.client.apiVersionLt("0.57")) {
- E.checkArgument(indexLabel.rebuild(),
- "Not support rebuild of index label until api " +
- "version 0.57");
- il = indexLabel.switchV56();
- }
- return il;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/PropertyKeyAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/PropertyKeyAPI.java
deleted file mode 100644
index 7c2bdca3..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/PropertyKeyAPI.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.schema;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.exception.NotSupportException;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.SchemaElement;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.constant.WriteType;
-import com.baidu.hugegraph.structure.schema.PropertyKey;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableMap;
-
-public class PropertyKeyAPI extends SchemaElementAPI {
-
- public PropertyKeyAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.PROPERTY_KEY.string();
- }
-
- public PropertyKey.PropertyKeyWithTask create(PropertyKey propertyKey) {
- Object pkey = this.checkCreateOrUpdate(propertyKey);
- RestResult result = this.client.post(this.path(), pkey);
- if (this.client.apiVersionLt("0.65")) {
- return new PropertyKey.PropertyKeyWithTask(
- result.readObject(PropertyKey.class), 0L);
- }
- return result.readObject(PropertyKey.PropertyKeyWithTask.class);
- }
-
- public PropertyKey.PropertyKeyWithTask append(PropertyKey propertyKey) {
- String id = propertyKey.name();
- Map<String, Object> params = ImmutableMap.of("action", "append");
- Object pkey = this.checkCreateOrUpdate(propertyKey);
- RestResult result = this.client.put(this.path(), id, pkey, params);
- return result.readObject(PropertyKey.PropertyKeyWithTask.class);
- }
-
- public PropertyKey.PropertyKeyWithTask eliminate(PropertyKey propertyKey) {
- String id = propertyKey.name();
- Map<String, Object> params = ImmutableMap.of("action", "eliminate");
- Object pkey = this.checkCreateOrUpdate(propertyKey);
- RestResult result = this.client.put(this.path(), id, pkey, params);
- return result.readObject(PropertyKey.PropertyKeyWithTask.class);
- }
-
- public PropertyKey.PropertyKeyWithTask clear(PropertyKey propertyKey) {
- if (this.client.apiVersionLt("0.65")) {
- throw new NotSupportException("action clear on property key");
- }
- String id = propertyKey.name();
- Map<String, Object> params = ImmutableMap.of("action", "clear");
- Object pkey = this.checkCreateOrUpdate(propertyKey);
- RestResult result = this.client.put(this.path(), id, pkey, params);
- return result.readObject(PropertyKey.PropertyKeyWithTask.class);
- }
-
- public PropertyKey get(String name) {
- RestResult result = this.client.get(this.path(), name);
- return result.readObject(PropertyKey.class);
- }
-
- public List<PropertyKey> list() {
- RestResult result = this.client.get(this.path());
- return result.readList(this.type(), PropertyKey.class);
- }
-
- public List<PropertyKey> list(List<String> names) {
- this.client.checkApiVersion("0.48", "getting schema by names");
- E.checkArgument(names != null && !names.isEmpty(),
- "The property key 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(), PropertyKey.class);
- }
-
- public long delete(String name) {
- if (this.client.apiVersionLt("0.65")) {
- this.client.delete(this.path(), name);
- return 0L;
- }
- RestResult result = this.client.delete(this.path(), name);
- @SuppressWarnings("unchecked")
- Map<String, Object> task = result.readObject(Map.class);
- return TaskAPI.parseTaskId(task);
- }
-
- @Override
- protected Object checkCreateOrUpdate(SchemaElement schemaElement) {
- PropertyKey propertyKey = (PropertyKey) schemaElement;
- Object pkey = propertyKey;
- if (this.client.apiVersionLt("0.47")) {
- E.checkArgument(propertyKey.aggregateType().isNone(),
- "Not support aggregate property until " +
- "api version 0.47");
- pkey = propertyKey.switchV46();
- } else if (this.client.apiVersionLt("0.59")) {
- E.checkArgument(propertyKey.writeType() == WriteType.OLTP,
- "Not support olap property key until " +
- "api version 0.59");
- pkey = propertyKey.switchV58();
- }
- return pkey;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/SchemaAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/SchemaAPI.java
deleted file mode 100644
index 5502565b..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/SchemaAPI.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.schema;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.exception.NotSupportException;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.SchemaElement;
-
-public class SchemaAPI extends API {
-
- private static final String PATH = "graphs/%s/%s";
-
- public SchemaAPI(RestClient client, String graph) {
- super(client);
- this.path(PATH, graph, this.type());
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, List<SchemaElement>> list() {
- if (this.client.apiVersionLt("0.66")) {
- throw new NotSupportException("schema get api");
- }
- RestResult result = this.client.get(this.path());
- return result.readObject(Map.class);
- }
-
- @Override
- protected String type() {
- return "schema";
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/SchemaElementAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/SchemaElementAPI.java
deleted file mode 100644
index 2bc6135a..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/SchemaElementAPI.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.schema;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.SchemaElement;
-
-public abstract class SchemaElementAPI extends API {
-
- private static final String PATH = "graphs/%s/schema/%s";
-
- public SchemaElementAPI(RestClient client, String graph) {
- super(client);
- this.path(PATH, graph, this.type());
- }
-
- protected abstract Object checkCreateOrUpdate(SchemaElement schemaElement);
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/VertexLabelAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/VertexLabelAPI.java
deleted file mode 100644
index 953609df..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/schema/VertexLabelAPI.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.schema;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.SchemaElement;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.schema.VertexLabel;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableMap;
-
-public class VertexLabelAPI extends SchemaElementAPI {
-
- public VertexLabelAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return HugeType.VERTEX_LABEL.string();
- }
-
- public VertexLabel create(VertexLabel vertexLabel) {
- Object vl = this.checkCreateOrUpdate(vertexLabel);
- RestResult result = this.client.post(this.path(), vl);
- return result.readObject(VertexLabel.class);
- }
-
- public VertexLabel append(VertexLabel vertexLabel) {
- String id = vertexLabel.name();
- Map<String, Object> params = ImmutableMap.of("action", "append");
- Object vl = this.checkCreateOrUpdate(vertexLabel);
- RestResult result = this.client.put(this.path(), id, vl, params);
- return result.readObject(VertexLabel.class);
- }
-
- public VertexLabel eliminate(VertexLabel vertexLabel) {
- String id = vertexLabel.name();
- Map<String, Object> params = ImmutableMap.of("action", "eliminate");
- Object vl = this.checkCreateOrUpdate(vertexLabel);
- RestResult result = this.client.put(this.path(), id, vl, params);
- return result.readObject(VertexLabel.class);
- }
-
- public VertexLabel get(String name) {
- RestResult result = this.client.get(this.path(), name);
- return result.readObject(VertexLabel.class);
- }
-
- public List<VertexLabel> list() {
- RestResult result = this.client.get(this.path());
- return result.readList(this.type(), VertexLabel.class);
- }
-
- public List<VertexLabel> list(List<String> names) {
- this.client.checkApiVersion("0.48", "getting schema by names");
- E.checkArgument(names != null && !names.isEmpty(),
- "The vertex 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(), VertexLabel.class);
- }
-
- 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);
- }
-
- @Override
- protected Object checkCreateOrUpdate(SchemaElement schemaElement) {
- VertexLabel vertexLabel = (VertexLabel) schemaElement;
- if (vertexLabel.idStrategy().isCustomizeUuid()) {
- this.client.checkApiVersion("0.46", "customize UUID strategy");
- }
- Object vl = vertexLabel;
- if (this.client.apiVersionLt("0.54")) {
- E.checkArgument(vertexLabel.ttl() == 0L &&
- vertexLabel.ttlStartTime() == null,
- "Not support ttl until api version 0.54");
- vl = vertexLabel.switchV53();
- }
- return vl;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/task/TaskAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/task/TaskAPI.java
deleted file mode 100644
index afe0714e..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/task/TaskAPI.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.task;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.ClientException;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.Task;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import org.apache.hugegraph.util.E;
-import com.baidu.hugegraph.util.TaskCache;
-import com.google.common.collect.ImmutableMap;
-
-public class TaskAPI extends API {
-
- private static final String PATH = "graphs/%s/tasks";
- private String graph;
- public static final String TASKS = "tasks";
- public static final String TASK_ID = "task_id";
- public static final long TASK_TIMEOUT = 60L;
- private static final long QUERY_INTERVAL = 500L;
-
- public TaskAPI(RestClient client, String graph) {
- super(client);
- this.path(String.format(PATH, graph));
- this.graph = graph;
- }
-
- @Override
- protected String type() {
- return HugeType.TASK.string();
- }
-
- public String graph() {
- return this.graph;
- }
-
- public List<Task> list(String status, long limit) {
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("limit", limit);
- if (status != null) {
- params.put("status", status);
- }
- RestResult result = this.client.get(this.path(), params);
- return result.readList(TASKS, Task.class);
- }
-
- public TasksWithPage list(String status, String page, long limit) {
- E.checkArgument(page != null, "The page can not be null");
- this.client.checkApiVersion("0.48", "getting tasks by paging");
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("limit", limit);
- params.put("page", page);
- if (status != null) {
- params.put("status", status);
- }
- RestResult result = this.client.get(this.path(), params);
- return result.readObject(TasksWithPage.class);
- }
-
- public List<Task> list(List<Long> ids) {
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("ids", ids);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(TASKS, Task.class);
- }
-
- public Task get(long id) {
- RestResult result = this.client.get(this.path(), String.valueOf(id));
- return result.readObject(Task.class);
- }
-
- public void delete(long id) {
- this.client.delete(path(), String.valueOf(id));
- }
-
- public Task cancel(long id) {
- Map<String, Object> params = ImmutableMap.of("action", "cancel");
- RestResult result = this.client.put(path(), String.valueOf(id),
- ImmutableMap.of(), params);
- return result.readObject(Task.class);
- }
-
- public Task waitUntilTaskSuccess(long taskId, long seconds) {
- if (taskId == 0) {
- return null;
- }
- long passes = seconds * 1000 / QUERY_INTERVAL;
- try {
- for (long pass = 0; ; pass++) {
- Task task = this.getFromCache(taskId);
- if (task.success()) {
- return task;
- } else if (task.completed()) {
- throw new ClientException(
- "Task '%s' is %s, result is '%s'",
- taskId, task.status(), task.result());
- }
- if (pass >= passes) {
- break;
- }
- try {
- // Query every half second from cache to decrease waiting
- // time because restful query is executed per second
- Thread.sleep(QUERY_INTERVAL);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
- throw new ClientException(
- "Task '%s' not completed in %s seconds, " +
- "it can still be queried by task-get API",
- taskId, seconds);
- } finally {
- // Stop querying this task info whatever
- this.removeFromCache(taskId);
- }
- }
-
- private Task getFromCache(long taskId) {
- return TaskCache.instance().get(this, taskId);
- }
-
- private void removeFromCache(long taskId) {
- TaskCache.instance().remove(this, taskId);
- }
-
- public static long parseTaskId(Map<String, Object> task) {
- E.checkState(task.size() == 1 && task.containsKey(TASK_ID),
- "Task must be formatted to {\"%s\" : id}, but got %s",
- TASK_ID, task);
- Object taskId = task.get(TASK_ID);
- E.checkState(taskId instanceof Number,
- "Task id must be number, but got '%s'", taskId);
- return ((Number) taskId).longValue();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/task/TasksWithPage.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/task/TasksWithPage.java
deleted file mode 100644
index 93f09b43..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/task/TasksWithPage.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.task;
-
-import java.util.List;
-
-import com.baidu.hugegraph.structure.Task;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class TasksWithPage {
-
- @JsonProperty
- private String page;
- @JsonProperty
- private List<Task> tasks;
-
- public String page() {
- return this.page;
- }
-
- public List<Task> tasks() {
- return this.tasks;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/AllShortestPathsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/AllShortestPathsAPI.java
deleted file mode 100644
index e1e751e5..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/AllShortestPathsAPI.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.graph.Path;
-
-public class AllShortestPathsAPI extends TraversersAPI {
-
- public AllShortestPathsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "allshortestpaths";
- }
-
- public List<Path> get(Object sourceId, Object targetId,
- Direction direction, String label, int maxDepth,
- long degree, long skipDegree, long capacity) {
- this.client.checkApiVersion("0.51", "all shortest path");
- String source = GraphAPI.formatVertexId(sourceId, false);
- String target = GraphAPI.formatVertexId(targetId, false);
-
- checkPositive(maxDepth, "Max depth of shortest path");
- 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("max_depth", maxDepth);
- params.put("max_degree", degree);
- params.put("skip_degree", skipDegree);
- params.put("capacity", capacity);
- RestResult result = this.client.get(this.path(), params);
- return result.readList("paths", Path.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CountAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CountAPI.java
deleted file mode 100644
index 45bb1bd6..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CountAPI.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.traverser.CountRequest;
-import org.apache.hugegraph.util.E;
-
-public class CountAPI extends TraversersAPI {
-
- private static final String COUNT = "count";
-
- public CountAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "count";
- }
-
- public long post(CountRequest request) {
- this.client.checkApiVersion("0.55", "count");
- RestResult result = this.client.post(this.path(), request);
- @SuppressWarnings("unchecked")
- Map<String, Number> countMap = result.readObject(Map.class);
- E.checkState(countMap.containsKey(COUNT),
- "The result doesn't have key '%s'", COUNT);
- return countMap.get(COUNT).longValue();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CrosspointsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CrosspointsAPI.java
deleted file mode 100644
index 3c9392ac..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CrosspointsAPI.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.graph.Path;
-
-public class CrosspointsAPI extends TraversersAPI {
-
- public CrosspointsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "crosspoints";
- }
-
- public List<Path> get(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth, long degree,
- long capacity, int limit) {
- String source = GraphAPI.formatVertexId(sourceId, false);
- String target = GraphAPI.formatVertexId(targetId, false);
-
- checkPositive(maxDepth, "Max depth of path");
- checkDegree(degree);
- checkCapacity(capacity);
- checkLimit(limit);
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("source", source);
- params.put("target", target);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_depth", maxDepth);
- params.put("max_degree", degree);
- params.put("capacity", capacity);
- params.put("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList("crosspoints", Path.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CustomizedCrosspointsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CustomizedCrosspointsAPI.java
deleted file mode 100644
index 7303744c..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CustomizedCrosspointsAPI.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.traverser.CrosspointsRequest;
-import com.baidu.hugegraph.structure.traverser.CustomizedCrosspoints;
-
-public class CustomizedCrosspointsAPI extends TraversersAPI {
-
- public CustomizedCrosspointsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "customizedcrosspoints";
- }
-
- public CustomizedCrosspoints post(CrosspointsRequest request) {
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(CustomizedCrosspoints.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CustomizedPathsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CustomizedPathsAPI.java
deleted file mode 100644
index 2699aa9c..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/CustomizedPathsAPI.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.traverser.PathsWithVertices;
-import com.baidu.hugegraph.structure.traverser.CustomizedPathsRequest;
-
-public class CustomizedPathsAPI extends TraversersAPI {
-
- public CustomizedPathsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "customizedpaths";
- }
-
- public PathsWithVertices post(CustomizedPathsRequest request) {
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(PathsWithVertices.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/EdgesAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/EdgesAPI.java
deleted file mode 100644
index 3964cb0f..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/EdgesAPI.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.graph.Edges;
-import com.baidu.hugegraph.structure.graph.Shard;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableMap;
-
-public class EdgesAPI extends TraversersAPI {
-
- public EdgesAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "edges";
- }
-
- public List<Edge> list(List<String> ids) {
- E.checkArgument(ids != null && !ids.isEmpty(),
- "Ids can't be null or empty");
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("ids", ids);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Edge.class);
- }
-
- public List<Shard> shards(long splitSize) {
- String path = String.join(PATH_SPLITOR, this.path(), "shards");
- Map<String, Object> params = ImmutableMap.of("split_size", splitSize);
- RestResult result = this.client.get(path, params);
- return result.readList("shards", Shard.class);
- }
-
- public Edges scan(Shard shard, String page, long pageLimit) {
- E.checkArgument(shard != null, "Shard can't be null");
- String path = String.join(PATH_SPLITOR, this.path(), "scan");
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("start", shard.start());
- params.put("end", shard.end());
- params.put("page", page);
- params.put("page_limit", pageLimit);
- RestResult result = this.client.get(path, params);
- return result.readObject(Edges.class);
- }
-}
-
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/FusiformSimilarityAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/FusiformSimilarityAPI.java
deleted file mode 100644
index c10752b5..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/FusiformSimilarityAPI.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.traverser.FusiformSimilarity;
-import com.baidu.hugegraph.structure.traverser.FusiformSimilarityRequest;
-
-public class FusiformSimilarityAPI extends TraversersAPI {
-
- public FusiformSimilarityAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "fusiformsimilarity";
- }
-
- public FusiformSimilarity post(FusiformSimilarityRequest request) {
- this.client.checkApiVersion("0.49", "fusiform similarity");
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(FusiformSimilarity.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/JaccardSimilarityAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/JaccardSimilarityAPI.java
deleted file mode 100644
index c733e8b5..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/JaccardSimilarityAPI.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-
-import org.apache.hugegraph.rest.RestResult;
-
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.traverser.SingleSourceJaccardSimilarityRequest;
-
-
-import org.apache.hugegraph.util.E;
-
-public class JaccardSimilarityAPI extends TraversersAPI {
-
- private static final String JACCARD_SIMILARITY = "jaccard_similarity";
-
- public JaccardSimilarityAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "jaccardsimilarity";
- }
-
- public double get(Object vertexId, Object otherId, Direction direction,
- String label, long degree) {
- this.client.checkApiVersion("0.51", "jaccard similarity");
- String vertex = GraphAPI.formatVertexId(vertexId, false);
- String other = GraphAPI.formatVertexId(otherId, false);
- checkDegree(degree);
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("vertex", vertex);
- params.put("other", other);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_degree", degree);
- RestResult result = this.client.get(this.path(), params);
- @SuppressWarnings("unchecked")
- Map<String, Double> jaccard = result.readObject(Map.class);
- E.checkState(jaccard.containsKey(JACCARD_SIMILARITY),
- "The result doesn't have key '%s'", JACCARD_SIMILARITY);
- return jaccard.get(JACCARD_SIMILARITY);
- }
-
- @SuppressWarnings("unchecked")
- public Map<Object, Double> post(SingleSourceJaccardSimilarityRequest request) {
- this.client.checkApiVersion("0.58", "jaccard similar");
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(Map.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KneighborAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KneighborAPI.java
deleted file mode 100644
index 557ac84e..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KneighborAPI.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.traverser.Kneighbor;
-import com.baidu.hugegraph.structure.traverser.KneighborRequest;
-
-public class KneighborAPI extends TraversersAPI {
-
- public KneighborAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "kneighbor";
- }
-
- public List<Object> get(Object sourceId, Direction direction,
- String label, int depth, long degree, int limit) {
- String source = GraphAPI.formatVertexId(sourceId, false);
-
- checkPositive(depth, "Depth of k-neighbor");
- checkDegree(degree);
- checkLimit(limit);
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("source", source);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_depth", depth);
- params.put("max_degree", degree);
- params.put("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList("vertices", Object.class);
- }
-
- public Kneighbor post(KneighborRequest request) {
- this.client.checkApiVersion("0.58", "customized kneighbor");
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(Kneighbor.class);
- }
-}
-
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KoutAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KoutAPI.java
deleted file mode 100644
index 8184e408..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/KoutAPI.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.traverser.Kout;
-import com.baidu.hugegraph.structure.traverser.KoutRequest;
-
-public class KoutAPI extends TraversersAPI {
-
- public KoutAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "kout";
- }
-
- public List<Object> get(Object sourceId, Direction direction,
- String label, int depth, boolean nearest,
- long degree, long capacity, int limit) {
- String source = GraphAPI.formatVertexId(sourceId, false);
-
- checkPositive(depth, "Depth of k-out");
- checkDegree(degree);
- checkCapacity(capacity);
- checkLimit(limit);
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("source", source);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_depth", depth);
- params.put("nearest", nearest);
- params.put("max_degree", degree);
- params.put("capacity", capacity);
- params.put("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList("vertices", Object.class);
- }
-
- public Kout post(KoutRequest request) {
- this.client.checkApiVersion("0.58", "customized kout");
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(Kout.class);
- }
-}
-
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/MultiNodeShortestPathAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/MultiNodeShortestPathAPI.java
deleted file mode 100644
index 76190af7..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/MultiNodeShortestPathAPI.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.traverser.MultiNodeShortestPathRequest;
-import com.baidu.hugegraph.structure.traverser.PathsWithVertices;
-
-public class MultiNodeShortestPathAPI extends TraversersAPI {
-
- public MultiNodeShortestPathAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "multinodeshortestpath";
- }
-
- public PathsWithVertices post(MultiNodeShortestPathRequest request) {
- this.client.checkApiVersion("0.58", "multi node shortest path");
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(PathsWithVertices.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/NeighborRankAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/NeighborRankAPI.java
deleted file mode 100644
index 736c30ae..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/NeighborRankAPI.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.constant.Traverser;
-import com.baidu.hugegraph.structure.traverser.Ranks;
-import org.apache.hugegraph.util.E;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class NeighborRankAPI extends TraversersAPI {
-
- public NeighborRankAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "neighborrank";
- }
-
- public List<Ranks> post(Request request) {
- RestResult result = this.client.post(this.path(), request);
- return result.readList("ranks", Ranks.class);
- }
-
- public static class Request {
-
- @JsonProperty("source")
- private Object source;
- @JsonProperty("steps")
- private List<Step> steps;
- @JsonProperty("alpha")
- private double alpha;
- @JsonProperty("capacity")
- private long capacity;
-
- private Request() {
- this.source = null;
- this.steps = new ArrayList<>();
- this.alpha = Traverser.DEFAULT_ALPHA;
- this.capacity = Traverser.DEFAULT_CAPACITY;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public String toString() {
- return String.format("Request{source=%s,steps=%s,alpha=%s," +
- "capacity=%s}", this.source, this.steps,
- this.alpha, this.capacity);
- }
-
- public static class Builder {
-
- private Request request;
- private List<Step.Builder> stepBuilders;
-
- private Builder() {
- this.request = new Request();
- this.stepBuilders = new ArrayList<>();
- }
-
- public Builder source(Object source) {
- E.checkArgument(source != null, "The label of request " +
- "for neighbor rank can't be null");
- this.request.source = source;
- return this;
- }
-
- public Step.Builder steps() {
- Step.Builder builder = new Step.Builder();
- this.stepBuilders.add(builder);
- return builder;
- }
-
- public Builder alpha(double alpha) {
- TraversersAPI.checkAlpha(alpha);
- this.request.alpha = alpha;
- return this;
- }
-
- public Builder capacity(long capacity) {
- TraversersAPI.checkCapacity(capacity);
- this.request.capacity = capacity;
- return this;
- }
-
- public Request build() {
- for (Step.Builder builder : this.stepBuilders) {
- this.request.steps.add(builder.build());
- }
- E.checkArgument(this.request.source != null,
- "Source vertex can't be null");
- E.checkArgument(this.request.steps != null &&
- !this.request.steps.isEmpty(),
- "Steps can't be null or empty");
- TraversersAPI.checkCapacity(this.request.capacity);
- TraversersAPI.checkAlpha(this.request.alpha);
- return this.request;
- }
- }
-
- public static class Step {
-
- @JsonProperty("direction")
- private String direction;
- @JsonProperty("labels")
- private List<String> labels;
- @JsonProperty("degree")
- private long degree;
- @JsonProperty("top")
- private int top;
-
- private Step() {
- this.direction = null;
- this.labels = new ArrayList<>();
- this.degree = Traverser.DEFAULT_MAX_DEGREE;
- this.top = (int) Traverser.DEFAULT_PATHS_LIMIT;
- }
-
- @Override
- public String toString() {
- return String.format("Step{direction=%s,labels=%s,degree=%s," +
- "top=%s}", this.direction, this.labels,
- this.degree, this.top);
- }
-
- public static class Builder {
-
- private Step step;
-
- private Builder() {
- this.step = new Step();
- }
-
- public Step.Builder direction(Direction direction) {
- this.step.direction = direction.toString();
- return this;
- }
-
- public Step.Builder labels(List<String> labels) {
- this.step.labels.addAll(labels);
- return this;
- }
-
- public Step.Builder labels(String... labels) {
- this.step.labels.addAll(Arrays.asList(labels));
- return this;
- }
-
- public Step.Builder degree(long degree) {
- TraversersAPI.checkDegree(degree);
- this.step.degree = degree;
- return this;
- }
-
- public Step.Builder top(int top) {
- E.checkArgument(top > 0 && top <= Traverser.DEFAULT_MAX_TOP,
- "The top of each layer can't exceed %s",
- Traverser.DEFAULT_MAX_TOP);
- this.step.top = top;
- return this;
- }
-
- private Step build() {
- TraversersAPI.checkDegree(this.step.degree);
- E.checkArgument(this.step.top > 0 &&
- this.step.top <= Traverser.DEFAULT_MAX_TOP,
- "The top of each layer can't exceed %s",
- Traverser.DEFAULT_MAX_TOP);
- return this.step;
- }
- }
- }
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PathsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PathsAPI.java
deleted file mode 100644
index d69addbf..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PathsAPI.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.graph.Path;
-import com.baidu.hugegraph.structure.traverser.PathsRequest;
-import com.baidu.hugegraph.structure.traverser.PathsWithVertices;
-
-public class PathsAPI extends TraversersAPI {
-
- public PathsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "paths";
- }
-
- public List<Path> get(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth, long degree, long capacity,
- int limit) {
- String source = GraphAPI.formatVertexId(sourceId, false);
- String target = GraphAPI.formatVertexId(targetId, false);
-
- checkPositive(maxDepth, "Max depth of path");
- checkDegree(degree);
- checkCapacity(capacity);
- checkLimit(limit);
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("source", source);
- params.put("target", target);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_depth", maxDepth);
- params.put("max_degree", degree);
- params.put("capacity", capacity);
- params.put("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList("paths", Path.class);
- }
-
- public PathsWithVertices post(PathsRequest request) {
- this.client.checkApiVersion("0.58", "paths with property filter");
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(PathsWithVertices.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PersonalRankAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PersonalRankAPI.java
deleted file mode 100644
index 01663322..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/PersonalRankAPI.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Traverser;
-import com.baidu.hugegraph.structure.traverser.Ranks;
-import org.apache.hugegraph.util.E;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class PersonalRankAPI extends TraversersAPI {
-
- public PersonalRankAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "personalrank";
- }
-
- public Ranks post(Request request) {
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(Ranks.class);
- }
-
- public static class Request {
-
- @JsonProperty("source")
- private Object source;
- @JsonProperty("label")
- private String label;
- @JsonProperty("alpha")
- private double alpha = Traverser.DEFAULT_ALPHA;
- @JsonProperty("max_degree")
- public long degree = Traverser.DEFAULT_MAX_DEGREE;
- @JsonProperty("limit")
- private int limit = Traverser.DEFAULT_LIMIT;
- @JsonProperty("max_depth")
- private int maxDepth = 5;
- @JsonProperty("with_label")
- private WithLabel withLabel = WithLabel.BOTH_LABEL;
- @JsonProperty("sorted")
- private boolean sorted = true;
-
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public String toString() {
- return String.format("Request{source=%s,label=%s,alpha=%s," +
- "degree=%s,limit=%s,maxDepth=%s," +
- "withLabel=%s,sorted=%s}",
- this.source, this.label, this.alpha,
- this.degree, this.limit, this.maxDepth,
- this.withLabel, this.sorted);
- }
-
- public enum WithLabel {
- SAME_LABEL,
- OTHER_LABEL,
- BOTH_LABEL
- }
-
- public static class Builder {
-
- private Request request;
-
- private Builder() {
- this.request = new Request();
- }
-
- public Builder source(Object source) {
- E.checkArgument(source != null, "The source of request " +
- "for personal rank can't be null");
- this.request.source = source;
- return this;
- }
-
- public Builder label(String label) {
- E.checkArgument(label != null, "The label of request " +
- "for personal rank can't be null");
- this.request.label = label;
- return this;
- }
-
- public Builder alpha(double alpha) {
- TraversersAPI.checkAlpha(alpha);
- this.request.alpha = alpha;
- return this;
- }
-
- public Builder degree(long degree) {
- TraversersAPI.checkDegree(degree);
- this.request.degree = degree;
- return this;
- }
-
- public Builder limit(int limit) {
- TraversersAPI.checkLimit(limit);
- this.request.limit = limit;
- return this;
- }
-
- public Builder maxDepth(int maxDepth) {
- E.checkArgument(maxDepth > 0 &&
- maxDepth <= Traverser.DEFAULT_MAX_DEPTH,
- "The max depth must be in range (0, %s], " +
- "but got: %s",
- Traverser.DEFAULT_MAX_DEPTH, maxDepth);
- this.request.maxDepth = maxDepth;
- return this;
- }
-
- public Builder withLabel(WithLabel withLabel) {
- this.request.withLabel = withLabel;
- return this;
- }
-
- public Builder sorted(boolean sorted) {
- this.request.sorted = sorted;
- return this;
- }
-
- public Request build() {
- E.checkArgument(this.request.source != null,
- "Source vertex can't be null");
- E.checkArgument(this.request.label != null,
- "The label of rank request " +
- "for personal rank can't be null");
- TraversersAPI.checkAlpha(this.request.alpha);
- TraversersAPI.checkDegree(this.request.degree);
- TraversersAPI.checkLimit(this.request.limit);
- E.checkArgument(this.request.maxDepth > 0 &&
- this.request.maxDepth <=
- Traverser.DEFAULT_MAX_DEPTH,
- "The max depth must be in range (0, %s], " +
- "but got: %s",
- Traverser.DEFAULT_MAX_DEPTH,
- this.request.maxDepth);
- return this.request;
- }
- }
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RaysAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RaysAPI.java
deleted file mode 100644
index 989f04de..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RaysAPI.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.graph.Path;
-
-public class RaysAPI extends TraversersAPI {
-
- public RaysAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "rays";
- }
-
- public List<Path> get(Object sourceId, Direction direction, String label,
- int depth, long degree, long capacity, int limit) {
- String source = GraphAPI.formatVertexId(sourceId, false);
-
- checkPositive(depth, "Max depth of path");
- checkDegree(degree);
- checkCapacity(capacity);
- checkLimit(limit);
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("source", source);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_depth", depth);
- params.put("max_degree", degree);
- params.put("capacity", capacity);
- params.put("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Path.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RingsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RingsAPI.java
deleted file mode 100644
index f175066b..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/RingsAPI.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.graph.Path;
-
-public class RingsAPI extends TraversersAPI {
-
- public RingsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "rings";
- }
-
- public List<Path> get(Object sourceId, Direction direction, String label,
- int depth, boolean sourceInRing, long degree,
- long capacity, int limit) {
- String source = GraphAPI.formatVertexId(sourceId, false);
-
- checkPositive(depth, "Max depth of path");
- checkDegree(degree);
- checkCapacity(capacity);
- checkLimit(limit);
-
- if (sourceInRing) {
- this.client.checkApiVersion("0.40",
- "source_in_ring arg of ring API");
- }
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("source", source);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_depth", depth);
- params.put("source_in_ring", sourceInRing);
- params.put("max_degree", degree);
- params.put("capacity", capacity);
- params.put("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Path.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SameNeighborsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SameNeighborsAPI.java
deleted file mode 100644
index fd0dac40..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SameNeighborsAPI.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-
-public class SameNeighborsAPI extends TraversersAPI {
-
- private static final String SAME_NEIGHBORS = "same_neighbors";
-
- public SameNeighborsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "sameneighbors";
- }
-
- public List<Object> get(Object vertexId, Object otherId,
- Direction direction, String label,
- long degree, int limit) {
- this.client.checkApiVersion("0.51", "same neighbors");
- String vertex = GraphAPI.formatVertexId(vertexId, false);
- String other = GraphAPI.formatVertexId(otherId, false);
- checkDegree(degree);
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("vertex", vertex);
- params.put("other", other);
- params.put("direction", direction);
- params.put("label", label);
- params.put("max_degree", degree);
- params.put("limit", limit);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(SAME_NEIGHBORS, Object.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/ShortestPathAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/ShortestPathAPI.java
deleted file mode 100644
index 0864aac2..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/ShortestPathAPI.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.graph.Path;
-
-public class ShortestPathAPI extends TraversersAPI {
-
- public ShortestPathAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "shortestpath";
- }
-
- public Path get(Object sourceId, Object targetId,
- Direction direction, String label, int maxDepth,
- long degree, long skipDegree, long capacity) {
- String source = GraphAPI.formatVertexId(sourceId, false);
- String target = GraphAPI.formatVertexId(targetId, false);
-
- checkPositive(maxDepth, "Max depth of shortest path");
- 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("max_depth", maxDepth);
- params.put("max_degree", degree);
- params.put("skip_degree", skipDegree);
- params.put("capacity", capacity);
- RestResult result = this.client.get(this.path(), params);
- List<Object> vertices = result.readList("path", Object.class);
- return new Path(vertices);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SingleSourceShortestPathAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SingleSourceShortestPathAPI.java
deleted file mode 100644
index d35d61b4..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/SingleSourceShortestPathAPI.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.traverser.WeightedPaths;
-import org.apache.hugegraph.util.E;
-
-public class SingleSourceShortestPathAPI extends TraversersAPI {
-
- public SingleSourceShortestPathAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "singlesourceshortestpath";
- }
-
- public WeightedPaths get(Object sourceId, Direction direction, String label,
- String weight, long degree, long skipDegree,
- long capacity, int limit, boolean withVertex) {
- this.client.checkApiVersion("0.51", "single source shortest path");
- String source = GraphAPI.formatVertexId(sourceId, false);
-
- E.checkNotNull(weight, "weight");
- checkDegree(degree);
- checkCapacity(capacity);
- checkSkipDegree(skipDegree, degree, capacity);
- checkLimit(limit);
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("source", source);
- 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("limit", limit);
- params.put("with_vertex", withVertex);
- RestResult result = this.client.get(this.path(), params);
- return result.readObject(WeightedPaths.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TemplatePathsAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TemplatePathsAPI.java
deleted file mode 100644
index 7b51bbc7..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TemplatePathsAPI.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.traverser.PathsWithVertices;
-import com.baidu.hugegraph.structure.traverser.TemplatePathsRequest;
-
-public class TemplatePathsAPI extends TraversersAPI {
-
- public TemplatePathsAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "templatepaths";
- }
-
- public PathsWithVertices post(TemplatePathsRequest request) {
- this.client.checkApiVersion("0.58", "template paths");
- RestResult result = this.client.post(this.path(), request);
- return result.readObject(PathsWithVertices.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TraversersAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TraversersAPI.java
deleted file mode 100644
index a360b5ef..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/TraversersAPI.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.util.E;
-
-public class TraversersAPI extends API {
-
- private static final String PATH = "graphs/%s/traversers/%s";
-
- public TraversersAPI(RestClient client, String graph) {
- super(client);
- this.path(PATH, graph, this.type());
- }
-
- @Override
- protected String type() {
- return "traversers";
- }
-
- public static void checkPositive(int value, String name) {
- E.checkArgument(value > 0,
- "%s must be > 0, but got '%s'", name, value);
- }
-
- public static void checkDegree(long degree) {
- checkLimit(degree, "Degree");
- }
-
- public static void checkCapacity(long capacity) {
- checkLimit(capacity, "Capacity");
- }
-
- public static void checkLimit(int limit) {
- checkLimit(limit, "Limit");
- }
-
- public static void checkAlpha(double alpha) {
- E.checkArgument(alpha > 0 && alpha <= 1.0,
- "The alpha of rank request must be in range (0, 1], " +
- "but got '%s'", alpha);
- }
-
- public static void checkSkipDegree(long skipDegree, long degree,
- long capacity) {
- E.checkArgument(skipDegree >= 0L,
- "The skipped degree must be >= 0, but got '%s'",
- skipDegree);
- if (capacity != NO_LIMIT) {
- E.checkArgument(degree != NO_LIMIT && degree < capacity,
- "The max degree must be < capacity");
- E.checkArgument(skipDegree < capacity,
- "The skipped degree must be < capacity");
- }
- if (skipDegree > 0L) {
- E.checkArgument(degree != NO_LIMIT && skipDegree >= degree,
- "The skipped degree must be >= max degree, " +
- "but got skipped degree '%s' and max degree '%s'",
- skipDegree, degree);
- }
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/VerticesAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/VerticesAPI.java
deleted file mode 100644
index da2a800c..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/VerticesAPI.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.graph.Shard;
-import com.baidu.hugegraph.structure.graph.Vertex;
-import com.baidu.hugegraph.structure.graph.Vertices;
-import org.apache.hugegraph.util.E;
-import com.google.common.collect.ImmutableMap;
-
-public class VerticesAPI extends TraversersAPI {
-
- public VerticesAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "vertices";
- }
-
- public List<Vertex> list(List<Object> ids) {
- E.checkArgument(ids != null && !ids.isEmpty(),
- "Ids can't be null or empty");
-
- List<String> stringIds = new ArrayList<>(ids.size());
- for (Object id : ids) {
- stringIds.add(GraphAPI.formatVertexId(id, false));
- }
-
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("ids", stringIds);
- RestResult result = this.client.get(this.path(), params);
- return result.readList(this.type(), Vertex.class);
- }
-
- public List<Shard> shards(long splitSize) {
- String path = String.join(PATH_SPLITOR, this.path(), "shards");
- Map<String, Object> params = ImmutableMap.of("split_size", splitSize);
- RestResult result = this.client.get(path, params);
- return result.readList("shards", Shard.class);
- }
-
- public Vertices scan(Shard shard, String page, long pageLimit) {
- E.checkArgument(shard != null, "Shard can't be null");
- String path = String.join(PATH_SPLITOR, this.path(), "scan");
- Map<String, Object> params = new LinkedHashMap<>();
- params.put("start", shard.start());
- params.put("end", shard.end());
- params.put("page", page);
- params.put("page_limit", pageLimit);
- RestResult result = this.client.get(path, params);
- return result.readObject(Vertices.class);
- }
-}
-
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/WeightedShortestPathAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/WeightedShortestPathAPI.java
deleted file mode 100644
index 3d51a366..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/traverser/WeightedShortestPathAPI.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.traverser;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graph.GraphAPI;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.traverser.WeightedPath;
-import org.apache.hugegraph.util.E;
-
-public class WeightedShortestPathAPI extends TraversersAPI {
-
- public WeightedShortestPathAPI(RestClient client, String graph) {
- super(client, graph);
- }
-
- @Override
- protected String type() {
- return "weightedshortestpath";
- }
-
- 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);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java
deleted file mode 100644
index 22fc4ec0..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.variables;
-
-import java.util.Map;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.google.common.collect.ImmutableMap;
-
-public class VariablesAPI extends API {
-
- private static final String PATH = "graphs/%s/%s";
-
- public VariablesAPI(RestClient client, String graph) {
- super(client);
- this.path(PATH, graph, this.type());
- }
-
- @Override
- protected String type() {
- return HugeType.VARIABLES.string();
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, Object> get(String key) {
- RestResult result = this.client.get(path(), key);
- return result.readObject(Map.class);
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, Object> set(String key, Object value) {
- value = ImmutableMap.of("data", value);
- RestResult result = this.client.put(this.path(), key, value);
- return result.readObject(Map.class);
- }
-
- public void remove(String key) {
- this.client.delete(path(), key);
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, Object> all() {
- RestResult result = this.client.get(path());
- return result.readObject(Map.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/version/VersionAPI.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/api/version/VersionAPI.java
deleted file mode 100644
index 729a23f0..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/api/version/VersionAPI.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.api.version;
-
-import com.baidu.hugegraph.api.API;
-import com.baidu.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.structure.constant.HugeType;
-import com.baidu.hugegraph.structure.version.Versions;
-
-public class VersionAPI extends API {
-
- public VersionAPI(RestClient client) {
- super(client);
- this.path(this.type());
- }
-
- @Override
- protected String type() {
- return HugeType.VERSION.string();
- }
-
- public Versions get() {
- RestResult result = this.client.get(this.path());
- return result.readObject(Versions.class);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/client/RestClient.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/client/RestClient.java
deleted file mode 100644
index 3ca04e9f..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/client/RestClient.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.client;
-
-import com.baidu.hugegraph.exception.ServerException;
-import org.apache.hugegraph.rest.AbstractRestClient;
-import org.apache.hugegraph.rest.ClientException;
-import org.apache.hugegraph.rest.RestResult;
-import com.baidu.hugegraph.serializer.PathDeserializer;
-import com.baidu.hugegraph.structure.graph.Path;
-import org.apache.hugegraph.util.E;
-import org.apache.hugegraph.util.VersionUtil;
-import org.apache.hugegraph.util.VersionUtil.Version;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import jakarta.ws.rs.core.Response;
-
-public class RestClient extends AbstractRestClient {
-
- private static final int SECOND = 1000;
-
- private Version apiVersion = null;
-
- static {
- SimpleModule module = new SimpleModule();
- module.addDeserializer(Path.class, new PathDeserializer());
- RestResult.registerModule(module);
- }
-
- public RestClient(String url, String username, String password,
- int timeout) {
- super(url, username, password, timeout * SECOND);
- }
-
- public RestClient(String url, String username, String password, int timeout,
- int maxConns, int maxConnsPerRoute,
- String trustStoreFile, String trustStorePassword) {
- super(url, username, password, timeout * SECOND, maxConns,
- maxConnsPerRoute, trustStoreFile, trustStorePassword);
- }
-
- public void apiVersion(Version version) {
- E.checkNotNull(version, "api version");
- this.apiVersion = version;
- }
-
- public Version apiVersion() {
- return this.apiVersion;
- }
-
- public void checkApiVersion(String minVersion, String message) {
- if (this.apiVersionLt(minVersion)) {
- throw new ClientException(
- "HugeGraphServer API version must be >= %s to support " +
- "%s, but current HugeGraphServer API version is: %s",
- minVersion, message, this.apiVersion.get());
- }
- }
-
- public boolean apiVersionLt(String minVersion) {
- String apiVersion = this.apiVersion == null ?
- null : this.apiVersion.get();
- return apiVersion != null && !VersionUtil.gte(apiVersion, minVersion);
- }
-
- @Override
- protected void checkStatus(Response response, Response.Status... statuses) {
- boolean match = false;
- for (Response.Status status : statuses) {
- if (status.getStatusCode() == response.getStatus()) {
- match = true;
- break;
- }
- }
- if (!match) {
- throw ServerException.fromResponse(response);
- }
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/AuthManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/AuthManager.java
deleted file mode 100644
index 356d1a43..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/AuthManager.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.collections.CollectionUtils;
-
-import com.baidu.hugegraph.api.auth.AccessAPI;
-import com.baidu.hugegraph.api.auth.BelongAPI;
-import com.baidu.hugegraph.api.auth.GroupAPI;
-import com.baidu.hugegraph.api.auth.LoginAPI;
-import com.baidu.hugegraph.api.auth.LogoutAPI;
-import com.baidu.hugegraph.api.auth.ProjectAPI;
-import com.baidu.hugegraph.api.auth.TargetAPI;
-import com.baidu.hugegraph.api.auth.TokenAPI;
-import com.baidu.hugegraph.api.auth.UserAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.auth.Access;
-import com.baidu.hugegraph.structure.auth.Belong;
-import com.baidu.hugegraph.structure.auth.Group;
-import com.baidu.hugegraph.structure.auth.Login;
-import com.baidu.hugegraph.structure.auth.LoginResult;
-import com.baidu.hugegraph.structure.auth.Project;
-import com.baidu.hugegraph.structure.auth.Target;
-import com.baidu.hugegraph.structure.auth.TokenPayload;
-import com.baidu.hugegraph.structure.auth.User;
-import com.baidu.hugegraph.structure.auth.User.UserRole;
-
-public class AuthManager {
-
- private final TargetAPI targetAPI;
- private final GroupAPI groupAPI;
- private final UserAPI userAPI;
- private final AccessAPI accessAPI;
- private final BelongAPI belongAPI;
- private final ProjectAPI projectAPI;
- private final LoginAPI loginAPI;
- private final LogoutAPI logoutAPI;
- private final TokenAPI tokenAPI;
-
- public AuthManager(RestClient client, String graph) {
- this.targetAPI = new TargetAPI(client, graph);
- this.groupAPI = new GroupAPI(client, graph);
- this.userAPI = new UserAPI(client, graph);
- this.accessAPI = new AccessAPI(client, graph);
- this.belongAPI = new BelongAPI(client, graph);
- this.projectAPI = new ProjectAPI(client, graph);
- this.loginAPI = new LoginAPI(client, graph);
- this.logoutAPI = new LogoutAPI(client, graph);
- this.tokenAPI = new TokenAPI(client, graph);
- }
-
- public List<Target> listTargets() {
- return this.listTargets(-1);
- }
-
- public List<Target> listTargets(int limit) {
- return this.targetAPI.list(limit);
- }
-
- public Target getTarget(Object id) {
- return this.targetAPI.get(id);
- }
-
- public Target createTarget(Target target) {
- return this.targetAPI.create(target);
- }
-
- public Target updateTarget(Target target) {
- return this.targetAPI.update(target);
- }
-
- public void deleteTarget(Object id) {
- this.targetAPI.delete(id);
- }
-
- public List<Group> listGroups() {
- return this.listGroups(-1);
- }
-
- public List<Group> listGroups(int limit) {
- return this.groupAPI.list(limit);
- }
-
- public Group getGroup(Object id) {
- return this.groupAPI.get(id);
- }
-
- public Group createGroup(Group group) {
- return this.groupAPI.create(group);
- }
-
- public Group updateGroup(Group group) {
- return this.groupAPI.update(group);
- }
-
- public void deleteGroup(Object id) {
- this.groupAPI.delete(id);
- }
-
- public List<User> listUsers() {
- return this.listUsers(-1);
- }
-
- public List<User> listUsers(int limit) {
- return this.userAPI.list(limit);
- }
-
- public User getUser(Object id) {
- return this.userAPI.get(id);
- }
-
- public UserRole getUserRole(Object id) {
- return this.userAPI.getUserRole(id);
- }
-
- public User createUser(User user) {
- return this.userAPI.create(user);
- }
-
- public User updateUser(User user) {
- return this.userAPI.update(user);
- }
-
- public void deleteUser(Object id) {
- this.userAPI.delete(id);
- }
-
- public List<Access> listAccesses() {
- return this.listAccesses(-1);
- }
-
- public List<Access> listAccesses(int limit) {
- return this.accessAPI.list(null, null, limit);
- }
-
- public List<Access> listAccessesByGroup(Object group, int limit) {
- return this.accessAPI.list(group, null, limit);
- }
-
- public List<Access> listAccessesByTarget(Object target, int limit) {
- return this.accessAPI.list(null, target, limit);
- }
-
- public Access getAccess(Object id) {
- return this.accessAPI.get(id);
- }
-
- public Access createAccess(Access access) {
- return this.accessAPI.create(access);
- }
-
- public Access updateAccess(Access access) {
- return this.accessAPI.update(access);
- }
-
- public void deleteAccess(Object id) {
- this.accessAPI.delete(id);
- }
-
- public List<Belong> listBelongs() {
- return this.listBelongs(-1);
- }
-
- public List<Belong> listBelongs(int limit) {
- return this.belongAPI.list(null, null, limit);
- }
-
- public List<Belong> listBelongsByUser(Object user, int limit) {
- return this.belongAPI.list(user, null, limit);
- }
-
- public List<Belong> listBelongsByGroup(Object group, int limit) {
- return this.belongAPI.list(null, group, limit);
- }
-
- public Belong getBelong(Object id) {
- return this.belongAPI.get(id);
- }
-
- public Belong createBelong(Belong belong) {
- return this.belongAPI.create(belong);
- }
-
- public Belong updateBelong(Belong belong) {
- return this.belongAPI.update(belong);
- }
-
- public void deleteBelong(Object id) {
- this.belongAPI.delete(id);
- }
-
- public void deleteAll() {
- for (Belong belong : this.listBelongs()) {
- this.deleteBelong(belong.id());
- }
- for (Access access : this.listAccesses()) {
- this.deleteAccess(access.id());
- }
-
- for (User user : this.listUsers()) {
- if (user.name().equals("admin")) {
- continue;
- }
- this.deleteUser(user.id());
- }
- for (Group group : this.listGroups()) {
- this.deleteGroup(group.id());
- }
- for (Target target : this.listTargets()) {
- this.deleteTarget(target.id());
- }
- for (Project project : this.listProjects()) {
- Set<String> graphs = project.graphs();
- if (CollectionUtils.isNotEmpty(graphs)) {
- this.projectRemoveGraphs(project.id(), graphs);
- }
- this.deleteProject(project.id());
- }
- }
-
- public Project createProject(Project project) {
- return this.projectAPI.create(project);
- }
-
- public Project getProject(Object id) {
- return this.projectAPI.get(id);
- }
-
- public List<Project> listProjects() {
- return this.listProject(-1);
- }
-
- public List<Project> listProject(int limit) {
- return this.projectAPI.list(limit);
- }
-
- public Project updateProject(Project project) {
- return this.projectAPI.update(project);
- }
-
- public Project projectAddGraphs(Object projectId, Set<String> graphs) {
- return this.projectAPI.addGraphs(projectId, graphs);
- }
-
- public Project projectRemoveGraphs(Object projectId, Set<String> graphs) {
- return this.projectAPI.removeGraphs(projectId, graphs);
- }
-
- public void deleteProject(Object id) {
- this.projectAPI.delete(id);
- }
-
- public LoginResult login(Login login) {
- return this.loginAPI.login(login);
- }
-
- public void logout() {
- this.logoutAPI.logout();
- }
-
- public TokenPayload verifyToken() {
- return this.tokenAPI.verifyToken();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/CypherManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/CypherManager.java
deleted file mode 100644
index a39333ce..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/CypherManager.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import com.baidu.hugegraph.api.gremlin.CypherAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.gremlin.Response;
-import com.baidu.hugegraph.structure.gremlin.ResultSet;
-
-public class CypherManager {
-
- private final GraphManager graphManager;
- private final CypherAPI cypherAPI;
-
- public CypherManager(RestClient client, String graph,
- GraphManager graphManager) {
- this.graphManager = graphManager;
- this.cypherAPI = new CypherAPI(client, graph);
- }
-
- public ResultSet execute(String cypher) {
- Response response = this.cypherAPI.post(cypher);
- response.graphManager(this.graphManager);
- // TODO: Can add some checks later
- return response.result();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GraphManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GraphManager.java
deleted file mode 100644
index 6c073818..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GraphManager.java
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.annotation.UnimplementedFeature;
-import com.baidu.hugegraph.api.graph.EdgeAPI;
-import com.baidu.hugegraph.api.graph.VertexAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.exception.InvalidOperationException;
-import com.baidu.hugegraph.structure.GraphElement;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.constant.T;
-import com.baidu.hugegraph.structure.graph.BatchEdgeRequest;
-import com.baidu.hugegraph.structure.graph.BatchOlapPropertyRequest;
-import com.baidu.hugegraph.structure.graph.BatchVertexRequest;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.graph.GraphIterator;
-import com.baidu.hugegraph.structure.graph.Vertex;
-import org.apache.hugegraph.util.E;
-
-public class GraphManager {
-
- private final String graph;
- private final VertexAPI vertexAPI;
- private final EdgeAPI edgeAPI;
-
- public GraphManager(RestClient client, String graph) {
- this.graph = graph;
- this.vertexAPI = new VertexAPI(client, graph);
- this.edgeAPI = new EdgeAPI(client, graph);
- }
-
- public String graph() {
- return this.graph;
- }
-
- public Vertex addVertex(Vertex vertex) {
- vertex = this.vertexAPI.create(vertex);
- this.attachManager(vertex);
- return vertex;
- }
-
- public Vertex addVertex(Object... keyValues) {
- Object label = this.getValue(T.LABEL, keyValues);
- if (!(label instanceof String)) {
- throw new IllegalArgumentException(String.format(
- "Expect a string value as the vertex label " +
- "argument, but got: %s", label));
- }
- Vertex vertex = new Vertex(String.valueOf(label));
- vertex.id(this.getValue(T.ID, keyValues));
- this.attachProperties(vertex, keyValues);
- return this.addVertex(vertex);
- }
-
- public Vertex addVertex(String label, Map<String, Object> properties) {
- return this.addVertex(label, null, properties);
- }
-
- public Vertex addVertex(String label, Object id,
- Map<String, Object> properties) {
- Vertex vertex = new Vertex(label);
- vertex.id(id);
- this.attachProperties(vertex, properties);
- return this.addVertex(vertex);
- }
-
- public Vertex getVertex(Object vertexId) {
- Vertex vertex = this.vertexAPI.get(vertexId);
- this.attachManager(vertex);
- return vertex;
- }
-
- public List<Vertex> addVertices(List<Vertex> vertices) {
- List<Object> ids = this.vertexAPI.create(vertices);
- for (int i = 0; i < vertices.size(); i++) {
- Vertex vertex = vertices.get(i);
- vertex.id(ids.get(i));
- this.attachManager(vertex);
- }
- return vertices;
- }
-
- public List<Vertex> listVertices() {
- return this.listVertices(-1);
- }
-
- public List<Vertex> listVertices(int limit) {
- return this.listVertices(null, null, false, 0, limit);
- }
-
- public List<Vertex> listVertices(int offset, int limit) {
- return this.listVertices(null, null, false, offset, limit);
- }
-
- public List<Vertex> listVertices(String label) {
- return this.listVertices(label, null, false, 0, -1);
- }
-
- public List<Vertex> listVertices(String label, int limit) {
- return this.listVertices(label, null, false, 0, limit);
- }
-
- public List<Vertex> listVertices(String label,
- Map<String, Object> properties) {
- return this.listVertices(label, properties, false, 0, -1);
- }
-
- public List<Vertex> listVertices(String label,
- Map<String, Object> properties,
- int limit) {
- return this.listVertices(label, properties, false, 0, limit);
- }
-
- public List<Vertex> listVertices(String label,
- Map<String, Object> properties,
- boolean keepP) {
- return this.listVertices(label, properties, keepP, 0, -1);
- }
-
- public List<Vertex> listVertices(String label,
- Map<String, Object> properties,
- boolean keepP,
- int limit) {
- return this.listVertices(label, properties, keepP, 0, limit);
- }
-
- public List<Vertex> listVertices(String label,
- Map<String, Object> properties,
- int offset,
- int limit) {
- return this.listVertices(label, properties, false, offset, limit);
- }
-
- public List<Vertex> listVertices(String label,
- Map<String, Object> properties,
- boolean keepP,
- int offset,
- int limit) {
- List<Vertex> vertices = this.vertexAPI.list(label, properties, keepP,
- offset, null, limit)
- .results();
- for (Vertex vertex : vertices) {
- this.attachManager(vertex);
- }
- return vertices;
- }
-
- public Iterator<Vertex> iterateVertices(int sizePerPage) {
- return this.iterateVertices(null, null, sizePerPage);
- }
-
- public Iterator<Vertex> iterateVertices(String label, int sizePerPage) {
- return this.iterateVertices(label, null, sizePerPage);
- }
-
- public Iterator<Vertex> iterateVertices(String label,
- Map<String, Object> properties,
- int sizePerPage) {
- return new GraphIterator<>(this, sizePerPage, (page) -> {
- return this.vertexAPI.list(label, properties, 0, page, sizePerPage);
- });
- }
-
- public void removeVertex(Object vertexId) {
- this.vertexAPI.delete(vertexId);
- }
-
- public List<Vertex> updateVertices(BatchVertexRequest request) {
- List<Vertex> newVertices = this.vertexAPI.update(request);
- newVertices.forEach(vertex -> this.attachManager(vertex));
- return newVertices;
- }
-
- public int updateVertices(BatchOlapPropertyRequest request) {
- return this.vertexAPI.update(request);
- }
-
- public Vertex appendVertexProperty(Vertex vertex) {
- vertex = this.vertexAPI.append(vertex);
- this.attachManager(vertex);
- return vertex;
- }
-
- public Vertex eliminateVertexProperty(Vertex vertex) {
- vertex = this.vertexAPI.eliminate(vertex);
- this.attachManager(vertex);
- return vertex;
- }
-
- public Edge addEdge(Edge edge) {
- if (edge.id() != null) {
- throw new InvalidOperationException(
- "Not allowed to custom id for edge: '%s'", edge);
- }
- edge = this.edgeAPI.create(edge);
- this.attachManager(edge);
- return edge;
- }
-
- public Edge addEdge(Vertex source, String label, Vertex target,
- Object... properties) {
- return this.addEdge(source.id(), label, target.id(), properties);
- }
-
- public Edge addEdge(Object sourceId, String label, Object targetId,
- Object... properties) {
- Edge edge = new Edge(label);
- edge.sourceId(sourceId);
- edge.targetId(targetId);
- this.attachProperties(edge, properties);
- return this.addEdge(edge);
- }
-
- public Edge addEdge(Vertex source, String label, Vertex target,
- Map<String, Object> properties) {
- return this.addEdge(source.id(), label, target.id(), properties);
- }
-
- public Edge addEdge(Object sourceId, String label, Object targetId,
- Map<String, Object> properties) {
- Edge edge = new Edge(label);
- edge.sourceId(sourceId);
- edge.targetId(targetId);
- this.attachProperties(edge, properties);
- return this.addEdge(edge);
- }
-
- public Edge getEdge(String edgeId) {
- Edge edge = this.edgeAPI.get(edgeId);
- this.attachManager(edge);
- return edge;
- }
-
- public List<Edge> addEdges(List<Edge> edges) {
- return this.addEdges(edges, true);
- }
-
- public List<Edge> addEdges(List<Edge> edges, boolean checkVertex) {
- for (Edge edge : edges) {
- edge.sourceId();
- edge.targetId();
- }
- List<String> ids = this.edgeAPI.create(edges, checkVertex);
- for (int i = 0; i < edges.size(); i++) {
- Edge edge = edges.get(i);
- edge.id(ids.get(i));
- this.attachManager(edge);
- }
- return edges;
- }
-
- public List<Edge> listEdges() {
- return this.listEdges(-1);
- }
-
- public List<Edge> listEdges(int limit) {
- return this.getEdges(null, null, null, null, 0, limit);
- }
-
- public List<Edge> listEdges(int offset, int limit) {
- return this.getEdges(null, null, null, null, offset, limit);
- }
-
- public List<Edge> listEdges(String label) {
- return this.getEdges(null, null, label, null, 0, -1);
- }
-
- public List<Edge> listEdges(String label, int limit) {
- return this.getEdges(null, null, label, null, 0, limit);
- }
-
- public List<Edge> listEdges(String label,
- Map<String, Object> properties) {
- return this.getEdges(null, null, label, properties, 0, -1);
- }
-
- public List<Edge> listEdges(String label,
- Map<String, Object> properties,
- int limit) {
- return this.getEdges(null, null, label, properties, 0, limit);
- }
-
- public List<Edge> listEdges(String label,
- Map<String, Object> properties,
- boolean keepP) {
- return this.getEdges(null, null, label, properties, keepP, 0, -1);
- }
-
- public List<Edge> listEdges(String label,
- Map<String, Object> properties,
- boolean keepP,
- int limit) {
- return this.getEdges(null, null, label, properties, keepP, 0, limit);
- }
-
- public List<Edge> getEdges(Object vertexId) {
- return this.getEdges(vertexId, Direction.BOTH, null, null, 0, -1);
- }
-
- public List<Edge> getEdges(Object vertexId, int limit) {
- return this.getEdges(vertexId, Direction.BOTH, null, null, 0, limit);
- }
-
- public List<Edge> getEdges(Object vertexId, Direction direction) {
- return this.getEdges(vertexId, direction, null, null, 0, -1);
- }
-
- public List<Edge> getEdges(Object vertexId,
- Direction direction,
- int limit) {
- return this.getEdges(vertexId, direction, null, null, 0, limit);
- }
-
- public List<Edge> getEdges(Object vertexId,
- Direction direction,
- String label) {
- return this.getEdges(vertexId, direction, label, null, 0, -1);
- }
-
- public List<Edge> getEdges(Object vertexId,
- Direction direction,
- String label,
- int limit) {
- return this.getEdges(vertexId, direction, label, null, 0, limit);
- }
-
- public List<Edge> getEdges(Object vertexId,
- Direction direction,
- String label,
- Map<String, Object> properties) {
- return this.getEdges(vertexId, direction, label, properties, 0, -1);
- }
-
- public List<Edge> getEdges(Object vertexId,
- Direction direction,
- String label,
- Map<String, Object> properties,
- int offset,
- int limit) {
- return this.getEdges(vertexId, direction, label, properties, false,
- offset, limit);
- }
-
- public List<Edge> getEdges(Object vertexId,
- Direction direction,
- String label,
- Map<String, Object> properties,
- boolean keepP,
- int offset,
- int limit) {
- List<Edge> edges = this.edgeAPI.list(vertexId, direction, label,
- properties, keepP,
- offset, null, limit)
- .results();
- for (Edge edge : edges) {
- this.attachManager(edge);
- }
- return edges;
- }
-
- public Iterator<Edge> iterateEdges(int sizePerPage) {
- return this.iterateEdges(null, (Map<String, Object>) null, sizePerPage);
- }
-
- @UnimplementedFeature(desc = "Server doesn't support paging by label")
- public Iterator<Edge> iterateEdges(String label, int sizePerPage) {
- return this.iterateEdges(label, (Map<String, Object>) null, sizePerPage);
- }
-
- @UnimplementedFeature(desc = "Server doesn't support paging by label and properties")
- public Iterator<Edge> iterateEdges(String label,
- Map<String, Object> properties,
- int sizePerPage) {
- return new GraphIterator<>(this, sizePerPage, (page) -> {
- return this.edgeAPI.list(null, null, label, properties,
- 0, page, sizePerPage);
- });
- }
-
- public Iterator<Edge> iterateEdges(Object vertexId, int sizePerPage) {
- return this.iterateEdges(vertexId, Direction.BOTH, null, null,
- sizePerPage);
- }
-
- public Iterator<Edge> iterateEdges(Object vertexId,
- Direction direction,
- int sizePerPage) {
- return this.iterateEdges(vertexId, direction, null, null, sizePerPage);
- }
-
- public Iterator<Edge> iterateEdges(Object vertexId,
- Direction direction,
- String label,
- int sizePerPage) {
- return this.iterateEdges(vertexId, direction, label, null, sizePerPage);
- }
-
- public Iterator<Edge> iterateEdges(Object vertexId,
- Direction direction,
- String label,
- Map<String, Object> properties,
- int sizePerPage) {
- return new GraphIterator<>(this, sizePerPage, (page) -> {
- return this.edgeAPI.list(vertexId, direction, label, properties,
- 0, page, sizePerPage);
- });
- }
-
- public void removeEdge(String edgeId) {
- this.edgeAPI.delete(edgeId);
- }
-
- public List<Edge> updateEdges(BatchEdgeRequest request) {
- List<Edge> newEdges = this.edgeAPI.update(request);
- newEdges.forEach(edge -> this.attachManager(edge));
- return newEdges;
- }
-
- public Edge appendEdgeProperty(Edge edge) {
- edge = this.edgeAPI.append(edge);
- this.attachManager(edge);
- return edge;
- }
-
- public Edge eliminateEdgeProperty(Edge edge) {
- edge = this.edgeAPI.eliminate(edge);
- this.attachManager(edge);
- return edge;
- }
-
- private Object getValue(String key, Object... keyValues) {
- E.checkArgument((keyValues.length & 0x01) == 0,
- "The number of parameters must be even");
- Object value = null;
- for (int i = 0; i < keyValues.length; i = i + 2) {
- if (keyValues[i].equals(key)) {
- value = keyValues[i + 1];
- break;
- }
- }
- return value;
- }
-
- private void attachProperties(GraphElement element, Object... properties) {
- E.checkArgument((properties.length & 0x01) == 0,
- "The number of properties must be even");
- for (int i = 0; i < properties.length; i = i + 2) {
- if (!properties[i].equals(T.ID) &&
- !properties[i].equals(T.LABEL)) {
- element.property((String) properties[i], properties[i + 1]);
- }
- }
- }
-
- private void attachProperties(GraphElement element,
- Map<String, Object> properties) {
- if (properties != null) {
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
- element.property(entry.getKey(), entry.getValue());
- }
- }
- }
-
- private void attachManager(GraphElement element) {
- element.attachManager(this);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GraphsManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GraphsManager.java
deleted file mode 100644
index bbb933ad..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GraphsManager.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.graphs.GraphsAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.constant.GraphMode;
-import com.baidu.hugegraph.structure.constant.GraphReadMode;
-
-public class GraphsManager {
-
- private GraphsAPI graphsAPI;
-
- public GraphsManager(RestClient client) {
- this.graphsAPI = new GraphsAPI(client);
- }
-
- public Map<String, String> createGraph(String name, String configText) {
- return this.graphsAPI.create(name, null, configText);
- }
-
- public Map<String, String> cloneGraph(String name, String cloneGraphName) {
- return this.graphsAPI.create(name, cloneGraphName, null);
- }
-
- public Map<String, String> cloneGraph(String name, String cloneGraphName,
- String configText) {
- return this.graphsAPI.create(name, cloneGraphName, configText);
- }
-
- public Map<String, String> getGraph(String graph) {
- return this.graphsAPI.get(graph);
- }
-
- public List<String> listGraph() {
- return this.graphsAPI.list();
- }
-
- public void clearGraph(String graph, String message) {
- this.graphsAPI.clear(graph, message);
- }
-
- public void dropGraph(String graph, String message) {
- this.graphsAPI.drop(graph, message);
- }
-
- public void mode(String graph, GraphMode mode) {
- this.graphsAPI.mode(graph, mode);
- }
-
- public GraphMode mode(String graph) {
- return this.graphsAPI.mode(graph);
- }
-
- public void readMode(String graph, GraphReadMode readMode) {
- this.graphsAPI.readMode(graph, readMode);
- }
-
- public GraphReadMode readMode(String graph) {
- return this.graphsAPI.readMode(graph);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GremlinManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GremlinManager.java
deleted file mode 100644
index e52d1ae8..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/GremlinManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import com.baidu.hugegraph.api.gremlin.GremlinAPI;
-import com.baidu.hugegraph.api.gremlin.GremlinRequest;
-import com.baidu.hugegraph.api.job.GremlinJobAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.gremlin.Response;
-import com.baidu.hugegraph.structure.gremlin.ResultSet;
-
-public class GremlinManager {
-
- private final GraphManager graphManager;
-
- private GremlinAPI gremlinAPI;
- private GremlinJobAPI gremlinJobAPI;
- private String graph;
-
- public GremlinManager(RestClient client, String graph,
- GraphManager graphManager) {
- this.graphManager = graphManager;
- this.gremlinAPI = new GremlinAPI(client);
- this.gremlinJobAPI = new GremlinJobAPI(client, graph);
- this.graph = graph;
- }
-
- public ResultSet execute(GremlinRequest request) {
- // Bind "graph" to all graphs
- request.aliases.put("graph", this.graph);
- // Bind "g" to all graphs by custom rule which define in gremlin server.
- request.aliases.put("g", "__g_" + this.graph);
-
- Response response = this.gremlinAPI.post(request);
- response.graphManager(this.graphManager);
- // TODO: Can add some checks later
- return response.result();
- }
-
- public long executeAsTask(GremlinRequest request) {
- return this.gremlinJobAPI.execute(request);
- }
-
- public GremlinRequest.Builder gremlin(String gremlin) {
- return new GremlinRequest.Builder(gremlin, this);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/HugeClient.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/HugeClient.java
deleted file mode 100644
index 3ce73e29..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/HugeClient.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import java.io.Closeable;
-
-import com.baidu.hugegraph.client.RestClient;
-
-import org.apache.hugegraph.rest.ClientException;
-import org.apache.hugegraph.util.VersionUtil;
-
-import com.baidu.hugegraph.version.ClientVersion;
-
-import jakarta.ws.rs.ProcessingException;
-
-public class HugeClient implements Closeable {
-
- static {
- ClientVersion.check();
- }
-
- private final RestClient client;
- private final boolean borrowedClient;
-
- private VersionManager version;
- private GraphsManager graphs;
- private SchemaManager schema;
- private GraphManager graph;
- private GremlinManager gremlin;
- private CypherManager cypher;
- private TraverserManager traverser;
- private VariablesManager variable;
- private JobManager job;
- private TaskManager task;
- private AuthManager auth;
- private MetricsManager metrics;
-
- public HugeClient(HugeClientBuilder builder) {
- this.borrowedClient = false;
- try {
- this.client = new RestClient(builder.url(),
- builder.username(),
- builder.password(),
- builder.timeout(),
- builder.maxConns(),
- builder.maxConnsPerRoute(),
- builder.trustStoreFile(),
- builder.trustStorePassword());
- } catch (ProcessingException e) {
- throw new ClientException("Failed to connect url '%s'", builder.url());
- }
- try {
- this.initManagers(this.client, builder.graph());
- } catch (Throwable e) {
- this.client.close();
- throw e;
- }
- }
-
- public HugeClient(HugeClient client, String graph) {
- this.borrowedClient = true;
- this.client = client.client;
- this.initManagers(this.client, graph);
- }
-
- public static HugeClientBuilder builder(String url, String graph) {
- return new HugeClientBuilder(url, graph);
- }
-
- @Override
- public void close() {
- if (!this.borrowedClient) {
- this.client.close();
- }
- }
-
- private void initManagers(RestClient client, String graph) {
- assert client != null;
- // Check hugegraph-server api version
- this.version = new VersionManager(client);
- this.checkServerApiVersion();
-
- this.graphs = new GraphsManager(client);
- this.schema = new SchemaManager(client, graph);
- this.graph = new GraphManager(client, graph);
- this.gremlin = new GremlinManager(client, graph, this.graph);
- this.cypher = new CypherManager(client, graph, this.graph);
- this.traverser = new TraverserManager(client, this.graph);
- this.variable = new VariablesManager(client, graph);
- this.job = new JobManager(client, graph);
- this.task = new TaskManager(client, graph);
- this.auth = new AuthManager(client, graph);
- this.metrics = new MetricsManager(client);
- }
-
- private void checkServerApiVersion() {
- VersionUtil.Version apiVersion = VersionUtil.Version.of(this.version.getApiVersion());
- VersionUtil.check(apiVersion, "0.38", "0.70", "hugegraph-api in server");
- this.client.apiVersion(apiVersion);
- }
-
- public GraphsManager graphs() {
- return this.graphs;
- }
-
- public SchemaManager schema() {
- return this.schema;
- }
-
- public GraphManager graph() {
- return this.graph;
- }
-
- public GremlinManager gremlin() {
- return this.gremlin;
- }
-
- public CypherManager cypher() {
- return this.cypher;
- }
-
- public TraverserManager traverser() {
- return this.traverser;
- }
-
- public VariablesManager variables() {
- return this.variable;
- }
-
- public JobManager job() {
- return this.job;
- }
-
- public TaskManager task() {
- return this.task;
- }
-
- public AuthManager auth() {
- return this.auth;
- }
-
- public MetricsManager metrics() {
- return this.metrics;
- }
-
- public void setAuthContext(String auth) {
- this.client.setAuthContext(auth);
- }
-
- public String getAuthContext() {
- return this.client.getAuthContext();
- }
-
- public void resetAuthContext() {
- this.client.resetAuthContext();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/HugeClientBuilder.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/HugeClientBuilder.java
deleted file mode 100644
index 6fefb306..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/HugeClientBuilder.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import org.apache.hugegraph.util.E;
-
-public class HugeClientBuilder {
-
- private static final int CPUS = Runtime.getRuntime().availableProcessors();
- private static final int DEFAULT_TIMEOUT = 20;
- private static final int DEFAULT_MAX_CONNS = 4 * CPUS;
- private static final int DEFAULT_MAX_CONNS_PER_ROUTE = 2 * CPUS;
- private static final int DEFAULT_IDLE_TIME = 30;
-
- private String url;
- private String graph;
- private String username;
- private String password;
- private int timeout;
- private int maxConns;
- private int maxConnsPerRoute;
- private int idleTime;
- private String trustStoreFile;
- private String trustStorePassword;
-
- public HugeClientBuilder(String url, String graph) {
- E.checkArgument(url != null && !url.isEmpty(),
- "Expect a string value as the url " +
- "parameter argument, but got: %s", url);
- E.checkArgument(graph != null && !graph.isEmpty(),
- "Expect a string value as the graph name " +
- "parameter argument, but got: %s", graph);
- this.url = url;
- this.graph = graph;
- this.username = "";
- this.password = "";
- this.timeout = DEFAULT_TIMEOUT;
- this.maxConns = DEFAULT_MAX_CONNS;
- this.maxConnsPerRoute = DEFAULT_MAX_CONNS_PER_ROUTE;
- this.trustStoreFile = "";
- this.trustStorePassword = "";
- this.idleTime = DEFAULT_IDLE_TIME;
- }
-
- public HugeClient build() {
- E.checkArgument(this.url != null,
- "The url parameter can't be null");
- E.checkArgument(this.graph != null,
- "The graph parameter can't be null");
- return new HugeClient(this);
- }
-
- public HugeClientBuilder configGraph(String graph) {
- this.graph = graph;
- return this;
- }
-
- public HugeClientBuilder configIdleTime(int idleTime) {
- E.checkArgument(idleTime > 0,
- "The idleTime parameter must be > 0, " +
- "but got %s", idleTime);
- this.idleTime = idleTime;
- return this;
- }
-
- public HugeClientBuilder configPool(int maxConns, int maxConnsPerRoute) {
- if (maxConns == 0) {
- maxConns = DEFAULT_MAX_CONNS;
- }
- if (maxConnsPerRoute == 0) {
- maxConnsPerRoute = DEFAULT_MAX_CONNS_PER_ROUTE;
- }
- this.maxConns = maxConns;
- this.maxConnsPerRoute = maxConnsPerRoute;
- return this;
- }
-
- public HugeClientBuilder configSSL(String trustStoreFile,
- String trustStorePassword) {
- this.trustStoreFile = trustStoreFile;
- this.trustStorePassword = trustStorePassword;
- return this;
- }
-
- public HugeClientBuilder configTimeout(int timeout) {
- if (timeout == 0) {
- timeout = DEFAULT_TIMEOUT;
- }
- this.timeout = timeout;
- return this;
- }
-
- public HugeClientBuilder configUrl(String url) {
- this.url = url;
- return this;
- }
-
- public HugeClientBuilder configUser(String username, String password) {
- if (username == null) {
- username = "";
- }
- if (password == null) {
- password = "";
- }
- this.username = username;
- this.password = password;
-
- return this;
- }
-
- public String url() {
- return this.url;
- }
-
- public String graph() {
- return this.graph;
- }
-
- public String username() {
- return this.username;
- }
-
- public String password() {
- return this.password;
- }
-
- public int timeout() {
- return this.timeout;
- }
-
- public int maxConns() {
- return maxConns;
- }
-
- public int maxConnsPerRoute() {
- return this.maxConnsPerRoute;
- }
-
- public int idleTime() {
- return this.idleTime;
- }
-
- public String trustStoreFile() {
- return this.trustStoreFile;
- }
-
- public String trustStorePassword() {
- return this.trustStorePassword;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/JobManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/JobManager.java
deleted file mode 100644
index 7fb440cf..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/JobManager.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import com.baidu.hugegraph.api.job.RebuildAPI;
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.schema.EdgeLabel;
-import com.baidu.hugegraph.structure.schema.IndexLabel;
-import com.baidu.hugegraph.structure.schema.VertexLabel;
-
-import static com.baidu.hugegraph.api.task.TaskAPI.TASK_TIMEOUT;
-
-public class JobManager {
-
- private RebuildAPI rebuildAPI;
- private TaskAPI taskAPI;
-
- public JobManager(RestClient client, String graph) {
- this.rebuildAPI = new RebuildAPI(client, graph);
- this.taskAPI = new TaskAPI(client, graph);
- }
-
- public void rebuild(VertexLabel vertexLabel) {
- this.rebuild(vertexLabel, TASK_TIMEOUT);
- }
-
- public void rebuild(VertexLabel vertexLabel, long seconds) {
- long task = this.rebuildAPI.rebuild(vertexLabel);
- this.taskAPI.waitUntilTaskSuccess(task, seconds);
- }
-
- public long rebuildAsync(VertexLabel vertexLabel) {
- return this.rebuildAPI.rebuild(vertexLabel);
- }
-
- public void rebuild(EdgeLabel edgeLabel) {
- this.rebuild(edgeLabel, TASK_TIMEOUT);
- }
-
- public void rebuild(EdgeLabel edgeLabel, long seconds) {
- long task = this.rebuildAPI.rebuild(edgeLabel);
- this.taskAPI.waitUntilTaskSuccess(task, seconds);
- }
-
- public long rebuildAsync(EdgeLabel edgeLabel) {
- return this.rebuildAPI.rebuild(edgeLabel);
- }
-
- public void rebuild(IndexLabel indexLabel) {
- this.rebuild(indexLabel, TASK_TIMEOUT);
- }
-
- public void rebuild(IndexLabel indexLabel, long seconds) {
- long task = this.rebuildAPI.rebuild(indexLabel);
- this.taskAPI.waitUntilTaskSuccess(task, seconds);
- }
-
- public long rebuildAsync(IndexLabel indexLabel) {
- return this.rebuildAPI.rebuild(indexLabel);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/MetricsManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/MetricsManager.java
deleted file mode 100644
index 474fa2d3..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/MetricsManager.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import java.util.Map;
-
-import com.baidu.hugegraph.api.metrics.MetricsAPI;
-import com.baidu.hugegraph.client.RestClient;
-
-public class MetricsManager {
-
- private MetricsAPI metricsAPI;
-
- public MetricsManager(RestClient client) {
- this.metricsAPI = new MetricsAPI(client);
- }
-
- public Map<String, Map<String, Object>> backend() {
- return this.metricsAPI.backend();
- }
-
- public Map<String, Object> backend(String graph) {
- return this.metricsAPI.backend(graph);
- }
-
- public Map<String, Map<String, Object>> system() {
- return this.metricsAPI.system();
- }
-
- /**
- * The nesting level is too deep, may need to optimize the server first
- */
- public Map<String, Map<String, Object>> all() {
- return this.metricsAPI.all();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/SchemaManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/SchemaManager.java
deleted file mode 100644
index cee6f5d1..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/SchemaManager.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import static com.baidu.hugegraph.api.task.TaskAPI.TASK_TIMEOUT;
-
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.schema.EdgeLabelAPI;
-import com.baidu.hugegraph.api.schema.IndexLabelAPI;
-import com.baidu.hugegraph.api.schema.PropertyKeyAPI;
-import com.baidu.hugegraph.api.schema.SchemaAPI;
-import com.baidu.hugegraph.api.schema.VertexLabelAPI;
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.SchemaElement;
-import com.baidu.hugegraph.structure.schema.BuilderProxy;
-import com.baidu.hugegraph.structure.schema.EdgeLabel;
-import com.baidu.hugegraph.structure.schema.IndexLabel;
-import com.baidu.hugegraph.structure.schema.PropertyKey;
-import com.baidu.hugegraph.structure.schema.VertexLabel;
-
-public class SchemaManager {
-
- private PropertyKeyAPI propertyKeyAPI;
- private VertexLabelAPI vertexLabelAPI;
- private EdgeLabelAPI edgeLabelAPI;
- private IndexLabelAPI indexLabelAPI;
- private SchemaAPI schemaAPI;
- private TaskAPI taskAPI;
-
- public SchemaManager(RestClient client, String graph) {
- this.propertyKeyAPI = new PropertyKeyAPI(client, graph);
- this.vertexLabelAPI = new VertexLabelAPI(client, graph);
- this.edgeLabelAPI = new EdgeLabelAPI(client, graph);
- this.indexLabelAPI = new IndexLabelAPI(client, graph);
- this.schemaAPI = new SchemaAPI(client, graph);
- this.taskAPI = new TaskAPI(client, graph);
- }
-
- public PropertyKey.Builder propertyKey(String name) {
- PropertyKey.Builder builder = new PropertyKey.BuilderImpl(name, this);
- BuilderProxy<PropertyKey.Builder> proxy = new BuilderProxy<>(builder);
- return proxy.proxy();
- }
-
- public VertexLabel.Builder vertexLabel(String name) {
- VertexLabel.Builder builder = new VertexLabel.BuilderImpl(name, this);
- BuilderProxy<VertexLabel.Builder> proxy = new BuilderProxy<>(builder);
- return proxy.proxy();
- }
-
- public EdgeLabel.Builder edgeLabel(String name) {
- EdgeLabel.Builder builder = new EdgeLabel.BuilderImpl(name, this);
- BuilderProxy<EdgeLabel.Builder> proxy = new BuilderProxy<>(builder);
- return proxy.proxy();
- }
-
- public IndexLabel.Builder indexLabel(String name) {
- IndexLabel.Builder builder = new IndexLabel.BuilderImpl(name, this);
- BuilderProxy<IndexLabel.Builder> proxy = new BuilderProxy<>(builder);
- return proxy.proxy();
- }
-
- public PropertyKey addPropertyKey(PropertyKey propertyKey) {
- return this.addPropertyKey(propertyKey, TASK_TIMEOUT);
- }
-
- public PropertyKey addPropertyKey(PropertyKey propertyKey, long seconds) {
- PropertyKey.PropertyKeyWithTask task = this.propertyKeyAPI
- .create(propertyKey);
- if (task.taskId() != 0L) {
- this.taskAPI.waitUntilTaskSuccess(task.taskId(), seconds);
- }
- return task.propertyKey();
- }
-
- public long addPropertyKeyAsync(PropertyKey propertyKey) {
- PropertyKey.PropertyKeyWithTask task = this.propertyKeyAPI
- .create(propertyKey);
- return task.taskId();
- }
-
- public PropertyKey appendPropertyKey(PropertyKey propertyKey) {
- return this.propertyKeyAPI.append(propertyKey).propertyKey();
- }
-
- public PropertyKey eliminatePropertyKey(PropertyKey propertyKey) {
- return this.propertyKeyAPI.eliminate(propertyKey).propertyKey();
- }
-
- public PropertyKey clearPropertyKey(PropertyKey propertyKey) {
- return this.clearPropertyKey(propertyKey, TASK_TIMEOUT);
- }
-
- public PropertyKey clearPropertyKey(PropertyKey propertyKey, long seconds) {
- PropertyKey.PropertyKeyWithTask task = this.propertyKeyAPI
- .clear(propertyKey);
- if (task.taskId() != 0L) {
- this.taskAPI.waitUntilTaskSuccess(task.taskId(), seconds);
- }
- return task.propertyKey();
- }
-
- public long clearPropertyKeyAsync(PropertyKey propertyKey) {
- PropertyKey.PropertyKeyWithTask task = this.propertyKeyAPI
- .clear(propertyKey);
- return task.taskId();
- }
-
- public void removePropertyKey(String name) {
- this.removePropertyKey(name, TASK_TIMEOUT);
- }
-
- public void removePropertyKey(String name, long seconds) {
- long task = this.propertyKeyAPI.delete(name);
- this.taskAPI.waitUntilTaskSuccess(task, seconds);
- }
-
- public long removePropertyKeyAsync(String name) {
- return this.propertyKeyAPI.delete(name);
- }
-
- public PropertyKey getPropertyKey(String name) {
- return this.propertyKeyAPI.get(name);
- }
-
- public List<PropertyKey> getPropertyKeys() {
- return this.propertyKeyAPI.list();
- }
-
- public List<PropertyKey> getPropertyKeys(List<String> names) {
- return this.propertyKeyAPI.list(names);
- }
-
- public VertexLabel addVertexLabel(VertexLabel vertexLabel) {
- return this.vertexLabelAPI.create(vertexLabel);
- }
-
- public VertexLabel appendVertexLabel(VertexLabel vertexLabel) {
- return this.vertexLabelAPI.append(vertexLabel);
- }
-
- public VertexLabel eliminateVertexLabel(VertexLabel vertexLabel) {
- return this.vertexLabelAPI.eliminate(vertexLabel);
- }
-
- public void removeVertexLabel(String name) {
- long task = this.vertexLabelAPI.delete(name);
- this.taskAPI.waitUntilTaskSuccess(task, TASK_TIMEOUT);
- }
-
- public void removeVertexLabel(String name, long seconds) {
- long task = this.vertexLabelAPI.delete(name);
- this.taskAPI.waitUntilTaskSuccess(task, seconds);
- }
-
- public long removeVertexLabelAsync(String name) {
- return this.vertexLabelAPI.delete(name);
- }
-
- public VertexLabel getVertexLabel(String name) {
- return this.vertexLabelAPI.get(name);
- }
-
- public List<VertexLabel> getVertexLabels() {
- return this.vertexLabelAPI.list();
- }
-
- public List<VertexLabel> getVertexLabels(List<String> names) {
- return this.vertexLabelAPI.list(names);
- }
-
- public EdgeLabel addEdgeLabel(EdgeLabel edgeLabel) {
- return this.edgeLabelAPI.create(edgeLabel);
- }
-
- public EdgeLabel appendEdgeLabel(EdgeLabel edgeLabel) {
- return this.edgeLabelAPI.append(edgeLabel);
- }
-
- public EdgeLabel eliminateEdgeLabel(EdgeLabel edgeLabel) {
- return this.edgeLabelAPI.eliminate(edgeLabel);
- }
-
- public void removeEdgeLabel(String name) {
- this.removeEdgeLabel(name, TASK_TIMEOUT);
- }
-
- public void removeEdgeLabel(String name, long seconds) {
- long task = this.edgeLabelAPI.delete(name);
- this.taskAPI.waitUntilTaskSuccess(task, seconds);
- }
-
- public long removeEdgeLabelAsync(String name) {
- return this.edgeLabelAPI.delete(name);
- }
-
- public EdgeLabel getEdgeLabel(String name) {
- return this.edgeLabelAPI.get(name);
- }
-
- public List<EdgeLabel> getEdgeLabels() {
- return this.edgeLabelAPI.list();
- }
-
- public List<EdgeLabel> getEdgeLabels(List<String> names) {
- return this.edgeLabelAPI.list(names);
- }
-
- public IndexLabel addIndexLabel(IndexLabel indexLabel) {
- return this.addIndexLabel(indexLabel, TASK_TIMEOUT);
- }
-
- public IndexLabel addIndexLabel(IndexLabel indexLabel, long seconds) {
- IndexLabel.IndexLabelWithTask cil = this.indexLabelAPI
- .create(indexLabel);
- if (cil.taskId() != 0L) {
- this.taskAPI.waitUntilTaskSuccess(cil.taskId(), seconds);
- }
- return cil.indexLabel();
- }
-
- public long addIndexLabelAsync(IndexLabel indexLabel) {
- IndexLabel.IndexLabelWithTask cil = this.indexLabelAPI
- .create(indexLabel);
- return cil.taskId();
- }
-
- public IndexLabel appendIndexLabel(IndexLabel indexLabel) {
- return this.indexLabelAPI.append(indexLabel);
- }
-
- public IndexLabel eliminateIndexLabel(IndexLabel indexLabel) {
- return this.indexLabelAPI.eliminate(indexLabel);
- }
-
- public void removeIndexLabel(String name) {
- this.removeIndexLabel(name, TASK_TIMEOUT);
- }
-
- public void removeIndexLabel(String name, long secondss) {
- long task = this.indexLabelAPI.delete(name);
- this.taskAPI.waitUntilTaskSuccess(task, secondss);
- }
-
- public long removeIndexLabelAsync(String name) {
- return this.indexLabelAPI.delete(name);
- }
-
- public IndexLabel getIndexLabel(String name) {
- return this.indexLabelAPI.get(name);
- }
-
- public List<IndexLabel> getIndexLabels() {
- return this.indexLabelAPI.list();
- }
-
- public List<IndexLabel> getIndexLabels(List<String> names) {
- return this.indexLabelAPI.list(names);
- }
-
- public Map<String, List<SchemaElement>> getSchema() {
- return this.schemaAPI.list();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TaskManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TaskManager.java
deleted file mode 100644
index 982bd77f..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TaskManager.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import java.util.List;
-
-import com.baidu.hugegraph.api.task.TaskAPI;
-import com.baidu.hugegraph.api.task.TasksWithPage;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.Task;
-
-public class TaskManager {
-
- private TaskAPI taskAPI;
-
- public TaskManager(RestClient client, String graph) {
- this.taskAPI = new TaskAPI(client, graph);
- }
-
- public List<Task> list() {
- return this.list(-1);
- }
-
- public List<Task> list(long limit) {
- return this.taskAPI.list(null, limit);
- }
-
- public List<Task> list(List<Long> ids) {
- return this.taskAPI.list(ids);
- }
-
- public List<Task> list(String status) {
- return this.list(status, -1L);
- }
-
- public List<Task> list(String status, long limit) {
- return this.taskAPI.list(status, limit);
- }
-
- public TasksWithPage list(String status, String page, long limit) {
- return this.taskAPI.list(status, page, limit);
- }
-
- public Task get(long id) {
- return this.taskAPI.get(id);
- }
-
- public void delete(long id) {
- this.taskAPI.delete(id);
- }
-
- public Task cancel(long id) {
- return this.taskAPI.cancel(id);
- }
-
- public Task waitUntilTaskCompleted(long taskId, long seconds) {
- return this.taskAPI.waitUntilTaskSuccess(taskId, seconds);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TraverserManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TraverserManager.java
deleted file mode 100644
index 1fa96bfa..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/TraverserManager.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import com.baidu.hugegraph.api.traverser.AllShortestPathsAPI;
-import com.baidu.hugegraph.api.traverser.CountAPI;
-import com.baidu.hugegraph.api.traverser.CrosspointsAPI;
-import com.baidu.hugegraph.api.traverser.CustomizedCrosspointsAPI;
-import com.baidu.hugegraph.api.traverser.CustomizedPathsAPI;
-import com.baidu.hugegraph.api.traverser.EdgesAPI;
-import com.baidu.hugegraph.api.traverser.FusiformSimilarityAPI;
-import com.baidu.hugegraph.api.traverser.JaccardSimilarityAPI;
-import com.baidu.hugegraph.api.traverser.KneighborAPI;
-import com.baidu.hugegraph.api.traverser.KoutAPI;
-import com.baidu.hugegraph.api.traverser.MultiNodeShortestPathAPI;
-import com.baidu.hugegraph.api.traverser.NeighborRankAPI;
-import com.baidu.hugegraph.api.traverser.PathsAPI;
-import com.baidu.hugegraph.api.traverser.PersonalRankAPI;
-import com.baidu.hugegraph.api.traverser.RaysAPI;
-import com.baidu.hugegraph.api.traverser.RingsAPI;
-import com.baidu.hugegraph.api.traverser.SameNeighborsAPI;
-import com.baidu.hugegraph.api.traverser.ShortestPathAPI;
-import com.baidu.hugegraph.api.traverser.SingleSourceShortestPathAPI;
-import com.baidu.hugegraph.api.traverser.TemplatePathsAPI;
-import com.baidu.hugegraph.api.traverser.VerticesAPI;
-import com.baidu.hugegraph.api.traverser.WeightedShortestPathAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.constant.Direction;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.graph.Edges;
-import com.baidu.hugegraph.structure.graph.GraphIterator;
-import com.baidu.hugegraph.structure.graph.Path;
-import com.baidu.hugegraph.structure.graph.Shard;
-import com.baidu.hugegraph.structure.graph.Vertex;
-import com.baidu.hugegraph.structure.graph.Vertices;
-import com.baidu.hugegraph.structure.traverser.CountRequest;
-import com.baidu.hugegraph.structure.traverser.CrosspointsRequest;
-import com.baidu.hugegraph.structure.traverser.CustomizedCrosspoints;
-import com.baidu.hugegraph.structure.traverser.MultiNodeShortestPathRequest;
-import com.baidu.hugegraph.structure.traverser.PathsWithVertices;
-import com.baidu.hugegraph.structure.traverser.FusiformSimilarity;
-import com.baidu.hugegraph.structure.traverser.FusiformSimilarityRequest;
-import com.baidu.hugegraph.structure.traverser.SingleSourceJaccardSimilarityRequest;
-import com.baidu.hugegraph.structure.traverser.Kneighbor;
-import com.baidu.hugegraph.structure.traverser.KneighborRequest;
-import com.baidu.hugegraph.structure.traverser.Kout;
-import com.baidu.hugegraph.structure.traverser.KoutRequest;
-import com.baidu.hugegraph.structure.traverser.CustomizedPathsRequest;
-import com.baidu.hugegraph.structure.traverser.PathsRequest;
-import com.baidu.hugegraph.structure.traverser.Ranks;
-import com.baidu.hugegraph.structure.traverser.TemplatePathsRequest;
-import com.baidu.hugegraph.structure.traverser.WeightedPath;
-import com.baidu.hugegraph.structure.traverser.WeightedPaths;
-import org.apache.hugegraph.util.E;
-
-import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_CAPACITY;
-import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_MAX_DEGREE;
-import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_ELEMENTS_LIMIT;
-import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_PAGE_LIMIT;
-import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_PATHS_LIMIT;
-
-public class TraverserManager {
-
- private final GraphManager graphManager;
- private JaccardSimilarityAPI jaccardSimilarityAPI;
- private SameNeighborsAPI sameNeighborsAPI;
- private ShortestPathAPI shortestPathAPI;
- private AllShortestPathsAPI allShortestPathsAPI;
- private SingleSourceShortestPathAPI singleSourceShortestPathAPI;
- private WeightedShortestPathAPI weightedShortestPathAPI;
- private MultiNodeShortestPathAPI multiNodeShortestPathAPI;
- private PathsAPI pathsAPI;
- private CrosspointsAPI crosspointsAPI;
- private KoutAPI koutAPI;
- private KneighborAPI kneighborAPI;
- private CountAPI countAPI;
- private RingsAPI ringsAPI;
- private RaysAPI raysAPI;
- private CustomizedPathsAPI customizedPathsAPI;
- private CustomizedCrosspointsAPI customizedCrosspointsAPI;
- private TemplatePathsAPI templatePathsAPI;
- private FusiformSimilarityAPI fusiformSimilarityAPI;
- private NeighborRankAPI neighborRankAPI;
- private PersonalRankAPI personalRankAPI;
- private VerticesAPI verticesAPI;
- private EdgesAPI edgesAPI;
-
- public TraverserManager(RestClient client, GraphManager graphManager) {
- this.graphManager = graphManager;
- String graph = graphManager.graph();
- this.jaccardSimilarityAPI = new JaccardSimilarityAPI(client, graph);
- this.sameNeighborsAPI = new SameNeighborsAPI(client, graph);
- this.shortestPathAPI = new ShortestPathAPI(client, graph);
- this.allShortestPathsAPI = new AllShortestPathsAPI(client, graph);
- this.singleSourceShortestPathAPI = new SingleSourceShortestPathAPI(
- client, graph);
- this.weightedShortestPathAPI = new WeightedShortestPathAPI(
- client, graph);
- this.multiNodeShortestPathAPI = new MultiNodeShortestPathAPI(
- client, graph);
- this.pathsAPI = new PathsAPI(client, graph);
- this.crosspointsAPI = new CrosspointsAPI(client, graph);
- this.koutAPI = new KoutAPI(client, graph);
- this.kneighborAPI = new KneighborAPI(client, graph);
- this.countAPI = new CountAPI(client, graph);
- this.ringsAPI = new RingsAPI(client, graph);
- this.raysAPI = new RaysAPI(client, graph);
- this.customizedPathsAPI = new CustomizedPathsAPI(client, graph);
- this.customizedCrosspointsAPI = new CustomizedCrosspointsAPI(
- client, graph);
- this.templatePathsAPI = new TemplatePathsAPI(client, graph);
- this.fusiformSimilarityAPI = new FusiformSimilarityAPI(client, graph);
- this.neighborRankAPI = new NeighborRankAPI(client, graph);
- this.personalRankAPI = new PersonalRankAPI(client, graph);
- this.verticesAPI = new VerticesAPI(client, graph);
- this.edgesAPI = new EdgesAPI(client, graph);
- }
-
- public double jaccardSimilarity(Object vertexId, Object otherId) {
- return this.jaccardSimilarity(vertexId, otherId, DEFAULT_MAX_DEGREE);
- }
-
- public double jaccardSimilarity(Object vertexId, Object otherId,
- long degree) {
- return this.jaccardSimilarity(vertexId, otherId, Direction.BOTH,
- null, degree);
- }
-
- public double jaccardSimilarity(Object vertexId, Object otherId,
- Direction direction, String label,
- long degree) {
- return this.jaccardSimilarityAPI.get(vertexId, otherId, direction,
- label, degree);
- }
-
- public Map<Object, Double> jaccardSimilarity(
- SingleSourceJaccardSimilarityRequest request) {
- return this.jaccardSimilarityAPI.post(request);
- }
-
- public List<Object> sameNeighbors(Object vertexId, Object otherId) {
- return this.sameNeighbors(vertexId, otherId, DEFAULT_MAX_DEGREE);
- }
-
- public List<Object> sameNeighbors(Object vertexId, Object otherId,
- long degree) {
- return this.sameNeighbors(vertexId, otherId, Direction.BOTH,
- null, degree);
- }
-
- public List<Object> sameNeighbors(Object vertexId, Object otherId,
- Direction direction, String label,
- long degree) {
- return this.sameNeighbors(vertexId, otherId, direction, label,
- degree, DEFAULT_PATHS_LIMIT);
- }
-
- public List<Object> sameNeighbors(Object vertexId, Object otherId,
- Direction direction, String label,
- long degree, int limit) {
- return this.sameNeighborsAPI.get(vertexId, otherId, direction,
- label, degree, limit);
- }
-
- public Path shortestPath(Object sourceId, Object targetId, int maxDepth) {
- return this.shortestPath(sourceId, targetId, Direction.BOTH, null,
- maxDepth);
- }
-
- public Path shortestPath(Object sourceId, Object targetId,
- Direction direction, int maxDepth) {
- return this.shortestPath(sourceId, targetId, direction, null,
- maxDepth);
- }
-
- public Path shortestPath(Object sourceId, Object targetId,
- Direction direction, String label, int maxDepth) {
- return this.shortestPath(sourceId, targetId, direction, label, maxDepth,
- DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY);
- }
-
- public Path shortestPath(Object sourceId, Object targetId,
- Direction direction, String label, int maxDepth,
- long degree, long capacity) {
- return this.shortestPath(sourceId, targetId, direction, label,
- maxDepth, degree, 0L, capacity);
- }
-
- public Path shortestPath(Object sourceId, Object targetId,
- Direction direction, String label, int maxDepth,
- long degree, long skipDegree, long capacity) {
- return this.shortestPathAPI.get(sourceId, targetId, direction, label,
- maxDepth, degree, skipDegree, capacity);
- }
-
- public List<Path> allShortestPaths(Object sourceId, Object targetId,
- int maxDepth) {
- return this.allShortestPaths(sourceId, targetId, Direction.BOTH,
- null, maxDepth);
- }
-
- public List<Path> allShortestPaths(Object sourceId, Object targetId,
- Direction direction, int maxDepth) {
- return this.allShortestPaths(sourceId, targetId, direction,
- null, maxDepth);
- }
-
- public List<Path> allShortestPaths(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth) {
- return this.allShortestPaths(sourceId, targetId, direction,
- label, maxDepth, DEFAULT_MAX_DEGREE,
- DEFAULT_CAPACITY);
- }
-
- public List<Path> allShortestPaths(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth, long degree,
- long capacity) {
- return this.allShortestPaths(sourceId, targetId, direction, label,
- maxDepth, degree, 0L, capacity);
- }
-
- public List<Path> allShortestPaths(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth, long degree,
- long skipDegree, long capacity) {
- return this.allShortestPathsAPI.get(sourceId, targetId, direction,
- label, maxDepth, degree,
- skipDegree, capacity);
- }
-
- public WeightedPaths singleSourceShortestPath(Object sourceId,
- String weight,
- boolean withVertex) {
- return this.singleSourceShortestPath(sourceId, Direction.BOTH, null,
- weight, withVertex);
- }
-
- public WeightedPaths singleSourceShortestPath(Object sourceId,
- Direction direction,
- String label, String weight,
- boolean withVertex) {
- return this.singleSourceShortestPath(sourceId, direction, label, weight,
- DEFAULT_MAX_DEGREE, 0L,
- DEFAULT_CAPACITY,
- DEFAULT_PATHS_LIMIT, withVertex);
- }
-
- public WeightedPaths singleSourceShortestPath(Object sourceId,
- Direction direction,
- String label, String weight,
- long degree, long skipDegree,
- long capacity, int limit,
- boolean withVertex) {
- return this.singleSourceShortestPathAPI.get(sourceId, direction, label,
- weight, degree, skipDegree,
- capacity, limit,
- withVertex);
- }
-
- public WeightedPath weightedShortestPath(Object sourceId, Object targetId,
- String weight, boolean withVertex) {
- return this.weightedShortestPath(sourceId, targetId, Direction.BOTH,
- null, weight, withVertex);
- }
-
- public WeightedPath weightedShortestPath(Object sourceId, Object targetId,
- Direction direction, String label,
- String weight,
- boolean withVertex) {
- return this.weightedShortestPath(sourceId, targetId, direction, label,
- weight, DEFAULT_MAX_DEGREE, 0L,
- DEFAULT_CAPACITY, withVertex);
- }
-
- public WeightedPath weightedShortestPath(Object sourceId, Object targetId,
- Direction direction,
- String label, String weight,
- long degree, long skipDegree,
- long capacity, boolean withVertex) {
- return this.weightedShortestPathAPI.get(sourceId, targetId,direction,
- label, weight, degree,
- skipDegree, capacity,
- withVertex);
- }
-
- public PathsWithVertices multiNodeShortestPath(
- MultiNodeShortestPathRequest request) {
- return this.multiNodeShortestPathAPI.post(request);
- }
-
- public List<Path> paths(Object sourceId, Object targetId, int maxDepth) {
- return this.paths(sourceId, targetId, Direction.BOTH, null,
- maxDepth, DEFAULT_PATHS_LIMIT);
- }
-
- public List<Path> paths(Object sourceId, Object targetId,
- Direction direction, int maxDepth, int limit) {
- return this.paths(sourceId, targetId, direction, null,
- maxDepth, limit);
- }
-
- public List<Path> paths(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth, int limit) {
- return this.paths(sourceId, targetId, direction, label, maxDepth,
- DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
- }
-
- public List<Path> paths(Object sourceId, Object targetId,
- Direction direction, String label, int maxDepth,
- long degree, long capacity, int limit) {
- return this.pathsAPI.get(sourceId, targetId, direction, label,
- maxDepth, degree, capacity, limit);
- }
-
- public PathsWithVertices paths(PathsRequest request) {
- return this.pathsAPI.post(request);
- }
-
- public List<Path> crosspoint(Object sourceId, Object targetId,
- int maxDepth) {
- return this.crosspoint(sourceId, targetId, Direction.BOTH, null,
- maxDepth, DEFAULT_PATHS_LIMIT);
- }
-
- public List<Path> crosspoint(Object sourceId, Object targetId,
- Direction direction, int maxDepth,
- int limit) {
- return this.crosspoint(sourceId, targetId, direction, null,
- maxDepth, limit);
- }
-
- public List<Path> crosspoint(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth, int limit) {
- return this.crosspoint(sourceId, targetId, direction, label, maxDepth,
- DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
- }
-
- public List<Path> crosspoint(Object sourceId, Object targetId,
- Direction direction, String label,
- int maxDepth, long degree, long capacity,
- int limit) {
- return this.crosspointsAPI.get(sourceId, targetId, direction, label,
- maxDepth, degree, capacity, limit);
- }
-
- public List<Object> kout(Object sourceId, int depth) {
- return this.kout(sourceId, Direction.BOTH, depth);
- }
-
- public List<Object> kout(Object sourceId, Direction direction, int depth) {
- return this.kout(sourceId, direction, null, depth, true);
- }
-
- public List<Object> kout(Object sourceId, Direction direction,
- String label, int depth, boolean nearest) {
- return this.kout(sourceId, direction, label, depth, nearest,
- DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY,
- DEFAULT_ELEMENTS_LIMIT);
- }
-
- public List<Object> kout(Object sourceId, Direction direction,
- String label, int depth, boolean nearest,
- long degree, long capacity, int limit) {
- return this.koutAPI.get(sourceId, direction, label, depth, nearest,
- degree, capacity, limit);
- }
-
- public Kout kout(KoutRequest request) {
- return this.koutAPI.post(request);
- }
-
- public List<Object> kneighbor(Object sourceId, int depth) {
- return this.kneighbor(sourceId, Direction.BOTH, null, depth);
- }
-
- public List<Object> kneighbor(Object sourceId, Direction direction,
- int depth) {
- return this.kneighbor(sourceId, direction, null, depth);
- }
-
- public List<Object> kneighbor(Object sourceId, Direction direction,
- String label, int depth) {
- return this.kneighbor(sourceId, direction, label, depth,
- DEFAULT_MAX_DEGREE, DEFAULT_ELEMENTS_LIMIT);
- }
-
- public List<Object> kneighbor(Object sourceId, Direction direction,
- String label, int depth,
- long degree, int limit) {
- return this.kneighborAPI.get(sourceId, direction, label, depth,
- degree, limit);
- }
-
- public Kneighbor kneighbor(KneighborRequest request) {
- return this.kneighborAPI.post(request);
- }
-
- public long count(CountRequest request) {
- return this.countAPI.post(request);
- }
-
- public List<Path> rings(Object sourceId, int depth) {
- return this.rings(sourceId, Direction.BOTH, null, depth, true,
- DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY,
- DEFAULT_ELEMENTS_LIMIT);
- }
-
- public List<Path> rings(Object sourceId, Direction direction, String label,
- int depth, boolean sourceInRing, long degree,
- long capacity, int limit) {
- return this.ringsAPI.get(sourceId, direction, label, depth,
- sourceInRing, degree, capacity, limit);
- }
-
- public List<Path> rays(Object sourceId, int depth) {
- return this.rays(sourceId, Direction.BOTH, null, depth,
- DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY,
- DEFAULT_ELEMENTS_LIMIT);
- }
-
- public List<Path> rays(Object sourceId, Direction direction, String label,
- int depth, long degree, long capacity, int limit) {
- return this.raysAPI.get(sourceId, direction, label, depth, degree,
- capacity, limit);
- }
-
- public PathsWithVertices customizedPaths(CustomizedPathsRequest request) {
- return this.customizedPathsAPI.post(request);
- }
-
- public CustomizedCrosspoints customizedCrosspointss(
- CrosspointsRequest request) {
- return this.customizedCrosspointsAPI.post(request);
- }
-
- public PathsWithVertices count(TemplatePathsRequest request) {
- return this.templatePathsAPI.post(request);
- }
-
- public FusiformSimilarity fusiformSimilarity(
- FusiformSimilarityRequest request) {
- return this.fusiformSimilarityAPI.post(request);
- }
-
- public List<Ranks> neighborRank(NeighborRankAPI.Request request) {
- return this.neighborRankAPI.post(request);
- }
-
- public Ranks personalRank(PersonalRankAPI.Request request) {
- return this.personalRankAPI.post(request);
- }
-
- public List<Shard> vertexShards(long splitSize) {
- return this.verticesAPI.shards(splitSize);
- }
-
- public List<Shard> edgeShards(long splitSize) {
- return this.edgesAPI.shards(splitSize);
- }
-
- public List<Vertex> vertices(List<Object> ids) {
- List<Vertex> vertices = this.verticesAPI.list(ids);
- for (Vertex vertex : vertices) {
- vertex.attachManager(this.graphManager);
- }
- return vertices;
- }
-
- public Vertices vertices(Shard shard) {
- Vertices vertices = this.vertices(shard, null, 0L);
- E.checkState(vertices.page() == null,
- "Can't contains page when not in paging");
- return vertices;
- }
-
- public Vertices vertices(Shard shard, String page) {
- E.checkArgument(page != null, "Page can't be null");
- return this.vertices(shard, page, DEFAULT_PAGE_LIMIT);
- }
-
- public Vertices vertices(Shard shard, String page, long pageLimit) {
- E.checkArgument(page == null || pageLimit >= 0,
- "Page limit must be >= 0 when page is not null");
- Vertices vertices = this.verticesAPI.scan(shard, page, pageLimit);
-
- for (Vertex vertex : vertices.results()) {
- vertex.attachManager(this.graphManager);
- }
- return vertices;
- }
-
- public Iterator<Vertex> iteratorVertices(Shard shard, int sizePerPage) {
- return new GraphIterator<>(this.graphManager, sizePerPage, (page) -> {
- return this.vertices(shard, page, sizePerPage);
- });
- }
-
- public List<Edge> edges(List<String> ids) {
- List<Edge> edges = this.edgesAPI.list(ids);
- for (Edge edge : edges) {
- edge.attachManager(this.graphManager);
- }
- return edges;
- }
-
- public Edges edges(Shard shard) {
- Edges edges = this.edges(shard, null, 0L);
- E.checkState(edges.page() == null,
- "Can't contains page when not in paging");
- return edges;
- }
-
- public Edges edges(Shard shard, String page) {
- E.checkArgument(page != null, "Page can't be null");
- return this.edges(shard, page, DEFAULT_PAGE_LIMIT);
- }
-
- public Edges edges(Shard shard, String page, long pageLimit) {
- E.checkArgument(page == null || pageLimit >= 0,
- "Page limit must be >= 0 when page is not null");
- Edges edges = this.edgesAPI.scan(shard, page, pageLimit);
- for (Edge edge : edges.results()) {
- edge.attachManager(this.graphManager);
- }
- return edges;
- }
-
- public Iterator<Edge> iteratorEdges(Shard shard, int sizePerPage) {
- return new GraphIterator<>(this.graphManager, sizePerPage, (page) -> {
- return this.edges(shard, page, sizePerPage);
- });
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/VariablesManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/VariablesManager.java
deleted file mode 100644
index ee6e1f61..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/VariablesManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import com.baidu.hugegraph.api.variables.VariablesAPI;
-import com.baidu.hugegraph.client.RestClient;
-
-import java.util.Map;
-
-public class VariablesManager {
-
- private VariablesAPI variablesAPI;
-
- public VariablesManager(RestClient client, String graph) {
- this.variablesAPI = new VariablesAPI(client, graph);
- }
-
- public Map<String, Object> get(String key) {
- return this.variablesAPI.get(key);
- }
-
- public Map<String, Object> set(String key, Object value) {
- return this.variablesAPI.set(key, value);
- }
-
- public void remove(String key) {
- this.variablesAPI.remove(key);
- }
-
- public Map<String, Object> all() {
- return this.variablesAPI.all();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/VersionManager.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/VersionManager.java
deleted file mode 100644
index 2ff9956c..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/driver/VersionManager.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.driver;
-
-import com.baidu.hugegraph.api.version.VersionAPI;
-import com.baidu.hugegraph.client.RestClient;
-import com.baidu.hugegraph.structure.version.Versions;
-
-public class VersionManager {
-
- private VersionAPI versionAPI;
-
- public VersionManager(RestClient client) {
- this.versionAPI = new VersionAPI(client);
- }
-
- public String getCoreVersion() {
- Versions versions = this.versionAPI.get();
- return versions.get("core");
- }
-
- public String getGremlinVersion() {
- Versions versions = this.versionAPI.get();
- return versions.get("gremlin");
- }
-
- public String getApiVersion() {
- Versions versions = this.versionAPI.get();
- return versions.get("api");
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/example/BatchExample.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/example/BatchExample.java
deleted file mode 100644
index 8f2da31f..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/example/BatchExample.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.example;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.baidu.hugegraph.driver.GraphManager;
-import com.baidu.hugegraph.driver.HugeClient;
-import com.baidu.hugegraph.driver.SchemaManager;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.graph.Vertex;
-
-public class BatchExample {
-
- public static void main(String[] args) {
- // If connect failed will throw an exception.
- HugeClient hugeClient = HugeClient.builder("http://localhost:8080",
- "hugegraph").build();
-
- SchemaManager schema = hugeClient.schema();
-
- schema.propertyKey("name").asText().ifNotExist().create();
- schema.propertyKey("age").asInt().ifNotExist().create();
- schema.propertyKey("lang").asText().ifNotExist().create();
- schema.propertyKey("date").asDate().ifNotExist().create();
- schema.propertyKey("price").asInt().ifNotExist().create();
-
- schema.vertexLabel("person")
- .properties("name", "age")
- .primaryKeys("name")
- .ifNotExist()
- .create();
-
- schema.vertexLabel("person")
- .properties("price")
- .nullableKeys("price")
- .append();
-
- schema.vertexLabel("software")
- .properties("name", "lang", "price")
- .primaryKeys("name")
- .ifNotExist()
- .create();
-
- schema.indexLabel("softwareByPrice")
- .onV("software").by("price")
- .range()
- .ifNotExist()
- .create();
-
- schema.edgeLabel("knows")
- .link("person", "person")
- .properties("date")
- .ifNotExist()
- .create();
-
- schema.edgeLabel("created")
- .link("person", "software")
- .properties("date")
- .ifNotExist()
- .create();
-
- schema.indexLabel("createdByDate")
- .onE("created").by("date")
- .secondary()
- .ifNotExist()
- .create();
-
- // get schema object by name
- System.out.println(schema.getPropertyKey("name"));
- System.out.println(schema.getVertexLabel("person"));
- System.out.println(schema.getEdgeLabel("knows"));
- System.out.println(schema.getIndexLabel("createdByDate"));
-
- // list all schema objects
- System.out.println(schema.getPropertyKeys());
- System.out.println(schema.getVertexLabels());
- System.out.println(schema.getEdgeLabels());
- System.out.println(schema.getIndexLabels());
-
- GraphManager graph = hugeClient.graph();
-
- Vertex marko = new Vertex("person").property("name", "marko")
- .property("age", 29);
- Vertex vadas = new Vertex("person").property("name", "vadas")
- .property("age", 27);
- Vertex lop = new Vertex("software").property("name", "lop")
- .property("lang", "java")
- .property("price", 328);
- Vertex josh = new Vertex("person").property("name", "josh")
- .property("age", 32);
- Vertex ripple = new Vertex("software").property("name", "ripple")
- .property("lang", "java")
- .property("price", 199);
- Vertex peter = new Vertex("person").property("name", "peter")
- .property("age", 35);
-
- Edge markoKnowsVadas = new Edge("knows").source(marko).target(vadas)
- .property("date", "2016-01-10");
- Edge markoKnowsJosh = new Edge("knows").source(marko).target(josh)
- .property("date", "2013-02-20");
- Edge markoCreateLop = new Edge("created").source(marko).target(lop)
- .property("date",
- "2017-12-10");
- Edge joshCreateRipple = new Edge("created").source(josh).target(ripple)
- .property("date",
- "2017-12-10");
- Edge joshCreateLop = new Edge("created").source(josh).target(lop)
- .property("date", "2009-11-11");
- Edge peterCreateLop = new Edge("created").source(peter).target(lop)
- .property("date",
- "2017-03-24");
-
- List<Vertex> vertices = new ArrayList<>();
- vertices.add(marko);
- vertices.add(vadas);
- vertices.add(lop);
- vertices.add(josh);
- vertices.add(ripple);
- vertices.add(peter);
-
- List<Edge> edges = new ArrayList<>();
- edges.add(markoKnowsVadas);
- edges.add(markoKnowsJosh);
- edges.add(markoCreateLop);
- edges.add(joshCreateRipple);
- edges.add(joshCreateLop);
- edges.add(peterCreateLop);
-
- vertices = graph.addVertices(vertices);
- vertices.forEach(vertex -> System.out.println(vertex));
-
- edges = graph.addEdges(edges, false);
- edges.forEach(edge -> System.out.println(edge));
-
- hugeClient.close();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/example/MovieExample.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/example/MovieExample.java
deleted file mode 100644
index 4ef44c80..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/example/MovieExample.java
+++ /dev/null
@@ -1,777 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.example;
-
-import com.baidu.hugegraph.driver.GraphManager;
-import com.baidu.hugegraph.driver.HugeClient;
-import com.baidu.hugegraph.driver.SchemaManager;
-import com.baidu.hugegraph.structure.constant.T;
-import com.baidu.hugegraph.structure.graph.Vertex;
-
-public class MovieExample {
-
- public static void main(String[] args) {
- // If connect failed will throw a exception.
- HugeClient hugeClient = HugeClient.builder("http://localhost:8080",
- "hugegraph").build();
-
- SchemaManager schema = hugeClient.schema();
-
- schema.propertyKey("name").asText().ifNotExist().create();
- schema.propertyKey("born").asInt().ifNotExist().create();
- schema.propertyKey("title").asText().ifNotExist().create();
- schema.propertyKey("released").asInt().ifNotExist().create();
- schema.propertyKey("score").asInt().ifNotExist().create();
- schema.propertyKey("roles").asText().ifNotExist().create();
-
- schema.vertexLabel("person")
- .properties("name", "born")
- .primaryKeys("name")
- .ifNotExist()
- .create();
- schema.vertexLabel("movie")
- .properties("title", "released")
- .primaryKeys("title")
- .ifNotExist()
- .create();
-
- schema.edgeLabel("ACTED_IN").multiTimes().properties("roles")
- .sourceLabel("person").targetLabel("movie")
- .sortKeys("roles")
- .ifNotExist()
- .create();
- schema.edgeLabel("DIRECTED").properties("score")
- .sourceLabel("person").targetLabel("movie")
- .ifNotExist()
- .create();
- schema.edgeLabel("PRODUCED").properties("score")
- .sourceLabel("person").targetLabel("movie")
- .ifNotExist()
- .create();
- schema.edgeLabel("WROTE").properties("score")
- .sourceLabel("person").targetLabel("movie")
- .ifNotExist()
- .create();
-
- schema.indexLabel("personByBorn").onV("person").by("born")
- .range().ifNotExist().create();
-
- GraphManager graph = hugeClient.graph();
-
- Vertex theMatrix = graph.addVertex(T.LABEL,
- "movie", "title", "The Matrix", "released", 1999);
- Vertex keanu = graph.addVertex(T.LABEL,
- "person", "name", "keanu Reeves", "born", 1964);
- Vertex carrie = graph.addVertex(T.LABEL,
- "person", "name", "carrie-anne Moss", "born", 1967);
- Vertex laurence = graph.addVertex(T.LABEL,
- "person", "name", "laurence Fishburne", "born", 1961);
- Vertex hugo = graph.addVertex(T.LABEL,
- "person", "name", "hugo Weaving", "born", 1960);
- Vertex lillyW = graph.addVertex(T.LABEL,
- "person", "name", "Lilly Wachowski", "born", 1967);
- Vertex lanaW = graph.addVertex(T.LABEL,
- "person", "name", "Lana Wachowski", "born", 1965);
- Vertex joelS = graph.addVertex(T.LABEL,
- "person", "name", "Joel Silver", "born", 1952);
-
- keanu.addEdge("ACTED_IN", theMatrix, "roles", "Neo");
- carrie.addEdge("ACTED_IN", theMatrix, "roles", "Trinity");
- laurence.addEdge("ACTED_IN", theMatrix, "roles", "Morpheus");
- hugo.addEdge("ACTED_IN", theMatrix, "roles", "agent Smith");
- lillyW.addEdge("DIRECTED", theMatrix, "score", 10);
- lanaW.addEdge("DIRECTED", theMatrix, "score", 10);
- joelS.addEdge("PRODUCED", theMatrix, "score", 10);
-
- Vertex emil = graph.addVertex(T.LABEL, "person", "name", "emil Eifrem", "born", 1978);
- emil.addEdge("ACTED_IN", theMatrix, "roles", "emil");
-
- Vertex theMatrixReloaded = graph.addVertex(T.LABEL,
- "movie", "title",
- "The Matrix Reloaded", "released", 2003);
-
- keanu.addEdge("ACTED_IN", theMatrixReloaded, "roles", "Neo");
- carrie.addEdge("ACTED_IN", theMatrixReloaded, "roles", "Trinity");
- laurence.addEdge("ACTED_IN", theMatrixReloaded, "roles", "Morpheus");
- hugo.addEdge("ACTED_IN", theMatrixReloaded, "roles", "agent Smith");
- lillyW.addEdge("DIRECTED", theMatrixReloaded, "score", 10);
- lanaW.addEdge("DIRECTED", theMatrix, "score", 10);
- joelS.addEdge("PRODUCED", theMatrixReloaded, "score", 10);
-
- Vertex theMatrixRevolutions = graph.addVertex(T.LABEL,
- "movie", "title",
- "The Matrix Revolutions", "released", 2003);
-
- keanu.addEdge("ACTED_IN", theMatrixRevolutions, "roles", "Neo");
- carrie.addEdge("ACTED_IN", theMatrixRevolutions, "roles", "Trinity");
- laurence.addEdge("ACTED_IN", theMatrixRevolutions, "roles", "Morpheus");
- hugo.addEdge("ACTED_IN", theMatrixRevolutions, "roles", "agent Smith");
- lillyW.addEdge("DIRECTED", theMatrixRevolutions, "score", 10);
- lanaW.addEdge("DIRECTED", theMatrixRevolutions, "score", 10);
- joelS.addEdge("PRODUCED", theMatrixRevolutions, "score", 10);
-
- Vertex theDevilsadvocate = graph.addVertex(T.LABEL, "movie", "title",
- "The Devil's advocate", "released", 1997);
-
- Vertex charlize = graph.addVertex(T.LABEL,
- "person", "name", "charlize Theron", "born", 1975);
- Vertex al = graph.addVertex(T.LABEL,
- "person", "name", "al Pacino", "born", 1940);
- Vertex taylor = graph.addVertex(T.LABEL,
- "person", "name", "taylor Hackford", "born", 1944);
-
- keanu.addEdge("ACTED_IN", theDevilsadvocate, "roles", "Kevin Lomax");
- charlize.addEdge("ACTED_IN", theDevilsadvocate, "roles", "Mary ann Lomax");
- al.addEdge("ACTED_IN", theDevilsadvocate, "roles", "John Milton");
- taylor.addEdge("DIRECTED", theDevilsadvocate, "score", 10);
-
- Vertex aFewGoodMen = graph.addVertex(T.LABEL,
- "movie", "title", "a Few Good Men", "released", 1992);
-
- Vertex tomC = graph.addVertex(T.LABEL,
- "person", "name", "Tom Cruise", "born", 1962);
- Vertex jackN = graph.addVertex(T.LABEL,
- "person", "name", "Jack Nicholson", "born", 1937);
- Vertex demiM = graph.addVertex(T.LABEL,
- "person", "name", "Demi Moore", "born", 1962);
- Vertex kevinB = graph.addVertex(T.LABEL,
- "person", "name", "Kevin Bacon", "born", 1958);
- Vertex kieferS = graph.addVertex(T.LABEL,
- "person", "name", "Kiefer Sutherland", "born", 1966);
- Vertex noahW = graph.addVertex(T.LABEL,
- "person", "name", "Noah Wyle", "born", 1971);
- Vertex cubaG = graph.addVertex(T.LABEL,
- "person", "name", "Cuba Gooding Jr.", "born", 1968);
- Vertex kevinP = graph.addVertex(T.LABEL,
- "person", "name", "Kevin Pollak", "born", 1957);
- Vertex jtw = graph.addVertex(T.LABEL,
- "person", "name", "J.T. Walsh", "born", 1943);
- Vertex jamesM = graph.addVertex(T.LABEL,
- "person", "name", "James Marshall", "born", 1967);
- Vertex christopherG = graph.addVertex(T.LABEL,
- "person", "name", "Christopher Guest", "born", 1948);
- Vertex robR = graph.addVertex(T.LABEL,
- "person", "name", "Rob Reiner", "born", 1947);
- Vertex aaronS = graph.addVertex(T.LABEL,
- "person", "name", "aaron Sorkin", "born", 1961);
-
- tomC.addEdge("ACTED_IN", aFewGoodMen, "roles", "Lt. Daniel Kaffee");
- jackN.addEdge("ACTED_IN", aFewGoodMen, "roles", "Col. nathan R. Jessup");
- demiM.addEdge("ACTED_IN", aFewGoodMen, "roles", "Lt. Cdr. Joanne Galloway");
- kevinB.addEdge("ACTED_IN", aFewGoodMen, "roles", "Capt. Jack Ross");
- kieferS.addEdge("ACTED_IN", aFewGoodMen, "roles", "Lt. Jonathan Kendrick");
- noahW.addEdge("ACTED_IN", aFewGoodMen, "roles", "Cpl. Jeffrey Barnes");
- cubaG.addEdge("ACTED_IN", aFewGoodMen, "roles", "Cpl. Carl Hammaker");
- kevinP.addEdge("ACTED_IN", aFewGoodMen, "roles", "Lt. Sam Weinberg");
- jtw.addEdge("ACTED_IN", aFewGoodMen, "roles", "Lt. Col. Matthew andrew Markinson");
- jamesM.addEdge("ACTED_IN", aFewGoodMen, "roles", "Pfc. Louden Downey");
- christopherG.addEdge("ACTED_IN", aFewGoodMen, "roles", "Dr. Stone");
- aaronS.addEdge("ACTED_IN", aFewGoodMen, "roles", "Man in Bar");
- robR.addEdge("DIRECTED", aFewGoodMen, "score", 10);
- aaronS.addEdge("WROTE", aFewGoodMen, "score", 10);
-
- Vertex topGun = graph.addVertex(T.LABEL,
- "movie", "title", "Top Gun", "released", 1986);
-
- Vertex kellyM = graph.addVertex(T.LABEL,
- "person", "name", "Kelly McGillis", "born", 1957);
- Vertex valK = graph.addVertex(T.LABEL,
- "person", "name", "Val Kilmer", "born", 1959);
- Vertex anthonyE = graph.addVertex(T.LABEL,
- "person", "name", "anthony Edwards", "born", 1962);
- Vertex tomS = graph.addVertex(T.LABEL,
- "person", "name", "Tom Skerritt", "born", 1933);
- Vertex megR = graph.addVertex(T.LABEL,
- "person", "name", "Meg Ryan", "born", 1961);
- Vertex tonyS = graph.addVertex(T.LABEL,
- "person", "name", "Tony Scott", "born", 1944);
- Vertex jimC = graph.addVertex(T.LABEL,
- "person", "name", "Jim Cash", "born", 1941);
-
- tomC.addEdge("ACTED_IN", topGun, "roles", "Maverick");
- kellyM.addEdge("ACTED_IN", topGun, "roles", "Charlie");
- valK.addEdge("ACTED_IN", topGun, "roles", "Iceman");
- anthonyE.addEdge("ACTED_IN", topGun, "roles", "Goose");
- tomS.addEdge("ACTED_IN", topGun, "roles", "Viper");
- megR.addEdge("ACTED_IN", topGun, "roles", "Carole");
- tonyS.addEdge("DIRECTED", topGun, "score", 10);
- jimC.addEdge("WROTE", topGun, "score", 10);
-
- Vertex jerryMaguire = graph.addVertex(T.LABEL, "movie", "title",
- "Jerry Maguire", "released", 2000);
-
- Vertex reneeZ = graph.addVertex(T.LABEL,
- "person", "name", "Renee Zellweger", "born", 1969);
- Vertex kellyP = graph.addVertex(T.LABEL,
- "person", "name", "Kelly Preston", "born", 1962);
- Vertex jerryO = graph.addVertex(T.LABEL,
- "person", "name", "Jerry O'Connell", "born", 1974);
- Vertex jayM = graph.addVertex(T.LABEL,
- "person", "name", "Jay Mohr", "born", 1970);
- Vertex bonnieH = graph.addVertex(T.LABEL,
- "person", "name", "Bonnie Hunt", "born", 1970);
- Vertex reginaK = graph.addVertex(T.LABEL,
- "person", "name", "Regina King", "born", 1961);
- Vertex jonathanL = graph.addVertex(T.LABEL,
- "person", "name", "Jonathan Lipnicki", "born", 1996);
- Vertex cameronC = graph.addVertex(T.LABEL,
- "person", "name", "Cameron Crowe", "born", 1957);
-
- tomC.addEdge("ACTED_IN", jerryMaguire, "roles", "Jerry Maguire");
- cubaG.addEdge("ACTED_IN", jerryMaguire, "roles", "Rod Tidwell");
- reneeZ.addEdge("ACTED_IN", jerryMaguire, "roles", "Dorothy Boyd");
- kellyP.addEdge("ACTED_IN", jerryMaguire, "roles", "avery Bishop");
- jerryO.addEdge("ACTED_IN", jerryMaguire, "roles", "Frank Cushman");
- jayM.addEdge("ACTED_IN", jerryMaguire, "roles", "Bob Sugar");
- bonnieH.addEdge("ACTED_IN", jerryMaguire, "roles", "Laurel Boyd");
- reginaK.addEdge("ACTED_IN", jerryMaguire, "roles", "Marcee Tidwell");
- jonathanL.addEdge("ACTED_IN", jerryMaguire, "roles", "Ray Boyd");
- cameronC.addEdge("DIRECTED", jerryMaguire, "score", 10);
- cameronC.addEdge("PRODUCED", jerryMaguire, "score", 10);
- cameronC.addEdge("WROTE", jerryMaguire, "score", 10);
-
- Vertex standByMe = graph.addVertex(T.LABEL, "movie", "title",
- "Stand By Me", "released", 1986);
-
- Vertex riverP = graph.addVertex(T.LABEL,
- "person", "name", "River Phoenix", "born", 1970);
- Vertex coreyF = graph.addVertex(T.LABEL,
- "person", "name", "Corey Feldman", "born", 1971);
- Vertex wilW = graph.addVertex(T.LABEL,
- "person", "name", "Wil Wheaton", "born", 1972);
- Vertex johnC = graph.addVertex(T.LABEL,
- "person", "name", "John Cusack", "born", 1966);
- Vertex marshallB = graph.addVertex(T.LABEL,
- "person", "name", "Marshall Bell", "born", 1942);
-
- wilW.addEdge("ACTED_IN", standByMe, "roles", "Gordie Lachance");
- riverP.addEdge("ACTED_IN", standByMe, "roles", "Chris Chambers");
- jerryO.addEdge("ACTED_IN", standByMe, "roles", "Vern Tessio");
- coreyF.addEdge("ACTED_IN", standByMe, "roles", "Teddy Duchamp");
- johnC.addEdge("ACTED_IN", standByMe, "roles", "Denny Lachance");
- kieferS.addEdge("ACTED_IN", standByMe, "roles", "ace Merrill");
- marshallB.addEdge("ACTED_IN", standByMe, "roles", "Mr. Lachance");
- robR.addEdge("DIRECTED", standByMe, "score", 10);
-
- Vertex asGoodasItGets = graph.addVertex(T.LABEL, "movie", "title",
- "as Good as It Gets", "released", 1997);
-
- Vertex helenH = graph.addVertex(T.LABEL,
- "person", "name", "Helen Hunt", "born", 1963);
- Vertex gregK = graph.addVertex(T.LABEL,
- "person", "name", "Greg Kinnear", "born", 1963);
- Vertex jamesB = graph.addVertex(T.LABEL,
- "person", "name", "James L. Brooks", "born", 1940);
-
- jackN.addEdge("ACTED_IN", asGoodasItGets, "roles", "Melvin Udall");
- helenH.addEdge("ACTED_IN", asGoodasItGets, "roles", "Carol Connelly");
- gregK.addEdge("ACTED_IN", asGoodasItGets, "roles", "Simon Bishop");
- cubaG.addEdge("ACTED_IN", asGoodasItGets, "roles", "Frank Sachs");
- jamesB.addEdge("DIRECTED", asGoodasItGets, "score", 10);
-
- Vertex whatDreamsMayCome = graph.addVertex(T.LABEL, "movie", "title",
- "What Dreams May Come", "released", 1998);
-
- Vertex annabellaS = graph.addVertex(T.LABEL,
- "person", "name", "annabella Sciorra", "born", 1960);
- Vertex maxS = graph.addVertex(T.LABEL,
- "person", "name", "Max von Sydow", "born", 1929);
- Vertex wernerH = graph.addVertex(T.LABEL,
- "person", "name", "Werner Herzog", "born", 1942);
- Vertex robin = graph.addVertex(T.LABEL,
- "person", "name", "robin Williams", "born", 1951);
- Vertex vincentW = graph.addVertex(T.LABEL,
- "person", "name", "Vincent Ward", "born", 1956);
-
- robin.addEdge("ACTED_IN", whatDreamsMayCome, "roles", "Chris Nielsen");
- cubaG.addEdge("ACTED_IN", whatDreamsMayCome, "roles", "albert Lewis");
- annabellaS.addEdge("ACTED_IN", whatDreamsMayCome, "roles", "annie Collins-Nielsen");
- maxS.addEdge("ACTED_IN", whatDreamsMayCome, "roles", "The Tracker");
- wernerH.addEdge("ACTED_IN", whatDreamsMayCome, "roles", "The Face");
- vincentW.addEdge("DIRECTED", whatDreamsMayCome, "score", 10);
-
- Vertex snowFallingonCedars = graph.addVertex(T.LABEL, "movie", "title",
- "Snow Falling on Cedars", "released", 1999);
-
- Vertex ethanH = graph.addVertex(T.LABEL,
- "person", "name", "Ethan Hawke", "born", 1970);
- Vertex rickY = graph.addVertex(T.LABEL,
- "person", "name", "Rick Yune", "born", 1971);
- Vertex jamesC = graph.addVertex(T.LABEL,
- "person", "name", "James Cromwell", "born", 1940);
- Vertex scottH = graph.addVertex(T.LABEL,
- "person", "name", "Scott Hicks", "born", 1953);
-
- ethanH.addEdge("ACTED_IN", snowFallingonCedars, "roles", "Ishmael Chambers");
- rickY.addEdge("ACTED_IN", snowFallingonCedars, "roles", "Kazuo Miyamoto");
- maxS.addEdge("ACTED_IN", snowFallingonCedars, "roles", "Nels Gudmundsson");
- jamesC.addEdge("ACTED_IN", snowFallingonCedars, "roles", "Judge Fielding");
- scottH.addEdge("DIRECTED", snowFallingonCedars, "score", 10);
-
- Vertex youveGotMail = graph.addVertex(T.LABEL, "movie", "title",
- "You've Got Mail", "released", 1998);
-
- Vertex parkerP = graph.addVertex(T.LABEL,
- "person", "name", "Parker Posey", "born", 1968);
- Vertex daveC = graph.addVertex(T.LABEL,
- "person", "name", "Dave Chappelle", "born", 1973);
- Vertex steveZ = graph.addVertex(T.LABEL,
- "person", "name", "Steve Zahn", "born", 1967);
- Vertex tomH = graph.addVertex(T.LABEL,
- "person", "name", "Tom Hanks", "born", 1956);
- Vertex noraE = graph.addVertex(T.LABEL,
- "person", "name", "Nora Ephron", "born", 1941);
-
- tomH.addEdge("ACTED_IN", youveGotMail, "roles", "Joe Fox");
- megR.addEdge("ACTED_IN", youveGotMail, "roles", "Kathleen Kelly");
- gregK.addEdge("ACTED_IN", youveGotMail, "roles", "Frank Navasky");
- parkerP.addEdge("ACTED_IN", youveGotMail, "roles", "Patricia Eden");
- daveC.addEdge("ACTED_IN", youveGotMail, "roles", "Kevin Jackson");
- steveZ.addEdge("ACTED_IN", youveGotMail, "roles", "George Pappas");
- noraE.addEdge("DIRECTED", youveGotMail, "score", 10);
-
- Vertex sleeplessInSeattle = graph.addVertex(T.LABEL, "movie", "title",
- "Sleepless in Seattle", "released", 1993);
-
- Vertex ritaW = graph.addVertex(T.LABEL,
- "person", "name", "Rita Wilson", "born", 1956);
- Vertex billPull = graph.addVertex(T.LABEL,
- "person", "name", "Bill Pullman", "born", 1953);
- Vertex victorG = graph.addVertex(T.LABEL,
- "person", "name", "Victor Garber", "born", 1949);
- Vertex rosieO = graph.addVertex(T.LABEL,
- "person", "name", "Rosie O'Donnell", "born", 1962);
-
- tomH.addEdge("ACTED_IN", sleeplessInSeattle, "roles", "Sam Baldwin");
- megR.addEdge("ACTED_IN", sleeplessInSeattle, "roles", "annie Reed");
- ritaW.addEdge("ACTED_IN", sleeplessInSeattle, "roles", "Suzy");
- billPull.addEdge("ACTED_IN", sleeplessInSeattle, "roles", "Walter");
- victorG.addEdge("ACTED_IN", sleeplessInSeattle, "roles", "Greg");
- rosieO.addEdge("ACTED_IN", sleeplessInSeattle, "roles", "Becky");
- noraE.addEdge("DIRECTED", sleeplessInSeattle, "score", 10);
-
- Vertex joeVersustheVolcano = graph.addVertex(T.LABEL, "movie", "title",
- "Joe Versus the Volcano", "released", 1990);
-
- Vertex johnS = graph.addVertex(T.LABEL,
- "person", "name", "John Patrick Stanley", "born", 1950);
- Vertex nathan = graph.addVertex(T.LABEL,
- "person", "name", "nathan Lane", "born", 1956);
-
- tomH.addEdge("ACTED_IN", joeVersustheVolcano, "roles", "Joe Banks");
- megR.addEdge("ACTED_IN", joeVersustheVolcano, "roles",
- "DeDe, angelica Graynamore, Patricia Graynamore");
- nathan.addEdge("ACTED_IN", joeVersustheVolcano, "roles", "Baw");
- johnS.addEdge("DIRECTED", joeVersustheVolcano, "score", 10);
-
- Vertex whenHarryMetSally = graph.addVertex(T.LABEL, "movie", "title",
- "When Harry Met Sally", "released", 1998);
-
- Vertex billyC = graph.addVertex(T.LABEL,
- "person", "name", "Billy Crystal", "born", 1948);
- Vertex carrieF = graph.addVertex(T.LABEL,
- "person", "name", "carrie Fisher", "born", 1956);
- Vertex brunoK = graph.addVertex(T.LABEL,
- "person", "name", "Bruno Kirby", "born", 1949);
-
- billyC.addEdge("ACTED_IN", whenHarryMetSally, "roles", "Harry Burns");
- megR.addEdge("ACTED_IN", whenHarryMetSally, "roles", "Sally albright");
- carrieF.addEdge("ACTED_IN", whenHarryMetSally, "roles", "Marie");
- brunoK.addEdge("ACTED_IN", whenHarryMetSally, "roles", "Jess");
- robR.addEdge("DIRECTED", whenHarryMetSally, "score", 10);
- robR.addEdge("PRODUCED", whenHarryMetSally, "score", 10);
- noraE.addEdge("PRODUCED", whenHarryMetSally, "score", 10);
- noraE.addEdge("WROTE", whenHarryMetSally, "score", 10);
-
- Vertex thatThingYouDo = graph.addVertex(T.LABEL, "movie", "title",
- "That Thing You Do", "released", 1996);
-
- Vertex livT = graph.addVertex(T.LABEL,
- "person", "name", "Liv Tyler", "born", 1977);
-
- tomH.addEdge("ACTED_IN", thatThingYouDo, "roles", "Mr. White");
- livT.addEdge("ACTED_IN", thatThingYouDo, "roles", "Faye Dolan");
- charlize.addEdge("ACTED_IN", thatThingYouDo, "roles", "Tina");
- tomH.addEdge("DIRECTED", thatThingYouDo, "score", 10);
-
- Vertex theReplacements = graph.addVertex(T.LABEL, "movie", "title",
- "The Replacements", "released", 2000);
-
- Vertex brooke = graph.addVertex(T.LABEL,
- "person", "name", "brooke Langton", "born", 1970);
- Vertex gene = graph.addVertex(T.LABEL,
- "person", "name", "gene Hackman", "born", 1930);
- Vertex orlando = graph.addVertex(T.LABEL,
- "person", "name", "orlando Jones", "born", 1968);
- Vertex howard = graph.addVertex(T.LABEL,
- "person", "name", "howard Deutch", "born", 1950);
-
- keanu.addEdge("ACTED_IN", theReplacements, "roles", "Shane Falco");
- brooke.addEdge("ACTED_IN", theReplacements, "roles", "annabelle Farrell");
- gene.addEdge("ACTED_IN", theReplacements, "roles", "Jimmy McGinty");
- orlando.addEdge("ACTED_IN", theReplacements, "roles", "Clifford Franklin");
- howard.addEdge("DIRECTED", theReplacements, "score", 10);
-
- Vertex rescueDawn = graph.addVertex(T.LABEL,
- "movie", "title", "rescueDawn", "released", 2006);
-
- Vertex christianB = graph.addVertex(T.LABEL,
- "person", "name", "Christian Bale", "born", 1974);
- Vertex zachG = graph.addVertex(T.LABEL,
- "person", "name", "Zach Grenier", "born", 1954);
-
- marshallB.addEdge("ACTED_IN", rescueDawn, "roles", "admiral");
- christianB.addEdge("ACTED_IN", rescueDawn, "roles", "Dieter Dengler");
- zachG.addEdge("ACTED_IN", rescueDawn, "roles", "Squad Leader");
- steveZ.addEdge("ACTED_IN", rescueDawn, "roles", "Duane");
- wernerH.addEdge("DIRECTED", rescueDawn, "score", 10);
-
- Vertex theBirdcage = graph.addVertex(T.LABEL,
- "movie", "title", "The Birdcage", "released", 1996);
-
- Vertex mikeN = graph.addVertex(T.LABEL,
- "person", "name", "Mike Nichols", "born", 1931);
-
- robin.addEdge("ACTED_IN", theBirdcage, "roles", "armand Goldman");
- nathan.addEdge("ACTED_IN", theBirdcage, "roles", "albert Goldman");
- gene.addEdge("ACTED_IN", theBirdcage, "roles", "Sen. Kevin Keeley");
- mikeN.addEdge("DIRECTED", theBirdcage, "score", 10);
-
- Vertex unforgiven = graph.addVertex(T.LABEL,
- "movie", "title", "unforgiven", "released", 1992);
-
- Vertex richardH = graph.addVertex(T.LABEL,
- "person", "name", "Richard Harris", "born", 1930);
- Vertex clintE = graph.addVertex(T.LABEL,
- "person", "name", "Richard Harris", "born", 1930);
-
- richardH.addEdge("ACTED_IN", unforgiven, "roles", "English Bob");
- clintE.addEdge("ACTED_IN", unforgiven, "roles", "Bill Munny");
- gene.addEdge("ACTED_IN", unforgiven, "roles", "Little Bill Daggett");
- clintE.addEdge("DIRECTED", unforgiven, "score", 10);
-
- Vertex johnnyMnemonic = graph.addVertex(T.LABEL, "movie", "title",
- "Johnny Mnemonic", "released", 1995);
-
- Vertex takeshi = graph.addVertex(T.LABEL,
- "person", "name", "takeshi Kitano", "born", 1947);
- Vertex dina = graph.addVertex(T.LABEL,
- "person", "name", "dina Meyer", "born", 1968);
- Vertex iceT = graph.addVertex(T.LABEL,
- "person", "name", "Ice-T", "born", 1958);
- Vertex robertL = graph.addVertex(T.LABEL,
- "person", "name", "Robert Longo", "born", 1953);
-
- keanu.addEdge("ACTED_IN", johnnyMnemonic, "roles", "Johnny Mnemonic");
- takeshi.addEdge("ACTED_IN", johnnyMnemonic, "roles", "Takahashi");
- dina.addEdge("ACTED_IN", johnnyMnemonic, "roles", "Jane");
- iceT.addEdge("ACTED_IN", johnnyMnemonic, "roles", "J-Bone");
- robertL.addEdge("DIRECTED", johnnyMnemonic, "score", 10);
-
- Vertex cloudatlas = graph.addVertex(T.LABEL,
- "movie", "title", "Cloud atlas", "released", 2012);
-
- Vertex halleB = graph.addVertex(T.LABEL,
- "person", "name", "Halle Berry", "born", 1966);
- Vertex jimB = graph.addVertex(T.LABEL,
- "person", "name", "Jim Broadbent", "born", 1949);
- Vertex tomT = graph.addVertex(T.LABEL,
- "person", "name", "Tom Tykwer", "born", 1965);
- Vertex davidMitchell = graph.addVertex(T.LABEL,
- "person", "name", "David Mitchell", "born", 1969);
- Vertex stefanarndt = graph.addVertex(T.LABEL,
- "person", "name", "Stefan arndt", "born", 1961);
-
- tomH.addEdge("ACTED_IN", cloudatlas, "roles",
- "Zachry, Dr. Henry Goose, Isaac Sachs, Dermot Hoggins");
- hugo.addEdge("ACTED_IN", cloudatlas, "roles",
- "Bill Smoke, Haskell Moore, Tadeusz Kesselring, " +
- "Nurse Noakes, Boardman Mephi, Old Georgie");
- halleB.addEdge("ACTED_IN", cloudatlas, "roles",
- "Luisa Rey, Jocasta ayrs, Ovid, Meronym");
- jimB.addEdge("ACTED_IN", cloudatlas, "roles",
- "Vyvyan ayrs, Captain Molyneux, Timothy Cavendish");
- tomT.addEdge("DIRECTED", cloudatlas, "score", 10);
- lillyW.addEdge("DIRECTED", cloudatlas, "score", 10);
- lanaW.addEdge("DIRECTED", cloudatlas, "score", 10);
- davidMitchell.addEdge("WROTE", cloudatlas, "score", 10);
- stefanarndt.addEdge("PRODUCED", cloudatlas, "score", 10);
-
- Vertex theDaVinciCode = graph.addVertex(T.LABEL, "movie", "title",
- "The Da Vinci Code", "released", 2006);
-
- Vertex ianM = graph.addVertex(T.LABEL,
- "person", "name", "Ian McKellen", "born", 1939);
- Vertex audreyT = graph.addVertex(T.LABEL,
- "person", "name", "audrey Tautou", "born", 1976);
- Vertex paulB = graph.addVertex(T.LABEL,
- "person", "name", "Paul Bettany", "born", 1971);
- Vertex ronH = graph.addVertex(T.LABEL,
- "person", "name", "Ron howard", "born", 1954);
-
- tomH.addEdge("ACTED_IN", theDaVinciCode, "roles", "Dr. Robert Langdon");
- ianM.addEdge("ACTED_IN", theDaVinciCode, "roles", "Sir Leight Teabing");
- audreyT.addEdge("ACTED_IN", theDaVinciCode, "roles", "Sophie Neveu");
- paulB.addEdge("ACTED_IN", theDaVinciCode, "roles", "Silas");
- ronH.addEdge("DIRECTED", theDaVinciCode, "score", 10);
-
- Vertex vforVendetta = graph.addVertex(T.LABEL, "movie", "title",
- "The Da Vinci Code", "released", 2006);
-
- Vertex natalieP = graph.addVertex(T.LABEL,
- "person", "name", "Natalie Portman", "born", 1981);
- Vertex stephenR = graph.addVertex(T.LABEL,
- "person", "name", "Stephen Rea", "born", 1946);
- Vertex johnH = graph.addVertex(T.LABEL,
- "person", "name", "John Hurt", "born", 1940);
- Vertex benM = graph.addVertex(T.LABEL,
- "person", "name", "Ben Miles", "born", 1967);
-
- hugo.addEdge("ACTED_IN", vforVendetta, "roles", "V");
- natalieP.addEdge("ACTED_IN", vforVendetta, "roles", "Evey Hammond");
- stephenR.addEdge("ACTED_IN", vforVendetta, "roles", "Eric Finch");
- johnH.addEdge("ACTED_IN", vforVendetta, "roles",
- "High Chancellor adam Sutler");
- benM.addEdge("ACTED_IN", vforVendetta, "roles", "Dascomb");
- jamesM.addEdge("DIRECTED", vforVendetta, "score", 10);
- lillyW.addEdge("PRODUCED", vforVendetta, "score", 10);
- lanaW.addEdge("PRODUCED", vforVendetta, "score", 10);
- joelS.addEdge("PRODUCED", vforVendetta, "score", 10);
- lillyW.addEdge("WROTE", vforVendetta, "score", 10);
- lanaW.addEdge("WROTE", vforVendetta, "score", 10);
-
- Vertex speedRacer = graph.addVertex(T.LABEL,
- "movie", "title", "Speed Racer", "released", 2008);
-
- Vertex matthewF = graph.addVertex(T.LABEL,
- "person", "name", "Matthew Fox", "born", 1966);
- Vertex emileH = graph.addVertex(T.LABEL,
- "person", "name", "Emile Hirsch", "born", 1985);
- Vertex johnG = graph.addVertex(T.LABEL,
- "person", "name", "John Goodman", "born", 1940);
- Vertex susanS = graph.addVertex(T.LABEL,
- "person", "name", "Susan Sarandon", "born", 1966);
- Vertex christinaR = graph.addVertex(T.LABEL,
- "person", "name", "Christina Ricci", "born", 1980);
- Vertex rain = graph.addVertex(T.LABEL,
- "person", "name", "Rain", "born", 1982);
-
- emileH.addEdge("ACTED_IN", speedRacer, "roles", "Speed Racer");
- johnG.addEdge("ACTED_IN", speedRacer, "roles", "Pops");
- susanS.addEdge("ACTED_IN", speedRacer, "roles", "Mom");
- matthewF.addEdge("ACTED_IN", speedRacer, "roles", "Racer X");
- christinaR.addEdge("ACTED_IN", speedRacer, "roles", "Trixie");
- rain.addEdge("ACTED_IN", speedRacer, "roles", "Taejo Togokahn");
- benM.addEdge("ACTED_IN", speedRacer, "roles", "Kass Jones");
- lillyW.addEdge("DIRECTED", speedRacer, "score", 10);
- lanaW.addEdge("DIRECTED", speedRacer, "score", 10);
- lillyW.addEdge("WROTE", speedRacer, "score", 10);
- lanaW.addEdge("WROTE", speedRacer, "score", 10);
- joelS.addEdge("PRODUCED", speedRacer, "score", 10);
-
- Vertex ninjaassassin = graph.addVertex(T.LABEL, "movie", "title",
- "Speed Racer", "released", 2009);
-
- Vertex naomieH = graph.addVertex(T.LABEL, "person", "name",
- "Naomie Harris", "born", 1982);
-
- rain.addEdge("ACTED_IN", ninjaassassin, "roles", "Raizo");
- naomieH.addEdge("ACTED_IN", ninjaassassin, "roles", "Mika Coretti");
- rickY.addEdge("ACTED_IN", ninjaassassin, "roles", "takeshi");
- benM.addEdge("ACTED_IN", ninjaassassin, "roles", "Ryan Maslow");
- jamesM.addEdge("DIRECTED", ninjaassassin, "score", 10);
- lillyW.addEdge("PRODUCED", ninjaassassin, "score", 10);
- lanaW.addEdge("PRODUCED", ninjaassassin, "score", 10);
- joelS.addEdge("PRODUCED", ninjaassassin, "score", 10);
-
- Vertex theGreenMile = graph.addVertex(T.LABEL,
- "movie", "title", "The Green Mile", "released", 1999);
-
- Vertex michaelD = graph.addVertex(T.LABEL,
- "person", "name", "Michael Clarke Duncan", "born", 1957);
- Vertex davidM = graph.addVertex(T.LABEL,
- "person", "name", "David Morse", "born", 1953);
- Vertex samR = graph.addVertex(T.LABEL,
- "person", "name", "Sam Rockwell", "born", 1968);
- Vertex garyS = graph.addVertex(T.LABEL,
- "person", "name", "Gary Sinise", "born", 1955);
- Vertex patriciaC = graph.addVertex(T.LABEL,
- "person", "name", "Patricia Clarkson", "born", 1959);
- Vertex frankD = graph.addVertex(T.LABEL,
- "person", "name", "Frank Darabont", "born", 1959);
-
- tomH.addEdge("ACTED_IN", theGreenMile, "roles", "Paul Edgecomb");
- michaelD.addEdge("ACTED_IN", theGreenMile, "roles", "John Coffey");
- davidM.addEdge("ACTED_IN", theGreenMile, "roles", "Brutus");
- bonnieH.addEdge("ACTED_IN", theGreenMile, "roles", "Jan Edgecomb");
- jamesC.addEdge("ACTED_IN", theGreenMile, "roles", "Warden Hal Moores");
- samR.addEdge("ACTED_IN", theGreenMile, "roles", "Wild Bill' Wharton");
- garyS.addEdge("ACTED_IN", theGreenMile, "roles", "Burt Hammersmith");
- patriciaC.addEdge("ACTED_IN", theGreenMile, "roles", "Melinda Moores");
- frankD.addEdge("DIRECTED", theGreenMile, "score", 10);
-
- Vertex frostNixon = graph.addVertex(T.LABEL, "movie", "title",
- "Frost/Nixon", "released", 2008);
-
- Vertex frankL = graph.addVertex(T.LABEL,
- "person", "name", "Frank Langella", "born", 1938);
- Vertex michaelS = graph.addVertex(T.LABEL,
- "person", "name", "Michael Sheen", "born", 1969);
- Vertex oliverP = graph.addVertex(T.LABEL,
- "person", "name", "Oliver Platt", "born", 1960);
-
- frankL.addEdge("ACTED_IN", frostNixon, "roles", "Richard Nixon");
- michaelS.addEdge("ACTED_IN", frostNixon, "roles", "David Frost");
- kevinB.addEdge("ACTED_IN", frostNixon, "roles", "Jack Brennan");
- oliverP.addEdge("ACTED_IN", frostNixon, "roles", "Bob Zelnick");
- samR.addEdge("ACTED_IN", frostNixon, "roles", "James Reston, Jr.");
- ronH.addEdge("DIRECTED", frostNixon, "score", 10);
-
- Vertex hoffa = graph.addVertex(T.LABEL,
- "movie", "title", "hoffa", "released", 1992);
-
- Vertex dannyD = graph.addVertex(T.LABEL,
- "person", "name", "Danny DeVito", "born", 1944);
- Vertex johnR = graph.addVertex(T.LABEL,
- "person", "name", "John C. Reilly", "born", 1965);
-
- jackN.addEdge("ACTED_IN", hoffa, "roles", "hoffa");
- dannyD.addEdge("ACTED_IN", hoffa, "roles", "Robert Ciaro");
- jtw.addEdge("ACTED_IN", hoffa, "roles", "Frank Fitzsimmons");
- johnR.addEdge("ACTED_IN", hoffa, "roles", "Peter Connelly");
- dannyD.addEdge("DIRECTED", hoffa, "score", 10);
-
- Vertex apollo13 = graph.addVertex(T.LABEL,
- "movie", "title", "apollo 13", "released", 1995);
-
- Vertex edH = graph.addVertex(T.LABEL,
- "person", "name", "Ed Harris", "born", 1950);
- Vertex billPax = graph.addVertex(T.LABEL,
- "person", "name", "Bill Paxton", "born", 1955);
-
- tomH.addEdge("ACTED_IN", apollo13, "roles", "Jim Lovell");
- kevinB.addEdge("ACTED_IN", apollo13, "roles", "Jack Swigert");
- edH.addEdge("ACTED_IN", apollo13, "roles", "gene Kranz");
- billPax.addEdge("ACTED_IN", apollo13, "roles", "Fred Haise");
- garyS.addEdge("ACTED_IN", apollo13, "roles", "Ken Mattingly");
- ronH.addEdge("DIRECTED", apollo13, "score", 10);
-
- Vertex twister = graph.addVertex(T.LABEL,
- "movie", "title", "twister", "released", 1996);
-
- Vertex philipH = graph.addVertex(T.LABEL,
- "person", "name", "Philip Seymour Hoffman", "born", 1967);
- Vertex janB = graph.addVertex(T.LABEL,
- "person", "name", "Jan de Bont", "born", 1943);
-
- billPax.addEdge("ACTED_IN", twister, "roles", "Bill Harding");
- helenH.addEdge("ACTED_IN", twister, "roles", "Dr. Jo Harding");
- zachG.addEdge("ACTED_IN", twister, "roles", "Eddie");
- philipH.addEdge("ACTED_IN", twister, "roles", "Dustin 'Dusty' Davis");
- janB.addEdge("DIRECTED", twister, "score", 10);
-
- Vertex castaway = graph.addVertex(T.LABEL,
- "movie", "title", "Cast away", "released", 2000);
-
- Vertex robertZ = graph.addVertex(T.LABEL,
- "person", "name", "Robert Zemeckis", "born", 1951);
-
- tomH.addEdge("ACTED_IN", castaway, "roles", "Chuck Noland");
- helenH.addEdge("ACTED_IN", castaway, "roles", "Kelly Frears");
- robertZ.addEdge("DIRECTED", castaway, "score", 10);
-
- Vertex oneFlewOvertheCuckoosNest = graph.addVertex(T.LABEL, "movie", "title",
- "One Flew Over the Cuckoo's Nest",
- "released", 1975);
-
- Vertex milosF = graph.addVertex(T.LABEL,
- "person", "name", "Milos Forman", "born", 1932);
-
- jackN.addEdge("ACTED_IN", oneFlewOvertheCuckoosNest, "roles", "Randle McMurphy");
- dannyD.addEdge("ACTED_IN", oneFlewOvertheCuckoosNest, "roles", "Martini");
- milosF.addEdge("DIRECTED", oneFlewOvertheCuckoosNest, "score", 10);
-
- Vertex somethingsGottaGive = graph.addVertex(T.LABEL, "movie", "title",
- "Something's Gotta Give", "released", 2003);
-
- Vertex dianeK = graph.addVertex(T.LABEL,
- "person", "name", "Diane Keaton", "born", 1946);
- Vertex nancyM = graph.addVertex(T.LABEL,
- "person", "name", "Nancy Meyers", "born", 1949);
-
- jackN.addEdge("ACTED_IN", somethingsGottaGive, "roles", "Harry Sanborn");
- dianeK.addEdge("ACTED_IN", somethingsGottaGive, "roles", "Erica Barry");
- keanu.addEdge("ACTED_IN", somethingsGottaGive, "roles", "Julian Mercer");
- nancyM.addEdge("DIRECTED", somethingsGottaGive, "score", 10);
- nancyM.addEdge("PRODUCED", somethingsGottaGive, "score", 10);
- nancyM.addEdge("WROTE", somethingsGottaGive, "score", 10);
-
- Vertex bicentennialMan = graph.addVertex(T.LABEL, "movie", "title",
- "Bicentennial Man", "released", 2000);
-
- Vertex chrisC = graph.addVertex(T.LABEL,
- "person", "name", "Chris Columbus", "born", 1958);
-
- robin.addEdge("ACTED_IN", bicentennialMan, "roles", "andrew Marin");
- oliverP.addEdge("ACTED_IN", bicentennialMan, "roles", "Rupert Burns");
- chrisC.addEdge("DIRECTED", bicentennialMan, "score", 10);
-
- Vertex charlieWilsonsWar = graph.addVertex(T.LABEL, "movie", "title",
- "Charlie Wilson's War", "released", 2007);
-
- Vertex juliaR = graph.addVertex(T.LABEL,
- "person", "name", "Julia Roberts", "born", 1967);
-
- tomH.addEdge("ACTED_IN", charlieWilsonsWar, "roles", "Rep. Charlie Wilson");
- juliaR.addEdge("ACTED_IN", charlieWilsonsWar, "roles", "Joanne Herring");
- philipH.addEdge("ACTED_IN", charlieWilsonsWar, "roles", "Gust avrakotos");
- mikeN.addEdge("DIRECTED", charlieWilsonsWar, "score", 10);
-
- Vertex thePolarExpress = graph.addVertex(T.LABEL, "movie", "title",
- "The Polar Express", "released", 2004);
-
- tomH.addEdge("ACTED_IN", thePolarExpress, "roles", "Hero Boy");
-
- robertZ.addEdge("DIRECTED", thePolarExpress, "score", 10);
-
- Vertex aLeagueofTheirOwn = graph.addVertex(T.LABEL, "movie", "title",
- "a League of Their Own", "released", 1992);
-
- Vertex madonna = graph.addVertex(T.LABEL,
- "person", "name", "madonna", "born", 1954);
- Vertex geenaD = graph.addVertex(T.LABEL,
- "person", "name", "Geena Davis", "born", 1956);
- Vertex loriP = graph.addVertex(T.LABEL,
- "person", "name", "Lori Petty", "born", 1963);
- Vertex pennyM = graph.addVertex(T.LABEL,
- "person", "name", "Penny Marshall", "born", 1943);
-
- tomH.addEdge("ACTED_IN", aLeagueofTheirOwn, "roles", "Jimmy Dugan");
- geenaD.addEdge("ACTED_IN", aLeagueofTheirOwn, "roles", "Dottie Hinson");
- loriP.addEdge("ACTED_IN", aLeagueofTheirOwn, "roles", "Kit Keller");
- rosieO.addEdge("ACTED_IN", aLeagueofTheirOwn, "roles", "Doris Murphy");
- madonna.addEdge("ACTED_IN", aLeagueofTheirOwn, "roles",
- "all the Way' Mae Mordabito");
- billPax.addEdge("ACTED_IN", aLeagueofTheirOwn, "roles", "Bob Hinson");
- pennyM.addEdge("DIRECTED", aLeagueofTheirOwn, "score", 10);
-
- hugeClient.close();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/example/SingleExample.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/example/SingleExample.java
deleted file mode 100644
index 123ddcde..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/example/SingleExample.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.example;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import com.baidu.hugegraph.driver.GraphManager;
-import com.baidu.hugegraph.driver.GremlinManager;
-import com.baidu.hugegraph.driver.HugeClient;
-import com.baidu.hugegraph.driver.SchemaManager;
-import com.baidu.hugegraph.structure.constant.T;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.graph.Path;
-import com.baidu.hugegraph.structure.graph.Vertex;
-import com.baidu.hugegraph.structure.gremlin.Result;
-import com.baidu.hugegraph.structure.gremlin.ResultSet;
-
-public class SingleExample {
-
- public static void main(String[] args) throws IOException {
- // If connect failed will throw a exception.
- HugeClient hugeClient = HugeClient.builder("http://localhost:8080",
- "hugegraph").build();
-
- SchemaManager schema = hugeClient.schema();
-
- schema.propertyKey("name").asText().ifNotExist().create();
- schema.propertyKey("age").asInt().ifNotExist().create();
- schema.propertyKey("city").asText().ifNotExist().create();
- schema.propertyKey("weight").asDouble().ifNotExist().create();
- schema.propertyKey("lang").asText().ifNotExist().create();
- schema.propertyKey("date").asDate().ifNotExist().create();
- schema.propertyKey("price").asInt().ifNotExist().create();
-
- schema.vertexLabel("person")
- .properties("name", "age", "city")
- .primaryKeys("name")
- .ifNotExist()
- .create();
-
- schema.vertexLabel("software")
- .properties("name", "lang", "price")
- .primaryKeys("name")
- .ifNotExist()
- .create();
-
- schema.indexLabel("personByCity")
- .onV("person")
- .by("city")
- .secondary()
- .ifNotExist()
- .create();
-
- schema.indexLabel("personByAgeAndCity")
- .onV("person")
- .by("age", "city")
- .secondary()
- .ifNotExist()
- .create();
-
- schema.indexLabel("softwareByPrice")
- .onV("software")
- .by("price")
- .range()
- .ifNotExist()
- .create();
-
- schema.edgeLabel("knows")
- .sourceLabel("person")
- .targetLabel("person")
- .properties("date", "weight")
- .ifNotExist()
- .create();
-
- schema.edgeLabel("created")
- .sourceLabel("person").targetLabel("software")
- .properties("date", "weight")
- .ifNotExist()
- .create();
-
- schema.indexLabel("createdByDate")
- .onE("created")
- .by("date")
- .secondary()
- .ifNotExist()
- .create();
-
- schema.indexLabel("createdByWeight")
- .onE("created")
- .by("weight")
- .range()
- .ifNotExist()
- .create();
-
- schema.indexLabel("knowsByWeight")
- .onE("knows")
- .by("weight")
- .range()
- .ifNotExist()
- .create();
-
- GraphManager graph = hugeClient.graph();
- Vertex marko = graph.addVertex(T.LABEL, "person", "name", "marko",
- "age", 29, "city", "Beijing");
- Vertex vadas = graph.addVertex(T.LABEL, "person", "name", "vadas",
- "age", 27, "city", "Hongkong");
- Vertex lop = graph.addVertex(T.LABEL, "software", "name", "lop",
- "lang", "java", "price", 328);
- Vertex josh = graph.addVertex(T.LABEL, "person", "name", "josh",
- "age", 32, "city", "Beijing");
- Vertex ripple = graph.addVertex(T.LABEL, "software", "name", "ripple",
- "lang", "java", "price", 199);
- Vertex peter = graph.addVertex(T.LABEL, "person", "name", "peter",
- "age", 35, "city", "Shanghai");
-
- marko.addEdge("knows", vadas, "date", "2016-01-10", "weight", 0.5);
- marko.addEdge("knows", josh, "date", "2013-02-20", "weight", 1.0);
- marko.addEdge("created", lop, "date", "2017-12-10", "weight", 0.4);
- josh.addEdge("created", lop, "date", "2009-11-11", "weight", 0.4);
- josh.addEdge("created", ripple, "date", "2017-12-10", "weight", 1.0);
- peter.addEdge("created", lop, "date", "2017-03-24", "weight", 0.2);
-
- GremlinManager gremlin = hugeClient.gremlin();
- System.out.println("==== Path ====");
- ResultSet resultSet = gremlin.gremlin("g.V().outE().path()").execute();
- Iterator<Result> results = resultSet.iterator();
- results.forEachRemaining(result -> {
- System.out.println(result.getObject().getClass());
- Object object = result.getObject();
- if (object instanceof Vertex) {
- System.out.println(((Vertex) object).id());
- } else if (object instanceof Edge) {
- System.out.println(((Edge) object).id());
- } else if (object instanceof Path) {
- List<Object> elements = ((Path) object).objects();
- elements.forEach(element -> {
- System.out.println(element.getClass());
- System.out.println(element);
- });
- } else {
- System.out.println(object);
- }
- });
-
- hugeClient.close();
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/InvalidOperationException.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/InvalidOperationException.java
deleted file mode 100644
index 0daa135f..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/InvalidOperationException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.exception;
-
-
-import org.apache.hugegraph.rest.ClientException;
-
-public class InvalidOperationException extends ClientException {
-
- private static final long serialVersionUID = -7618213317796656644L;
-
- public InvalidOperationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidOperationException(String message, Object... args) {
- super(message, args);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/InvalidResponseException.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/InvalidResponseException.java
deleted file mode 100644
index 9a2de173..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/InvalidResponseException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.exception;
-
-import org.apache.hugegraph.rest.ClientException;
-
-public class InvalidResponseException extends ClientException {
-
- private static final long serialVersionUID = -6837901607110262081L;
-
- public InvalidResponseException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidResponseException(String message, Object... args) {
- super(message, args);
- }
-
- public static InvalidResponseException expectField(String expectField,
- Object parentField) {
- return new InvalidResponseException(
- "Invalid response, expect '%s' in '%s'",
- expectField, parentField);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/NotAllCreatedException.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/NotAllCreatedException.java
deleted file mode 100644
index 80e59a87..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/NotAllCreatedException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.exception;
-
-import java.util.Collection;
-
-public class NotAllCreatedException extends ServerException {
-
- private static final long serialVersionUID = -8795820552805040556L;
-
- private Collection<?> ids;
-
- public NotAllCreatedException(String message, Collection<?> ids,
- Object... args) {
- super(message, args);
- this.ids = ids;
- }
-
- public Collection<?> ids() {
- return this.ids;
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/NotSupportException.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/NotSupportException.java
deleted file mode 100644
index 94b6bdc9..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/NotSupportException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.exception;
-
-import org.apache.hugegraph.rest.ClientException;
-
-public class NotSupportException extends ClientException {
-
- private static final long serialVersionUID = -8711375282196157056L;
-
- private static final String PREFIX = "Not support ";
-
- public NotSupportException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public NotSupportException(String message, Object... args) {
- super(PREFIX + message, args);
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/ServerException.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/ServerException.java
deleted file mode 100644
index 7cbf3912..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/exception/ServerException.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.exception;
-
-import java.util.Map;
-
-import org.apache.hugegraph.rest.RestResult;
-import jakarta.ws.rs.core.Response;
-
-public class ServerException extends RuntimeException {
-
- private static final long serialVersionUID = 6335623004322652358L;
-
- private static final String[] EXCEPTION_KEYS = {"exception",
- "Exception-Class"};
- private static final String[] MESSAGE_KEYS = {"message"};
- private static final String[] CAUSE_KEYS = {"cause", "exceptions"};
- private static final String[] TRACE_KEYS = {"trace", "stackTrace"};
-
-
- private int status = 0;
- private String exception;
- private String message;
- private String cause;
- private Object trace;
-
- public static ServerException fromResponse(Response response) {
- RestResult rs = new RestResult(response);
- ServerException exception = new ServerException(rs.content());
- exception.status(response.getStatus());
- try {
- @SuppressWarnings("unchecked")
- Map<String, Object> json = rs.readObject(Map.class);
- exception.exception = (String) getByKeys(json, EXCEPTION_KEYS);
- exception.message = (String) getByKeys(json, MESSAGE_KEYS);
- exception.cause = (String) getByKeys(json, CAUSE_KEYS);
- exception.trace = getByKeys(json, TRACE_KEYS);
- } catch (Exception ignored) {
- }
-
- return exception;
- }
-
- public ServerException(String message) {
- this.message = message;
- }
-
- public ServerException(String message, Object... args) {
- this(String.format(message, args));
- }
-
- public String exception() {
- return this.exception;
- }
-
- public String message() {
- return this.message;
- }
-
- public String cause() {
- return this.cause;
- }
-
- public Object trace() {
- return this.trace;
- }
-
- @Override
- public String getMessage() {
- return this.message;
- }
-
- @Override
- public Throwable getCause() {
- if (this.cause() == null || this.cause().isEmpty()) {
- return null;
- }
- return new ServerCause(this.cause());
- }
-
- public void status(int status) {
- this.status = status;
- }
-
- public int status() {
- return this.status;
- }
-
- @Override
- public String toString() {
- String s = this.exception;
- String message = getLocalizedMessage();
- return (message != null) ? (s + ": " + message) : s;
- }
-
- private static Object getByKeys(Map<String, Object> json, String[] keys) {
- for (String key : keys) {
- if (json.containsKey(key)) {
- return json.get(key);
- }
- }
- return null;
- }
-
- /**
- * The stack trace of server exception
- */
- private static class ServerCause extends RuntimeException {
-
- private static final long serialVersionUID = 8755660573085501031L;
-
- public ServerCause(String cause) {
- super(cause, null, true, false);
- }
-
- @Override
- public String toString() {
- return super.getMessage();
- }
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/serializer/PathDeserializer.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/serializer/PathDeserializer.java
deleted file mode 100644
index 264aab17..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/serializer/PathDeserializer.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.serializer;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import com.baidu.hugegraph.exception.InvalidResponseException;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.graph.Path;
-import com.baidu.hugegraph.structure.graph.Vertex;
-import com.baidu.hugegraph.util.JsonUtil;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.JsonNodeType;
-
-public class PathDeserializer extends JsonDeserializer<Path> {
-
- @Override
- public Path deserialize(JsonParser parser, DeserializationContext ctxt)
- throws IOException {
-
- JsonNode node = parser.getCodec().readTree(parser);
- Path path = new Path();
-
- // Parse node 'labels'
- JsonNode labelsNode = node.get("labels");
- if (labelsNode != null) {
- if (labelsNode.getNodeType() != JsonNodeType.ARRAY) {
- throw InvalidResponseException.expectField("labels", node);
- }
- Object labels = JsonUtil.convertValue(labelsNode, Object.class);
- ((List<?>) labels).forEach(path::labels);
- }
-
- // Parse node 'objects'
- JsonNode objectsNode = node.get("objects");
- if (objectsNode == null ||
- objectsNode.getNodeType() != JsonNodeType.ARRAY) {
- throw InvalidResponseException.expectField("objects", node);
- }
-
- Iterator<JsonNode> objects = objectsNode.elements();
- while (objects.hasNext()) {
- JsonNode objectNode = objects.next();
- JsonNode typeNode = objectNode.get("type");
- Object object;
- if (typeNode != null) {
- object = parseTypedNode(objectNode, typeNode);
- } else {
- object = JsonUtil.convertValue(objectNode, Object.class);
- }
- path.objects(object);
- }
-
- // Parse node 'crosspoint'
- JsonNode crosspointNode = node.get("crosspoint");
- if (crosspointNode != null) {
- Object object = JsonUtil.convertValue(crosspointNode, Object.class);
- path.crosspoint(object);
- }
- return path;
- }
-
- private Object parseTypedNode(JsonNode objectNode, JsonNode typeNode) {
- String type = typeNode.asText();
- if ("vertex".equals(type)) {
- return JsonUtil.convertValue(objectNode, Vertex.class);
- } else if ("edge".equals(type)) {
- return JsonUtil.convertValue(objectNode, Edge.class);
- } else {
- throw InvalidResponseException.expectField("vertex/edge", type);
- }
- }
-}
diff --git a/hugegraph-client/src/main/java/com/baidu/hugegraph/serializer/direct/HBaseSerializer.java b/hugegraph-client/src/main/java/com/baidu/hugegraph/serializer/direct/HBaseSerializer.java
deleted file mode 100644
index 024618fa..00000000
--- a/hugegraph-client/src/main/java/com/baidu/hugegraph/serializer/direct/HBaseSerializer.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2017 HugeGraph Authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package com.baidu.hugegraph.serializer.direct;
-
-import com.baidu.hugegraph.driver.HugeClient;
-import com.baidu.hugegraph.serializer.direct.struct.HugeType;
-import com.baidu.hugegraph.serializer.direct.util.BytesBuffer;
-import com.baidu.hugegraph.serializer.direct.util.GraphSchema;
-import com.baidu.hugegraph.serializer.direct.util.Id;
-import com.baidu.hugegraph.serializer.direct.util.IdGenerator;
-import com.baidu.hugegraph.structure.GraphElement;
-import com.baidu.hugegraph.structure.graph.Edge;
-import com.baidu.hugegraph.structure.schema.PropertyKey;
-
-import java.util.Arrays;
-import java.util.Map;
-
-/**
- * TODO: review later
- */
-public class HBaseSerializer {
-
- private int edgeLogicPartitions = 30;
- private int vertexLogicPartitions = 10;
- private HugeClient client;
- private GraphSchema graphSchema;
-
-
- public HBaseSerializer(HugeClient client, int vertexPartitions, int edgePartitions){
- this.client = client;
- this.graphSchema = new GraphSchema(client);
- this.edgeLogicPartitions = edgePartitions;
- this.vertexLogicPartitions = vertexPartitions;
- }
-
- public byte[] getKeyBytes(GraphElement e) {
- byte[] array = null;
- if(e.type() == "vertex" && e.id() != null){
- BytesBuffer buffer = BytesBuffer.allocate(2 + 1 + e.id().toString().length());
- buffer.writeShort(getPartition(HugeType.VERTEX, IdGenerator.of(e.id())));
- buffer.writeId(IdGenerator.of(e.id()));
- array = buffer.bytes();
- }else if ( e.type() == "edge" ){
- BytesBuffer buffer = BytesBuffer.allocate(BytesBuffer.BUF_EDGE_ID);
- Edge edge = (Edge)e;
- buffer.writeShort(getPartition(HugeType.EDGE, IdGenerator.of(edge.sourceId())));
- buffer.writeId(IdGenerator.of(edge.sourceId()));
- buffer.write(HugeType.EDGE_OUT.code());
- buffer.writeId(IdGenerator.of(graphSchema.getEdgeLabel(e.label()).id())); //出现错误
- buffer.writeStringWithEnding("");
- buffer.writeId(IdGenerator.of(edge.targetId()));
- array = buffer.bytes();
- }
- return array;
- }
-
- public byte[] getValueBytes(GraphElement e) {
- byte[] array = null;
- if(e.type() == "vertex"){
- int propsCount = e.properties().size() ; //vertex.sizeOfProperties();
- BytesBuffer buffer = BytesBuffer.allocate(8 + 16 * propsCount);
- buffer.writeId(IdGenerator.of(graphSchema.getVertexLabel(e.label()).id()));
- buffer.writeVInt(propsCount);
- for(Map.Entry<String, Object> entry : e.properties().entrySet()){
- PropertyKey propertyKey = graphSchema.getPropertyKey(entry.getKey());
- buffer.writeVInt(propertyKey.id().intValue());
- buffer.writeProperty(propertyKey.dataType(),entry.getValue());
- }
- array = buffer.bytes();
- } else if ( e.type() == "edge" ){
- int propsCount = e.properties().size();
- BytesBuffer buffer = BytesBuffer.allocate(4 + 16 * propsCount);
- buffer.writeVInt(propsCount);
- for(Map.Entry<String, Object> entry : e.properties().entrySet()){
- PropertyKey propertyKey = graphSchema.getPropertyKey(entry.getKey());
- buffer.writeVInt(propertyKey.id().intValue());
- buffer.writeProperty(propertyKey.dataType(),entry.getValue());
- }
- array = buffer.bytes();
- }
-
... 152685 lines suppressed ...